diff --git a/.agents/manifest.json b/.agents/manifest.json
new file mode 100644
index 0000000000..14a04e2777
--- /dev/null
+++ b/.agents/manifest.json
@@ -0,0 +1,1275 @@
+{
+ "agents":[
+ "claude",
+ "copilot",
+ "opencode"
+ ],
+ "coldboxCliVersion":"8.13.0",
+ "customSkills":[],
+ "excludes":[],
+ "guidelines":[
+ {
+ "autoGenerated":false,
+ "description":"BoxLang modern JVM language syntax, class structure, data types, collections, interoperability, and best practices",
+ "installedVersion":"8.13.0",
+ "name":"boxlang",
+ "source":"coldbox-cli",
+ "syncedAt":"2026-05-19T15:11:13+02:00",
+ "type":"core"
+ },
+ {
+ "autoGenerated":false,
+ "description":"ColdBox HMVC framework conventions, structure, handlers, models, views, REST APIs, testing, and integrations",
+ "installedVersion":"8.13.0",
+ "name":"coldbox",
+ "source":"coldbox-cli",
+ "syncedAt":"2026-05-19T15:11:13+02:00",
+ "type":"core"
+ }
+ ],
+ "language":"boxlang",
+ "lastSync":"2026-05-19T15:11:17+02:00",
+ "mcpServers":{
+ "core":[
+ "boxlang",
+ "coldbox",
+ "commandbox",
+ "testbox",
+ "wirebox",
+ "cachebox",
+ "logbox"
+ ],
+ "custom":[],
+ "module":[
+ "cfmigrations",
+ "cbdebugger"
+ ]
+ },
+ "skills":[
+ {
+ "description":"Use this skill for CommandBox global configuration: config set/show/clear commands, server defaults, ForgeBox API tokens, endpoint settings, proxy configuration, module settings, env var overrides (box_config_*), setting sync across machines, task runner settings, tab completion style, preferred browser, artifacts directory, and nativeShell configuration.",
+ "name":"commandbox-config-settings",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-config-settings",
+ "repo":"skills",
+ "sha":"c9604319038f8af9fcd702fd20c436c6271e0fa7",
+ "slug":"commandbox-config-settings",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for deploying CommandBox applications to production: Docker with ortussolutions/commandbox image, environment variables for Docker, GitHub Actions with setup-commandbox action, Heroku/Dokku buildpack, Amazon Lightsail setup, starting as OS service, using server.json for repeatable deployments, and CFConfig for engine configuration.",
+ "name":"commandbox-deploying",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-deploying",
+ "repo":"skills",
+ "sha":"e5609f82c8e9574f1130c92e1bf778b83c927e39",
+ "slug":"commandbox-deploying",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for developing CommandBox extensions: creating custom commands (CFCs with run() method), command namespaces, parameters and tab completion, WireBox DI injection, command output with print helper, running sub-commands, creating modules (ModuleConfig.cfc), module conventions (commands/models/interceptors), interceptors, lifecycle events, custom interception points, injection DSL, user settings, and linking modules for development.",
+ "name":"commandbox-developing",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-developing",
+ "repo":"skills",
+ "sha":"91cff5d654e2a9e567d21387d2c40217a93b8da7",
+ "slug":"commandbox-developing",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for the CommandBox embedded server: starting and stopping servers, server.json configuration, JVM args, SSL/TLS setup, URL rewrites, server rules/security, multi-site hosting, server profiles (production/development), basic authentication, bindings, custom error pages, aliases, gzip compression, web roots, HTTPS redirect, and starting as an OS service.",
+ "name":"commandbox-embedded-server",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-embedded-server",
+ "repo":"skills",
+ "sha":"8591e67469394428a6d66fbacfc478e306182cbc",
+ "slug":"commandbox-embedded-server",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for CommandBox package management: box.json configuration, installing packages from ForgeBox/Git/HTTP/folder, semantic versioning, dependencies and devDependencies, updating packages, lock files, package scripts, private packages, publishing to ForgeBox, creating packages, and code endpoints.",
+ "name":"commandbox-package-management",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-package-management",
+ "repo":"skills",
+ "sha":"ce49ff6fbd1accbfd0f920724a58666c121b409e",
+ "slug":"commandbox-package-management",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for installing, configuring, and upgrading CommandBox CLI: Homebrew install on Mac, apt-get on Linux, Windows install, Java requirements, custom home directory, upgrading CommandBox, light/thin binaries, non-Oracle JRE setup, and first-run configuration.",
+ "name":"commandbox-setup",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-setup",
+ "repo":"skills",
+ "sha":"92a2efa2dc972c2e28a338c0909d7cd06a6815b6",
+ "slug":"commandbox-setup",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for CommandBox task runners: creating task CFCs, targets, passing parameters, lifecycle events (preTask/postTask/onError), interactive jobs with job DSL, progress bars, async/threading with AsyncManager, watching files, running commands from tasks, shell integration, property files, downloading files, sending email from tasks, and task target dependencies.",
+ "name":"commandbox-task-runners",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-task-runners",
+ "repo":"skills",
+ "sha":"383953b12c7216517fe4a6c678dddf6a03d48fc5",
+ "slug":"commandbox-task-runners",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for CommandBox TestBox integration: testbox run command, running tests from CLI, configuring runner URL in box.json, multiple output formats (json/antjunit), test watcher (testbox watch), CI integration, code coverage with FusionReactor, test labels and suites, and box.json testbox configuration.",
+ "name":"commandbox-testing",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-testing",
+ "repo":"skills",
+ "sha":"92f15326905025f9349b863ea8c493d392dcd8bc",
+ "slug":"commandbox-testing",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill for CommandBox CLI usage: running commands, namespaces, tab completion, system settings, environment variables, shell variables, piping, recipes, REPL, foreach loops, jq/sql/printtable commands, ad-hoc aliases, default parameters, exit codes, and interactive shell features.",
+ "name":"commandbox-usage",
+ "owner":"ortus-boxlang",
+ "path":"commandbox/commandbox-usage",
+ "repo":"skills",
+ "sha":"ca5296263bb1e36ab3e742b8a4c5281c49057aa4",
+ "slug":"commandbox-usage",
+ "source":"commandbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"commandbox"
+ },
+ {
+ "description":"Use this skill when designing or debugging Application.bx behavior: app discovery and nesting, multi-application isolation, lifecycle events, pseudo-constructor settings, session management, mappings/javaSettings resolution, and app-scoped schedulers/watchers via this.schedulers and this.watchers.",
+ "name":"boxlang-application-descriptor",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/application-descriptor",
+ "repo":"skills",
+ "sha":"dc8a1fcc47baccf4446132e147c23d8a9d22072b",
+ "slug":"application-descriptor",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing BoxLang asynchronous code: BoxFuture, futureNew, asyncRun, asyncAll, asyncAny, asyncAllApply, executors, schedulers, thread components, parallel pipelines, file watchers, or distributed locking with bx:lock.",
+ "name":"boxlang-async-programming",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/async-programming",
+ "repo":"skills",
+ "sha":"2b648d42801beaf69cd03b1cb3dfca21e2ed9324",
+ "slug":"async-programming",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing, reviewing, or improving BoxLang code to ensure it follows community best practices for naming, structure, scoping, error handling, performance, and maintainability.",
+ "name":"boxlang-best-practices",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/best-practices",
+ "repo":"skills",
+ "sha":"f418232d4c49539cd576c2c39847374332ec05c5",
+ "slug":"best-practices",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when implementing caching in BoxLang applications: cache providers, cachePut/cacheGet BIFs, output caching, cache regions, distributed caching with Redis or Couchbase, TTL policies, and distributed locking.",
+ "name":"boxlang-caching",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/caching",
+ "repo":"skills",
+ "sha":"2f4de64cca4ce55e90bf953236d7f19ed823289b",
+ "slug":"caching",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when helping developers migrate from CFML (Adobe ColdFusion or Lucee) to BoxLang, understanding key syntax and behavioral differences, using the bx-compat-cfml compatibility module, converting CFML file types, fixing common migration issues (scopes, annotations, query params, date handling), and writing code that works on both runtimes.",
+ "name":"boxlang-cfml-migration",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/cfml-migration",
+ "repo":"skills",
+ "sha":"886502f13d1e783db86d8805698fa79ce41eddb4",
+ "slug":"cfml-migration",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing BoxLang classes, components, interfaces, inheritance hierarchies, annotations, properties, constructors, or applying object-oriented design patterns in BoxLang.",
+ "name":"boxlang-classes-and-oop",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/classes-and-oop",
+ "repo":"skills",
+ "sha":"eb11a552168881ea2a6c8fcf7e01e01a40306544",
+ "slug":"classes-and-oop",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when adding documentation comments to BoxLang code: writing function/class Javadoc-style comments, documenting arguments, return types, exceptions, examples, or generating structured API reference documentation for BoxLang classes and BIFs. Comments written with these conventions are compatible with DocBox API documentation generation.",
+ "name":"boxlang-code-documenter",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/code-documenter",
+ "repo":"skills",
+ "sha":"0b199119e9a8368530017646a8b295bea6000ba7",
+ "slug":"code-documenter",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when reviewing BoxLang code for quality, correctness, security vulnerabilities, performance issues, style violations, or when providing structured code review feedback following BoxLang best practices and security guidelines.",
+ "name":"boxlang-code-reviewer",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/code-reviewer",
+ "repo":"skills",
+ "sha":"85f0487bfafaf795e4f162e04fb695f31d933278",
+ "slug":"code-reviewer",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when configuring BoxLang runtime settings via boxlang.json, setting environment variables for config overrides, configuring datasources, caches, executors, modules, logging, security, or schedulers — or when helping someone understand the BoxLang configuration system.",
+ "name":"boxlang-configuration",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/configuration",
+ "repo":"skills",
+ "sha":"3b8bcd521c1de74de59b015fb7a0380b0a623e9e",
+ "slug":"configuration",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing BoxLang database code: queryExecute, bx:query, datasource configuration, parameterized queries, transactions, stored procedures, query manipulation, or preventing SQL injection.",
+ "name":"boxlang-database-access",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/database-access",
+ "repo":"skills",
+ "sha":"cab36b456165f464e27d242ae487fca8b71d0da1",
+ "slug":"database-access",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when deploying BoxLang applications: CommandBox server setup, Docker containers, AWS Lambda, GitHub Actions CI/CD, BoxLang Version Manager (BVM), boxlang.json runtime config, environment variables, or Spring Boot integration.",
+ "name":"boxlang-deployment",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/deployment",
+ "repo":"skills",
+ "sha":"617b01e09e20ae1c55290cd364ca5d448fe07add",
+ "slug":"deployment",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when generating API documentation for BoxLang or CFML projects with DocBox, including installation, CLI usage, programmatic configuration, HTML/JSON/UML/CommandBox output strategies, HTML themes, multiple sources, excludes patterns, and creating custom strategies. DocBox reads JavaDoc-style comments from your source code — see the code-documenter skill for annotation conventions.",
+ "name":"boxlang-docbox",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/docbox",
+ "repo":"skills",
+ "sha":"d282bb8d09f7d236972569e127b4086311d260af",
+ "slug":"docbox",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when reading, writing, copying, moving, or deleting files and directories in BoxLang: fileRead, fileWrite, fileCopy, fileMove, directoryList, directoryCreate, fileUpload, streaming large files, or processing CSV/JSON files from disk.",
+ "name":"boxlang-file-handling",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/file-handling",
+ "repo":"skills",
+ "sha":"0c3d7769be31288338b78be9d2960f1570c35bc1",
+ "slug":"file-handling",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when implementing BoxLang filesystem watchers: watcherNew/watcherStart/watcherStop lifecycle BIFs, WatcherInstance APIs, event payload handling, recursive directory monitoring, debounce/throttle/atomicWrites tuning, errorThreshold auto-stop behavior, and listener patterns (closure, struct, class, class name string).",
+ "name":"boxlang-file-watchers",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/file-watchers",
+ "repo":"skills",
+ "sha":"7a115f4a903e60c97e685289cf32c3ea562cf19b",
+ "slug":"file-watchers",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with BoxLang lambdas, closures, arrow functions, higher-order functions, functional array/struct pipelines (map, filter, reduce, flatMap, groupBy, etc.), destructuring, or spread syntax.",
+ "name":"boxlang-functional-programming",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/functional-programming",
+ "repo":"skills",
+ "sha":"e22adf6acd28c94ffdc40534fc1c80287a377be9",
+ "slug":"functional-programming",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with BoxLang's interceptor/event system: creating interceptors, registering announcement points, announcing custom events with announce() or announceAsync(), building pre/post operation hooks, validation interceptors, security guards, or leveraging BoxRegisterInterceptor() BIF for standalone and module-based interception.",
+ "name":"boxlang-interceptors",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/interceptors",
+ "repo":"skills",
+ "sha":"4c65657766140185294aa2f4019381ebe8f1df46",
+ "slug":"interceptors",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when integrating BoxLang with Java: createObject, static method calls, type conversion, importing classes, passing closures as functional interfaces, including JARs, JSR-223 scripting, or using Java libraries from BoxLang code.",
+ "name":"boxlang-java-integration",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/java-integration",
+ "repo":"skills",
+ "sha":"e4929fde4a3636767acc3234c4ea510782518807",
+ "slug":"java-integration",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing or reviewing BoxLang code covering syntax, file types, variables, scopes, operators, control flow, exception handling, type system, and modern language features like destructuring and spread syntax.",
+ "name":"boxlang-language-fundamentals",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/language-fundamentals",
+ "repo":"skills",
+ "sha":"be26e718747ea2e449de5e4da5de181b008e2668",
+ "slug":"language-fundamentals",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when installing, configuring, or using BoxLang modules: box install, boxlang.json module settings, BoxLang+ premium modules (bx-pdf, bx-redis, bx-csv, bx-spreadsheet), CFML compatibility, ORM, mail, and module introspection.",
+ "name":"boxlang-modules-and-packages",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/modules-and-packages",
+ "repo":"skills",
+ "sha":"c803ef6efa1e4eccd4c23abe425b06003b9b715c",
+ "slug":"modules-and-packages",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building, deploying, or debugging BoxLang applications on AWS Lambda — including Lambda.bx structure, handler conventions, environment variables, SAM CLI testing, performance optimization, connection pooling, multi-function routing, and the boxlang-starter-aws-lambda project.",
+ "name":"boxlang-runtime-aws-lambda",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-aws-lambda",
+ "repo":"skills",
+ "sha":"9a492564341cdc7eb2951af6807304ab4171a9d8",
+ "slug":"runtime-aws-lambda",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when setting up or developing BoxLang on a Chromebook, including enabling Linux development environment, installing Java 21, installing BoxLang, setting up VS Code with the BoxLang extension, and troubleshooting ARM/Intel Chromebook issues.",
+ "name":"boxlang-runtime-chromebook",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-chromebook",
+ "repo":"skills",
+ "sha":"55346268ea6ea8836b33bd1bc069b3ab99c9dc39",
+ "slug":"runtime-chromebook",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing BoxLang CLI scripts and classes, handling command-line arguments, using the BoxLang REPL, running action commands (compile, cftranspile, featureaudit), detecting runtime context, and leveraging CLI-specific built-in functions.",
+ "name":"boxlang-runtime-cli-scripting",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-cli-scripting",
+ "repo":"skills",
+ "sha":"f623b39f13218e79dd6dca1c7d5cb11454909d45",
+ "slug":"runtime-cli-scripting",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when deploying BoxLang as an enterprise Java servlet application using CommandBox, configuring server.json for BoxLang, installing BoxLang modules, enabling SSL and rewrites, using BoxLang+ or BoxLang++ subscriptions with CommandBox PRO features, and production server configuration.",
+ "name":"boxlang-runtime-commandbox",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-commandbox",
+ "repo":"skills",
+ "sha":"0f80cd178074455bde770fd6293199cec1762253",
+ "slug":"runtime-commandbox",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when compiling BoxLang scripts to standalone native executables using MatchBox's --target native flag, cross-compiling for multiple platforms, optimizing binary size, and using Native Fusion to expose Rust functions as BoxLang built-in functions.",
+ "name":"boxlang-runtime-compiled-native-binaries",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-compiled-native-binaries",
+ "repo":"skills",
+ "sha":"4e113ed2fb7c89b0f223e595f7bde69f47d61db1",
+ "slug":"runtime-compiled-native-binaries",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building BoxLang desktop applications with Electron and the BoxLang MiniServer, including process lifecycle wiring, miniserver.json-driven development control, runtime/Package.bx packaging, .boxlang-dev.json versus .boxlang.json behavior, default /app and /public mappings, and cross-platform packaging constraints.",
+ "name":"boxlang-runtime-desktop",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-desktop",
+ "repo":"skills",
+ "sha":"bf789523b17e5e6ddae4c4cb6e16b6373f7b99b6",
+ "slug":"runtime-desktop",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building BoxLang desktop applications with Electron and the BoxLang MiniServer, including process lifecycle wiring, miniserver.json-driven development control, runtime/Package.bx packaging, .boxlang-dev.json versus .boxlang.json behavior, default /app and /public mappings, and cross-platform packaging constraints.",
+ "name":"boxlang-runtime-desktop-electron",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-desktop-electron",
+ "repo":"skills",
+ "sha":"a4f0a7a2247c1c0f198c24fb3dbfdfbb9d72fc90",
+ "slug":"runtime-desktop-electron",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when deploying BoxLang applications to DigitalOcean App Platform using the official BoxLang starter kit, setting up auto-deployment from GitHub, and understanding the MiniServer + multi-stage Docker build architecture used in the starter.",
+ "name":"boxlang-runtime-digitalocean-app",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-digitalocean-app",
+ "repo":"skills",
+ "sha":"b498346dae91555cdcfa31cda8d592b6ecc1eae6",
+ "slug":"runtime-digitalocean-app",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when containerizing BoxLang applications with Docker, including choosing the right image variant, running scripts, the MiniServer web runtime, environment variables, health checks, volume mounts, Docker Compose, and production deployment patterns.",
+ "name":"boxlang-runtime-docker",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-docker",
+ "repo":"skills",
+ "sha":"ccbd8233af3941146686ccef4dd0731e11446c39",
+ "slug":"runtime-docker",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when deploying BoxLang to ESP32 microcontrollers using MatchBox's --target esp32 flag, flashing firmware (full-flash vs fast-deploy), using watch mode for rapid iteration, accessing hardware via BoxLang BIFs, detecting the ESP32 runtime, and understanding FreeRTOS task constraints.",
+ "name":"boxlang-runtime-esp32",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-esp32",
+ "repo":"skills",
+ "sha":"e59e983c540ee40e00dc0324749ee7b8f61e109c",
+ "slug":"runtime-esp32",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when setting up GitHub Actions CI/CD pipelines for BoxLang projects, including the setup-boxlang action, supported inputs/outputs, installing modules, CommandBox integration, multi-engine testing, and complete workflow templates.",
+ "name":"boxlang-runtime-github-actions",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-github-actions",
+ "repo":"skills",
+ "sha":"1267db6fe25802658d892c9206b6ac2917bc9d0f",
+ "slug":"runtime-github-actions",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building, testing, or deploying BoxLang applications on Google Cloud Functions Gen 2, including handler structure, FunctionRunner entry point, URI routing, environment variables, local development with the GCF invoker, and debugging.",
+ "name":"boxlang-runtime-google-cloud-functions",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-google-cloud-functions",
+ "repo":"skills",
+ "sha":"1e20c64b9e1008b58c16e80dd398aa6ff5a5ba70",
+ "slug":"runtime-google-cloud-functions",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when embedding BoxLang into Java applications via the JSR-223 scripting API, evaluating BoxLang code from Java, sharing data between Java and BoxLang via Bindings, building rules engines, template processors, or configurable logic using BoxLang as a scripting engine inside a JVM application.",
+ "name":"boxlang-runtime-jsr-223",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-jsr-223",
+ "repo":"skills",
+ "sha":"9cebd9c72ec48a44356efcbe8a2324310c5bd52e",
+ "slug":"runtime-jsr-223",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when using MatchBox, the Rust-based native implementation of BoxLang that requires no JVM, including installation, understanding the available compilation targets (native, wasm, js, esp32), the philosophy and tradeoffs vs JVM BoxLang, and choosing the right target for CLI tools, edge deployments, browser WASM, and embedded devices.",
+ "name":"boxlang-runtime-matchbox",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-matchbox",
+ "repo":"skills",
+ "sha":"0614a93c3db40284764b562e8387304f7031c210",
+ "slug":"runtime-matchbox",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when running BoxLang as a lightweight web server using the BoxLang MiniServer (Undertow-based), configuring miniserver.json, using the .boxlang.json project convention, enabling health checks, warmup URLs, environment variable overrides, and tuning for development and production.",
+ "name":"boxlang-runtime-miniserver",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-miniserver",
+ "repo":"skills",
+ "sha":"235de5cbffa7b9fbadf925551ba9d0cf4557ebbe",
+ "slug":"runtime-miniserver",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when integrating BoxLang with Spring Boot applications, including the starter dependency, MVC view resolution, template structure, accessing Spring Model attributes, configuration via application.properties, and returning BoxLang views from Spring controllers.",
+ "name":"boxlang-runtime-spring-boot",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-spring-boot",
+ "repo":"skills",
+ "sha":"492f61355f3df5a0dcd381d1a468c7cd683a0db7",
+ "slug":"runtime-spring-boot",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when compiling BoxLang applications to server-side WebAssembly (WASM) using MatchBox's --target wasm flag, running WASM with Wasmtime or WasmEdge, building minimal OCI containers from WASM binaries, and deploying to edge platforms like Fastly Compute or Cloudflare Workers (WASI).",
+ "name":"boxlang-runtime-wasm-container",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-wasm-container",
+ "repo":"skills",
+ "sha":"a715de92b33e75af42ccddb7c41ffd09440856d6",
+ "slug":"runtime-wasm-container",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when compiling BoxLang to WebAssembly or JavaScript ES modules for use in web browsers and Node.js using MatchBox's --target js or --target wasm flags, integrating with HTML pages, bundlers (Webpack/Vite), and Node.js projects.",
+ "name":"boxlang-runtime-wasm-in-the-browser",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/runtime-wasm-in-the-browser",
+ "repo":"skills",
+ "sha":"b17046c897b77692d5a1a849e7587bade507b63e",
+ "slug":"runtime-wasm-in-the-browser",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating or managing BoxLang scheduled workloads: Scheduler DSL classes, BaseScheduler/ScheduledTask fluent APIs, schedulerStart/schedulerGet/schedulerStats BIFs, cron expressions, frequency constraints, lifecycle callbacks, or HTTP-driven tasks with the bx:schedule component.",
+ "name":"boxlang-scheduled-tasks",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/scheduled-tasks",
+ "repo":"skills",
+ "sha":"5f5ff2b34c2cfa58f5a7ebee3b07996aedbb93dc",
+ "slug":"scheduled-tasks",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when reviewing BoxLang code or applications for security vulnerabilities, configuring security settings, preventing injection attacks, handling file uploads safely, managing secrets, or applying secure coding patterns drawn from OWASP Top 10 and CFML/Java security history.",
+ "name":"boxlang-security",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/security",
+ "repo":"skills",
+ "sha":"58ee951f16cc95d6da080dbc3d83b34c9532fa63",
+ "slug":"security",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing BoxLang markup templates (.bxm files), mixing HTML with BoxLang output expressions, using template components like bx:output, bx:loop, bx:if, bx:include, bx:script, building views, or creating any HTML-generating template files.",
+ "name":"boxlang-templating",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/templating",
+ "repo":"skills",
+ "sha":"5512163fcf67291569648a5467eeb1f6aa58702f",
+ "slug":"templating",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing, running, or debugging tests for BoxLang applications using TestBox: BDD-style describe/it specs, xUnit-style test classes, expectations (expect/toBe matchers), assertions ($assert), life-cycle methods (beforeAll/afterAll/beforeEach/afterEach/aroundEach), MockBox mocking (createMock/prepareMock/$()/$results()), mock data generation (mockData()), async testing, exception testing, focused/skipped specs, and running tests via the BoxLang CLI runner.",
+ "name":"boxlang-testing",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/testing",
+ "repo":"skills",
+ "sha":"bb0452c066e58e66aa1392ed9c5052aa09d59488",
+ "slug":"testing",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building BoxLang web applications: Application.bx lifecycle, request/response handling, sessions, forms, REST APIs, HTTP clients, routing, CSRF protection, Server-Sent Events, or configuring CommandBox/MiniServer.",
+ "name":"boxlang-web-development",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/web-development",
+ "repo":"skills",
+ "sha":"9e9a42c6934c894d2fc1a08d7fae169f9f4a3183",
+ "slug":"web-development",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating, extracting, listing, or modifying ZIP archives in BoxLang using the bx:zip component: compressing directories or files, filtering entries, reading archive contents, downloading files as a ZIP, or building backup/restore workflows.",
+ "name":"boxlang-zip",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/zip",
+ "repo":"skills",
+ "sha":"6e9203e22ae65e68d848580376b8ce51f3e50518",
+ "slug":"zip",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing, reviewing, or formatting any Ortus Solutions code (BoxLang, CFML, or Java) to ensure it follows the official Ortus coding standards: indentation, spacing, brace placement, naming, alignment, comments, and structural conventions.",
+ "name":"ortus-coding-standards",
+ "owner":"ortus-boxlang",
+ "path":"boxlang-developer/ortus-coding-standards",
+ "repo":"skills",
+ "sha":"8d781a7f7a9f853e57ae6b5fc8382486ed8586d6",
+ "slug":"ortus-coding-standards",
+ "source":"boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with CacheBox as a standalone caching framework (outside ColdBox) -- installing, creating and bootstrapping the CacheFactory, configuring the DSL, choosing object stores and eviction policies, selecting cache providers (CacheBoxProvider, CF, Lucee), implementing cache-aside/stampede-protection patterns, registering standalone listeners, named caches, disk/JDBC stores, reaping, shutdown, or monitoring cache performance.",
+ "name":"cachebox-standalone",
+ "owner":"coldbox",
+ "path":"cachebox",
+ "repo":"skills",
+ "sha":"f898016dea1a65a0956c14c2d857673f42932121",
+ "slug":"cachebox",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill whenever working with LogBox -- standalone or inside a ColdBox application. Covers installation, configuration DSL (appenders, root logger, categories), all built-in appender types with their properties, logger injection via WireBox DSL, category inheritance, structured logging with extraInfo, performance patterns (can{} methods, closure messages), custom appenders, custom layouts, async logging, environment-specific config, and production best practices.",
+ "name":"logbox",
+ "owner":"coldbox",
+ "path":"logbox",
+ "repo":"skills",
+ "sha":"30caad842596a6cc9ea88a0d17256c9b3527db49",
+ "slug":"logbox",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with WireBox dependency injection -- bootstrapping the injector, configuring binders, creating object mappings, using the injection DSL, setting persistence scopes, applying providers to avoid scope-widening, lazy properties, property observers, object delegation, virtual inheritance, child injectors, the object populator, or WireBox event listeners. Applies to both standalone and ColdBox-integrated usage.",
+ "name":"wirebox-di",
+ "owner":"coldbox",
+ "path":"wirebox",
+ "repo":"skills",
+ "sha":"ae2c087631ef43d22311e970d4ae3e06bfbff20d",
+ "slug":"wirebox",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when integrating AI capabilities into a ColdBox application using the BoxLang AI library (bx-ai module) -- including simple chat, streaming, pipelines, agents, RAG with vector memory, document loading, tool calling, and injecting the AI service into handlers or models.",
+ "name":"coldbox-ai-integration",
+ "owner":"coldbox",
+ "path":"coldbox/ai-integration",
+ "repo":"skills",
+ "sha":"03f936b4d58030c5df2be1fde0fdfac04eaf1fa7",
+ "slug":"ai-integration",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when choosing a ColdBox application layout (flat, boxlang, or modern), scaffolding a new ColdBox project, understanding project directory structure, deciding between app structure options, or migrating from one layout to another. Use when asked about flat layout, boxlang template, modern template, app structure, project skeleton, or web root separation.",
+ "name":"coldbox-app-layouts",
+ "owner":"coldbox",
+ "path":"coldbox/app-layouts",
+ "repo":"skills",
+ "sha":"43c11e23553777bfc03d2dbdf06c401bc52a6b98",
+ "slug":"app-layouts",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building async pipelines, working with ColdBox Futures, running parallel computations with all()/allApply()/anyOf(), registering and managing thread-pool executors, or accessing the AsyncManager via the async() helper.",
+ "name":"coldbox-async-programming",
+ "owner":"coldbox",
+ "path":"coldbox/async-programming",
+ "repo":"skills",
+ "sha":"e6e6f0291c9a912bd2086eb15504442cb33f2c4e",
+ "slug":"async-programming",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when implementing caching inside a ColdBox application -- configuring CacheBox via ColdBox.cfc or config/CacheBox.cfc, injecting caches with WireBox (cachebox:name), using getCache() in handlers, event/view output caching with setEventCacheableEntry(), view fragment caching with renderView(cache=true), query caching, cache listeners as ColdBox interceptors, Redis/distributed provider setup, or choosing between default and template caches.",
+ "name":"coldbox-cache-integration",
+ "owner":"coldbox",
+ "path":"coldbox/cache-integration",
+ "repo":"skills",
+ "sha":"cc99cea5e6a7091447f33907605c39e7e98e4866",
+ "slug":"cache-integration",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when using the ColdBox CLI (CommandBox module) to scaffold applications, generate handlers, models, services, views, layouts, interceptors, modules, ORM artifacts, tests, or manage AI integration. Covers all `coldbox create` commands, language flags (BoxLang vs CFML), app skeleton selection, feature flags (--docker, --vite, --rest, --migrations, --ai), template token patterns, layout detection, and AI integration sub-commands.",
+ "name":"coldbox-cli",
+ "owner":"coldbox",
+ "path":"coldbox/coldbox-cli",
+ "repo":"skills",
+ "sha":"c7db1800891b2ccc17e059247fee3946176c3f98",
+ "slug":"coldbox-cli",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when configuring a ColdBox application in ColdBox.cfc, setting up environments, managing module settings, defining datasources, configuring logging with LogBox, setting up caching with CacheBox, or wiring dependencies with WireBox settings.",
+ "name":"coldbox-configuration",
+ "owner":"coldbox",
+ "path":"coldbox/configuration",
+ "repo":"skills",
+ "sha":"610817d9e6024945ff8ede49c3d2f47f228b2e03",
+ "slug":"configuration",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when extending or overriding ColdBox framework internals via the Decorator pattern -- specifically creating a ControllerDecorator to wrap the main ColdBox controller, or a RequestContextDecorator to wrap and augment the request context (event) object with custom methods or overridden behavior.",
+ "name":"coldbox-decorators",
+ "owner":"coldbox",
+ "path":"coldbox/decorators",
+ "repo":"skills",
+ "sha":"f64ed3543ac85b2563a149dd271afdc4071c2f77",
+ "slug":"decorators",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with dependency injection inside a ColdBox application -- the ColdBox injection DSL namespaces (coldbox:, logbox:, cachebox:, wirebox:, model:), module settings injection, injecting ColdBox services (interceptors, flash, router, scheduler), configuring the WireBox binder in ColdBox context, the enhanced ColdBox binder helpers, or wiring handlers/interceptors/models via ColdBox-aware WireBox.",
+ "name":"coldbox-di",
+ "owner":"coldbox",
+ "path":"coldbox/wirebox-di",
+ "repo":"skills",
+ "sha":"6c46f33299d6dbd08b1cb8159ad38b5fdaa21a89",
+ "slug":"wirebox-di",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing or improving documentation comments for ColdBox application code -- handlers, models, services, interceptors, layouts, modules, and configuration files. Covers what to document, what to skip, ColdBox-specific patterns for @event/@rc/@prc, integration with DocBox annotations, and documentation standards that result in accurate, useful API docs.",
+ "name":"coldbox-documenter",
+ "owner":"coldbox",
+ "path":"coldbox/coldbox-documenter",
+ "repo":"skills",
+ "sha":"eb27c2d9e571294413f62d286635726de3c06500",
+ "slug":"coldbox-documenter",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with the ColdBox event object (prc/rc), managing request collections, rendering views and data responses, handling redirects with relocate(), controlling HTTP status codes, or implementing event caching in ColdBox handlers.",
+ "name":"coldbox-event-model",
+ "owner":"coldbox",
+ "path":"coldbox/event-model",
+ "repo":"skills",
+ "sha":"321303146880471fd242e433c7c87d468bd25536",
+ "slug":"event-model",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when implementing flash RAM messaging in ColdBox, using cbMessageBox for styled notifications, building POST-REDIRECT-GET patterns, persisting messages across redirects, showing success/error/warning/info alerts, or integrating flash with form validation.",
+ "name":"coldbox-flash-messaging",
+ "owner":"coldbox",
+ "path":"coldbox/flash-messaging",
+ "repo":"skills",
+ "sha":"bb697722d64b1b29d2899bda1bf9faaa971dbc97",
+ "slug":"flash-messaging",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating ColdBox handlers (controllers), implementing CRUD actions, adding dependency injection to handlers, working with preHandler/postHandler advices, secured actions, REST handlers, or the EventHandler base class.",
+ "name":"coldbox-handler-development",
+ "owner":"coldbox",
+ "path":"coldbox/handler-development",
+ "repo":"skills",
+ "sha":"736d5fd7160a5af9211130c8431267f40c1f1afc",
+ "slug":"handler-development",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating ColdBox interceptors for cross-cutting concerns, listening to framework lifecycle events, implementing security checks, logging, CORS, rate limiting, request/response transformation, or firing and listening to custom interception points.",
+ "name":"coldbox-interceptor-development",
+ "owner":"coldbox",
+ "path":"coldbox/interceptor-development",
+ "repo":"skills",
+ "sha":"efaa85ee780547a6a2bcaf54683ba5029af9305b",
+ "slug":"interceptor-development",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating ColdBox layouts (master page templates), building admin layouts, creating reusable view partials, implementing nested content rendering with renderView(), switching layouts dynamically per handler, or organizing HTML structure around content views.",
+ "name":"coldbox-layout-development",
+ "owner":"coldbox",
+ "path":"coldbox/layout-development",
+ "repo":"skills",
+ "sha":"44cb46f5d01bae9120ccf1745c3c271b04c214c1",
+ "slug":"layout-development",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill for all ColdBox-specific logging concerns: configuring LogBox inside a ColdBox application (config/LogBox.cfc, inline DSL, configFile pointer), per-environment log levels, injecting loggers into handlers/interceptors/services via the WireBox logbox DSL, accessing logbox from the ColdBox proxy, and logging best practices specific to the ColdBox lifecycle.",
+ "name":"coldbox-logging",
+ "owner":"coldbox",
+ "path":"coldbox/logging",
+ "repo":"skills",
+ "sha":"56e1058ed8032f6e528e3aab3a6167bfa3557415",
+ "slug":"logging",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating reusable ColdBox modules, writing ModuleConfig.cfc, defining module-specific routes, models, settings, and interceptors, packaging modules for ForgeBox, or building internal application sub-systems as modules.",
+ "name":"coldbox-module-development",
+ "owner":"coldbox",
+ "path":"coldbox/module-development",
+ "repo":"skills",
+ "sha":"671d5bfb379103846c2d704cc543f9aefe63b285",
+ "slug":"module-development",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building ColdBox Proxy objects to expose ColdBox event handlers to remote callers such as ColdFusion web services, Flex/AIR, event gateways, or CFC data binding -- enabling non-HTTP protocols to participate in the ColdBox event model.",
+ "name":"coldbox-proxy",
+ "owner":"coldbox",
+ "path":"coldbox/coldbox-proxy",
+ "repo":"skills",
+ "sha":"1c6f0be3461e112608c113dbfbcb93fedd8f14fa",
+ "slug":"coldbox-proxy",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with the ColdBox RequestContext object (event), managing rc and prc collections, building URLs with buildLink(), detecting HTTP methods, accessing request metadata, working with flash scope, handling AJAX requests, or reading HTTP headers and body content.",
+ "name":"coldbox-request-context",
+ "owner":"coldbox",
+ "path":"coldbox/request-context",
+ "repo":"skills",
+ "sha":"8310906e4edf9a07a8272a79efeee085f9520c91",
+ "slug":"request-context",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when building RESTful APIs in ColdBox using RestHandler, creating CRUD API endpoints, implementing API versioning, handling JWT/bearer token authentication, building structured error responses, or creating resource representations with mementos.",
+ "name":"coldbox-rest-api-development",
+ "owner":"coldbox",
+ "path":"coldbox/rest-api-development",
+ "repo":"skills",
+ "sha":"9fc898cefb204d73dd16b849c171c0f96cf7d406",
+ "slug":"rest-api-development",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when reviewing ColdBox application code for correctness, security, performance, testability, and adherence to ColdBox conventions. Covers handlers, services, models, interceptors, modules, routing, ORM/OBM usage, REST APIs, dependency injection patterns, and common anti-patterns to flag during pull request reviews.",
+ "name":"coldbox-reviewer",
+ "owner":"coldbox",
+ "path":"coldbox/coldbox-reviewer",
+ "repo":"skills",
+ "sha":"63140ed81a7ab1710f41b8cc53c6cfd5eed5d52d",
+ "slug":"coldbox-reviewer",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when configuring ColdBox routes, setting up RESTful resource routes, creating route groups, implementing URL pattern matching with constraints, defining named routes, or working with Router.cfc in a ColdBox application.",
+ "name":"coldbox-routing-development",
+ "owner":"coldbox",
+ "path":"coldbox/routing-development",
+ "repo":"skills",
+ "sha":"1a79fd2bda15e3e3f6045c83087c89320477229a",
+ "slug":"routing-development",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating ColdBox scheduled tasks, building Scheduler.cfc files, registering task frequencies, managing task life-cycles (before/after/onFailure/onSuccess), using server fixation for clustered apps, or configuring module schedulers.",
+ "name":"coldbox-scheduled-tasks",
+ "owner":"coldbox",
+ "path":"coldbox/scheduled-tasks",
+ "repo":"skills",
+ "sha":"ea3dd624105f8ccba98a45bc2383125b49a84aa8",
+ "slug":"scheduled-tasks",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill to understand which ColdBox testing base class to extend for a given test type, configure test bundle annotations (appMapping, configMapping, unloadColdBox, loadColdBox, coldboxAppKey), set up the tests/ harness (Application.cfc, folder structure), or choose between integration testing (BaseTestCase), isolated handler testing (BaseHandlerTest), model unit testing (BaseModelTest), and interceptor unit testing (BaseInterceptorTest).",
+ "name":"coldbox-testing-base-classes",
+ "owner":"coldbox",
+ "path":"coldbox/testing-base-classes",
+ "repo":"skills",
+ "sha":"01e96956d348adfa8d446e33a8c6963466ebcd1c",
+ "slug":"testing-base-classes",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when testing ColdBox event handlers with execute(), asserting rc/prc collections, verifying view selection and rendered output, mocking relocations, testing renderData() and getHandlerResults(), setting HTTP methods and headers, injecting mocks into handlers, or using BaseHandlerTest for isolated handler unit tests.",
+ "name":"coldbox-testing-handler",
+ "owner":"coldbox",
+ "path":"coldbox/testing-handler",
+ "repo":"skills",
+ "sha":"04e67320a521e02fab7c70f5ef2cfb1b91d795ec",
+ "slug":"testing-handler",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when simulating HTTP requests in ColdBox tests using the get(), post(), put(), patch(), delete(), or request() methods, setting request headers (Authorization, Accept, Content-Type), sending JSON request bodies, asserting response status with toHaveStatus(), checking validation errors with toHaveInvalidData(), or understanding the difference between execute() (event-based) and the HTTP method helpers (route/URL-based).",
+ "name":"coldbox-testing-http-methods",
+ "owner":"coldbox",
+ "path":"coldbox/testing-http-methods",
+ "repo":"skills",
+ "sha":"9a103b8c95fc0825bf924d27461e5d9446339c98",
+ "slug":"testing-http-methods",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing integration tests for ColdBox that use real dependencies (database, WireBox, ColdBox context), testing full request/response cycles with execute(), setting up and tearing down test databases, testing services with real data, or using BaseTestCase for end-to-end handler tests with actual WireBox injections.",
+ "name":"coldbox-testing-integration",
+ "owner":"coldbox",
+ "path":"coldbox/testing-integration",
+ "repo":"skills",
+ "sha":"4866ae271b328b4320cf14700298bf12d6aebd90",
+ "slug":"testing-integration",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when unit testing ColdBox interceptors in isolation using BaseInterceptorTest, accessing the pre-wired interceptor variable, leveraging mock helpers (mockController, mockRequestService, mockLogger, mockLogBox, mockFlash), configuring interceptor properties with configProperties, calling interceptor announce points directly, or scaffolding interceptor tests with CommandBox.",
+ "name":"coldbox-testing-interceptor",
+ "owner":"coldbox",
+ "path":"coldbox/testing-interceptor",
+ "repo":"skills",
+ "sha":"f6365993c953fb179508fb19157e309fe1892f00",
+ "slug":"testing-interceptor",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when unit testing ColdBox model objects (services, repositories, entities, or utility classes) in isolation using BaseModelTest, accessing the pre-wired model variable, leveraging the built-in mock helpers (mockLogger, mockLogBox, mockCacheBox, mockWireBox), calling model.init() to initialize the component, mocking injected properties with prepareMock(), or scaffolding model tests with CommandBox.",
+ "name":"coldbox-testing-model",
+ "owner":"coldbox",
+ "path":"coldbox/testing-model",
+ "repo":"skills",
+ "sha":"18aa810dbfb57766e02d2c85486c94181569b0a2",
+ "slug":"testing-model",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when rendering views and partials in ColdBox, creating reusable view components, caching view output, passing data to views, rendering views from services, using renderView() inline, or dynamically selecting views based on context.",
+ "name":"coldbox-view-rendering",
+ "owner":"coldbox",
+ "path":"coldbox/view-rendering",
+ "repo":"skills",
+ "sha":"9809a1282144ccdea09a808ff836eab4d8716771",
+ "slug":"view-rendering",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when managing database schema changes in ColdBox/BoxLang using cfmigrations and commandbox-migrations. Covers migration file structure, Schema Builder API, seeding, and CLI workflows for creating, running, and rolling back migrations safely.",
+ "name":"database-migrations",
+ "owner":"coldbox",
+ "path":"coldbox/database-migrations",
+ "repo":"skills",
+ "sha":"19f109117d052ff86031a61794f288b08371a41e",
+ "slug":"database-migrations",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when working with WireBox Aspect-Oriented Programming (AOP) -- activating the AOP engine (Mixer listener), creating method interceptor aspects, registering aspects via mapAspect(), binding aspects to classes and methods via bindAspect(), using the Matcher DSL (any, regex, mappings, instanceOf, annotatedWith, methods, returns), auto-aspect binding via classMatcher/methodMatcher annotations, the MethodInvocation API (proceed, getArgs, getTarget, getMethod), using built-in aspects (CFTransaction, HibernateTransaction, MethodLogger), and AOP in both standalone WireBox and ColdBox applications.",
+ "name":"wirebox-aop",
+ "owner":"coldbox",
+ "path":"coldbox/wirebox-aop",
+ "repo":"skills",
+ "sha":"666d086e70ec142510e65634078fe9bf0ac98543",
+ "slug":"wirebox-aop",
+ "source":"coldbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when using the TestBox $assert object for xUnit-style assertions: isTrue, isEqual, includes, isEmpty, key, instanceOf, throws, between, closeTo, lengthOf, match, null, typeOf, and others; registering custom assertion functions with addAssertions(); or using BoxLang dynamic assertion methods (assertIsTrue, assertBetween, etc.).",
+ "name":"testbox-assertions",
+ "owner":"coldbox",
+ "path":"testbox/assertions",
+ "repo":"skills",
+ "sha":"b9f69242900067525bc5481ea0be708d7ab742b3",
+ "slug":"assertions",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing BDD-style tests with TestBox using describe/it blocks, feature/story/scenario/given/when/then Gherkin-style suites, lifecycle hooks (beforeAll/afterAll/beforeEach/afterEach/aroundEach), focused specs (fit/fdescribe), skipping specs (xit/xdescribe/skip()), spec data binding, asyncAll parallel specs, nested suite trees, labels, or organizing tests around behavior descriptions.",
+ "name":"testbox-bdd",
+ "owner":"coldbox",
+ "path":"testbox/bdd",
+ "repo":"skills",
+ "sha":"1ecc38615b9defbae445f3b97b09595fbb65c376",
+ "slug":"bdd",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when generating realistic fake/mock data in tests using cbMockData (WireBox ID: MockData@cbMockData): age, boolean, date, datetime, email, fname, lname, name, num, sentence, ssn, string, tel, uuid, url, words, lorem, baconlorem, imageurl, ipaddress, autoincrement, oneof, rnd/rand; generating arrays of objects, nested objects, arrays of values, or using custom supplier closures.",
+ "name":"testbox-cbmockdata",
+ "owner":"coldbox",
+ "path":"testbox/cbmockdata",
+ "repo":"skills",
+ "sha":"3cbeb192c3ea265d8aee66d8f82b2e9e52a090e6",
+ "slug":"cbmockdata",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing fluent expectations in TestBox using expect(), expectAll(), all built-in matchers (toBe, toBeTrue, toBeArray, toHaveKey, toThrow, toMatch, toBeBetween, toBeCloseTo, toInclude, etc.), the not operator (notToBe, notToBeEmpty, etc.), chaining multiple matchers on one expect(), creating custom matchers with addMatchers(), or using expectAll() over collections.",
+ "name":"testbox-expectations",
+ "owner":"coldbox",
+ "path":"testbox/expectations",
+ "repo":"skills",
+ "sha":"1d26f7ae9dd658b45cb4b4155ee6426634d8a315",
+ "slug":"expectations",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when implementing TestBox run listeners (callbacks): onBundleStart, onBundleEnd, onSuiteStart, onSuiteEnd, onSpecStart, onSpecEnd; building progress indicators, custom loggers, or live dashboards that react to test lifecycle events; or passing listener callbacks to TestBox's run(), runRaw(), or the standalone runner.",
+ "name":"testbox-listeners",
+ "owner":"coldbox",
+ "path":"testbox/listeners",
+ "repo":"skills",
+ "sha":"18e8847c44d32aa4d9a7b3a9b24ae60ee2c47fe3",
+ "slug":"listeners",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating mocks, stubs, and spies in TestBox using MockBox: createMock(), createEmptyMock(), prepareMock(), stubbing methods with $(), chaining $args()/$results()/$throws(), verifying call counts with $once()/$never()/$times()/$atLeast()/$atMost(), reading call logs with $callLog(), injecting mock properties with $property(), simulating queries with querySim(), or spying on real methods with $spy().",
+ "name":"testbox-mockbox",
+ "owner":"coldbox",
+ "path":"testbox/mockbox",
+ "repo":"skills",
+ "sha":"081ec8e30c50c0fcb79fd74a668abf1bd17abaac",
+ "slug":"mockbox",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when selecting or configuring TestBox reporters: ANTJunit, Console, Doc, JSON, JUnit, Min, MinText, Simple, Text, XML, Streaming; setting reporter options (hideSkipped, editor links for Simple reporter); or creating a custom reporter by implementing the IReporter interface.",
+ "name":"testbox-reporters",
+ "owner":"coldbox",
+ "path":"testbox/reporters",
+ "repo":"skills",
+ "sha":"b1d4aeaf3f5f53678789e1a6abc744f0af7f0d4e",
+ "slug":"reporters",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when running TestBox tests: CommandBox CLI (testbox run), BoxLang CLI (./testbox/run), HTML web runner, programmatic TestBox instantiation (run/runRaw/runRemote), configuring test directories or bundles, using the streaming runner (--stream flag / StreamingRunner), watcher mode, all CLI flags (--show-failed-only, --dry-run, --slow-threshold-ms, --stacktrace, --max-failures), or setting up box.json testbox configuration.",
+ "name":"testbox-runners",
+ "owner":"coldbox",
+ "path":"testbox/runners",
+ "repo":"skills",
+ "sha":"a867d4b47e12ddb7a089711708178a5e34fd6a56",
+ "slug":"runners",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when writing xUnit-style tests in TestBox using test functions (testXxx()), setup/teardown lifecycle (beforeTests/afterTests/setup/teardown), $assert assertion object, or the Arrange-Act-Assert (AAA) pattern for unit testing services, models, and utilities in isolation.",
+ "name":"testbox-unit-xunit",
+ "owner":"coldbox",
+ "path":"testbox/unit",
+ "repo":"skills",
+ "sha":"0386bf0630ec26447427880dff12d83e9db4e233",
+ "slug":"unit",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when setting up code coverage analysis for ColdBox/ColdFusion/BoxLang applications, configuring coverage reporting, integrating coverage with CI pipelines, using TestBox coverage options, interpreting coverage metrics, or improving test coverage of untested code paths.",
+ "name":"testing-coverage",
+ "owner":"coldbox",
+ "path":"testbox/testing-coverage",
+ "repo":"skills",
+ "sha":"8d04975dcdd3cf107d13cae04c40905f77460c92",
+ "slug":"testing-coverage",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when creating test fixtures, factory patterns, or test data builders in ColdBox/TestBox, setting up shared fixture files, creating user/model factories with overrides, using cbMockData for realistic fake data generation, or managing test data setup and teardown.",
+ "name":"testing-fixtures",
+ "owner":"coldbox",
+ "path":"testbox/testing-fixtures",
+ "repo":"skills",
+ "sha":"c24b6d41bcf5565eaa89cb4be2c880c01273c729",
+ "slug":"testing-fixtures",
+ "source":"testbox",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"core"
+ },
+ {
+ "description":"Use this skill when installing, configuring, or using the CBDebugger visual debugging panel in a ColdBox application. Covers enabling the panel in development, performance profiling, SQL query tracking, cache monitoring, request inspection, and ensuring the debugger is disabled in production.",
+ "name":"cbdebugger",
+ "owner":"coldbox",
+ "path":"modules/cbdebugger",
+ "repo":"skills",
+ "sha":"230a06137bb813f591d6c2eec6d972e8b9a6d655",
+ "slug":"cbdebugger",
+ "source":"cbdebugger",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"module"
+ },
+ {
+ "description":"Use this skill when configuring CommandBox to run BoxLang server instances, using the BoxLang REPL, running BoxLang task runners, and managing BoxLang modules via CommandBox. Covers server.json BoxLang configuration, CLI commands, module installation, and the BoxLang-specific CommandBox workflow.",
+ "name":"commandbox-boxlang",
+ "owner":"coldbox",
+ "path":"modules/commandbox-boxlang",
+ "repo":"skills",
+ "sha":"d26c66c5375478e480acc69ec2b7b28e78816931",
+ "slug":"commandbox-boxlang",
+ "source":"commandbox-boxlang",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"module"
+ },
+ {
+ "description":"Use this skill when running database migrations from the CommandBox CLI using commandbox-migrations, including migrate up/down/reset/refresh, creating migration files, running seeders, and checking migration status. Covers CI/CD usage, configuration, and all CLI commands for cfmigrations.",
+ "name":"commandbox-migrations",
+ "owner":"coldbox",
+ "path":"modules/commandbox-migrations",
+ "repo":"skills",
+ "sha":"7450f3afd0462a395a5ce0f349662bc7ff42dd69",
+ "slug":"commandbox-migrations",
+ "source":"commandbox-migrations",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"module"
+ },
+ {
+ "description":"Use this skill when inspecting all registered ColdBox routes using the route-visualizer module. Covers installation as a development dependency, accessing the route-visualizer UI, understanding the route table output, and restricting access to development environments.",
+ "name":"route-visualizer",
+ "owner":"coldbox",
+ "path":"modules/route-visualizer",
+ "repo":"skills",
+ "sha":"71daacc7e0b03642a9caa8838c1d1f4bbab3f152",
+ "slug":"route-visualizer",
+ "source":"route-visualizer",
+ "syncedAt":"2026-05-19T15:11:17+02:00",
+ "type":"module"
+ }
+ ],
+ "templateType":"flat"
+}
diff --git a/.bxformat.json b/.bxformat.json
new file mode 100644
index 0000000000..59154e7d49
--- /dev/null
+++ b/.bxformat.json
@@ -0,0 +1,125 @@
+{
+ "indentSize" : 4,
+ "tabIndent" : true,
+ "maxLineLength" : 120,
+ "newLine" : "\n",
+ "singleQuote" : false,
+ "preserveStringQuotes" : false,
+ "alignConsecutiveAssignments" : true,
+ "alignConsecutiveProperties" : false,
+ "bracketPadding" : true,
+ "parensPadding" : true,
+ "binaryOperatorsPadding" : true,
+ "semicolons" : true,
+ "cfFormatCompatibility" : true,
+ "sourceType" : null,
+ "struct" : {
+ "padding" : true,
+ "empty_padding" : false,
+ "quote_keys" : false,
+ "separator" : ": ",
+ "multiline" : {
+ "element_count" : 5,
+ "comma_dangle" : false,
+ "leading_comma" : {
+ "enabled" : false,
+ "padding" : true
+ },
+ "min_length" : 60
+ }
+ },
+ "property" : {
+ "multiline" : {
+ "element_count" : 5,
+ "comma_dangle" : false,
+ "leading_comma" : {
+ "enabled" : false,
+ "padding" : true
+ },
+ "min_length" : 80
+ },
+ "key_value" : {
+ "padding" : false
+ }
+ },
+ "array" : {
+ "padding" : true,
+ "empty_padding" : false,
+ "multiline" : {
+ "element_count" : 5,
+ "comma_dangle" : false,
+ "leading_comma" : {
+ "enabled" : false,
+ "padding" : true
+ },
+ "min_length" : 60
+ }
+ },
+ "for_loop_semicolons" : {
+ "padding" : true
+ },
+ "function" : {
+ "style" : "preserve",
+ "parameters" : {
+ "padding" : true,
+ "empty_padding" : false,
+ "comma_dangle" : false,
+ "multiline_count" : 5,
+ "multiline_length" : 50
+ },
+ "arrow" : {
+ "parens" : "always"
+ }
+ },
+ "arguments" : {
+ "padding" : true,
+ "empty_padding" : false,
+ "comma_dangle" : false,
+ "multiline_count" : 3,
+ "multiline_length" : 60
+ },
+ "braces" : {
+ "style" : "same-line",
+ "require_for_single_statement" : true,
+ "else" : {
+ "style" : "same-line"
+ }
+ },
+ "operators" : {
+ "position" : "end",
+ "comparison_style" : "preserve",
+ "ternary" : {
+ "style" : "flat",
+ "question_position" : "start"
+ }
+ },
+ "chain" : {
+ "break_count" : 3,
+ "break_length" : 2147483647
+ },
+ "template" : {
+ "component_prefix" : "bx",
+ "indent_content" : false,
+ "single_attribute_per_line" : false,
+ "self_closing" : false
+ },
+ "import" : {
+ "sort" : true,
+ "group" : false
+ },
+ "comments" : {
+ "preserve_blank_lines" : true,
+ "wrap" : false
+ },
+ "class" : {
+ "member_order" : "preserve",
+ "member_spacing" : 1,
+ "property_order" : "preserve",
+ "method_order" : "preserve",
+ "method_grouping" : true
+ },
+ "sql" : {
+ "uppercase_keywords" : true,
+ "indent_clauses" : true
+ }
+}
\ No newline at end of file
diff --git a/.bxlint.json b/.bxlint.json
new file mode 100644
index 0000000000..d5293c8f08
--- /dev/null
+++ b/.bxlint.json
@@ -0,0 +1,62 @@
+{
+ "include": [],
+ "exclude": [
+ "**/boxlang_modules/**",
+ "**/build/**",
+ "**/.gradle/**",
+ "**/node_modules/**",
+ "modules/contentbox/modules/contentbox-deps/**",
+ "coldbox/**",
+ "testbox/**"
+ ],
+ "diagnostics": {
+ "unusedVariable": {
+ "enabled": true,
+ "severity": "hint"
+ },
+ "unscopedVariable": {
+ "enabled": true,
+ "severity": "warning"
+ },
+ "duplicateMethod": {
+ "enabled": true,
+ "severity": "error"
+ },
+ "duplicateProperty": {
+ "enabled": true,
+ "severity": "error"
+ },
+ "emptyCatchBlock": {
+ "enabled": true,
+ "severity": "warning"
+ },
+ "invalidExtends": {
+ "enabled": false,
+ "severity": "error"
+ },
+ "invalidImplements": {
+ "enabled": false,
+ "severity": "error"
+ },
+ "missingReturnStatement": {
+ "enabled": true,
+ "severity": "warning"
+ },
+ "shadowedVariable": {
+ "enabled": true,
+ "severity": "warning"
+ },
+ "unreachableCode": {
+ "enabled": true,
+ "severity": "warning"
+ },
+ "unusedImport": {
+ "enabled": true,
+ "severity": "warning"
+ },
+ "unusedPrivateMethod": {
+ "enabled": false,
+ "severity": "warning"
+ }
+ }
+}
\ No newline at end of file
diff --git a/.cfconfig.json b/.cfconfig.json
index b01addd535..b8a27495da 100644
--- a/.cfconfig.json
+++ b/.cfconfig.json
@@ -1,6 +1,4 @@
{
- "systemErr":"System",
- "systemOut":"System",
"componentCacheEnabled":false,
"saveClassFiles":false,
"robustExceptionEnabled":true,
@@ -12,6 +10,7 @@
"whitespaceManagement":"white-space-pref",
"postParametersLimit" : 200,
"cacheDefaultObject":"contentbox",
+ "enableNestedTransactions" : false,
"caches":{
"contentbox":{
"storage":"true",
diff --git a/.cfformat.json b/.cfformat.json
deleted file mode 100644
index 750c2f588e..0000000000
--- a/.cfformat.json
+++ /dev/null
@@ -1,63 +0,0 @@
-{
- "array.empty_padding": false,
- "array.padding": true,
- "array.multiline.min_length": 50,
- "array.multiline.element_count": 2,
- "array.multiline.leading_comma.padding": true,
- "array.multiline.leading_comma": false,
- "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,
- "for_loop_semicolons.padding": true,
- "function_call.empty_padding": false,
- "function_call.padding": true,
- "function_call.multiline.leading_comma.padding": true,
- "function_call.casing.builtin": "cfdocs",
- "function_call.casing.userdefined": "camel",
- "function_call.multiline.element_count": 3,
- "function_call.multiline.leading_comma": false,
- "function_call.multiline.min_length": 50,
- "function_declaration.padding": true,
- "function_declaration.empty_padding": false,
- "function_declaration.multiline.leading_comma": false,
- "function_declaration.multiline.leading_comma.padding": true,
- "function_declaration.multiline.element_count": 3,
- "function_declaration.multiline.min_length": 50,
- "function_declaration.group_to_block_spacing": "compact",
- "function_anonymous.empty_padding": false,
- "function_anonymous.group_to_block_spacing": "compact",
- "function_anonymous.multiline.element_count": 3,
- "function_anonymous.multiline.leading_comma": false,
- "function_anonymous.multiline.leading_comma.padding": true,
- "function_anonymous.multiline.min_length": 50,
- "function_anonymous.padding": true,
- "indent_size": 4,
- "keywords.block_to_keyword_spacing": "spaced",
- "keywords.group_to_block_spacing": "spaced",
- "keywords.padding_inside_group": true,
- "keywords.spacing_to_block": "spaced",
- "keywords.spacing_to_group": true,
- "keywords.empty_group_spacing": false,
- "max_columns": 120,
- "metadata.multiline.element_count": 3,
- "metadata.multiline.min_length": 50,
- "method_call.chain.multiline" : 3,
- "newline":"\n",
- "property.multiline.element_count": 3,
- "property.multiline.min_length": 30,
- "parentheses.padding": true,
- "strings.quote": "double",
- "strings.attributes.quote": "double",
- "struct.separator": " : ",
- "struct.padding": true,
- "struct.empty_padding": false,
- "struct.multiline.leading_comma": false,
- "struct.multiline.leading_comma.padding": true,
- "struct.multiline.element_count": 2,
- "struct.multiline.min_length": 60,
- "tab_indent": true
-}
diff --git a/.cflintrc b/.cflintrc
deleted file mode 100644
index 9a4e05e296..0000000000
--- a/.cflintrc
+++ /dev/null
@@ -1,149 +0,0 @@
-{
- "rule": [],
- "includes": [
- {
- "code": "AVOID_USING_CFINCLUDE_TAG"
- },
- {
- "code": "AVOID_USING_CFABORT_TAG"
- },
- {
- "code": "AVOID_USING_CFEXECUTE_TAG"
- },
- {
- "code": "AVOID_USING_DEBUG_ATTR"
- },
- {
- "code": "AVOID_USING_ABORT"
- },
- {
- "code": "AVOID_USING_ISDATE"
- },
- {
- "code": "AVOID_USING_ISDEBUGMODE"
- },
- {
- "code": "AVOID_USING_CFINSERT_TAG"
- },
- {
- "code": "AVOID_USING_CFUPDATE_TAG"
- },
- {
- "code": "ARG_VAR_CONFLICT"
- },
- {
- "code": "ARG_HINT_MISSING"
- },
- {
- "code": "ARG_HINT_MISSING_SCRIPT"
- },
- {
- "code": "ARGUMENT_INVALID_NAME"
- },
- {
- "code": "ARGUMENT_ALLCAPS_NAME"
- },
- {
- "code": "ARGUMENT_IS_TEMPORARY"
- },
- {
- "code": "CFQUERYPARAM_REQ"
- },
- {
- "code": "COMPARE_INSTEAD_OF_ASSIGN"
- },
- {
- "code": "COMPONENT_HINT_MISSING"
- },
- {
- "code": "COMPONENT_INVALID_NAME"
- },
- {
- "code": "COMPONENT_ALLCAPS_NAME"
- },
- {
- "code": "COMPONENT_TOO_SHORT"
- },
- {
- "code": "COMPONENT_TOO_LONG"
- },
- {
- "code": "COMPONENT_IS_TEMPORARY"
- },
- {
- "code": "COMPONENT_HAS_PREFIX_OR_POSTFIX"
- },
- {
- "code": "COMPLEX_BOOLEAN_CHECK"
- },
- {
- "code": "EXCESSIVE_FUNCTION_LENGTH"
- },
- {
- "code": "EXCESSIVE_ARGUMENTS"
- },
- {
- "code": "EXPLICIT_BOOLEAN_CHECK"
- },
- {
- "code": "FUNCTION_HINT_MISSING"
- },
- {
- "code": "FILE_SHOULD_START_WITH_LOWERCASE"
- },
- {
- "code": "LOCAL_LITERAL_VALUE_USED_TOO_OFTEN"
- },
- {
- "code": "GLOBAL_LITERAL_VALUE_USED_TOO_OFTEN"
- },
- {
- "code": "MISSING_VAR"
- },
- {
- "code": "METHOD_INVALID_NAME"
- },
- {
- "code": "METHOD_ALLCAPS_NAME"
- },
- {
- "code": "NESTED_CFOUTPUT"
- },
- {
- "code": "NEVER_USE_QUERY_IN_CFM"
- },
- {
- "code": "OUTPUT_ATTR"
- },
- {
- "code": "QUERYPARAM_REQ"
- },
- {
- "code": "UNUSED_LOCAL_VARIABLE"
- },
- {
- "code": "UNUSED_METHOD_ARGUMENT"
- },
- {
- "code": "SQL_SELECT_STAR"
- },
- {
- "code": "SCOPE_ALLCAPS_NAME"
- },
- {
- "code": "VAR_ALLCAPS_NAME"
- },
- {
- "code": "VAR_INVALID_NAME"
- }
- ],
- "inheritParent": false,
- "parameters": {
- "TooManyFunctionsChecker.maximum": 20
- },
- "excludes": [
- {
- "code": "ARG_VAR_MIXED"
- }
- ]
-}
\ No newline at end of file
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000000..089cc640d7
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,13 @@
+version: 2
+updates:
+ # GitHub Actions - updates uses: statements in workflows
+ - package-ecosystem: "github-actions"
+ directory: "/" # Where your .github/workflows/ folder is
+ schedule:
+ interval: "quarterly"
+
+ # NPM
+ - package-ecosystem: "npm"
+ directory: "/system/exceptions" # adjust if needed
+ schedule:
+ interval: "monthly"
diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml
new file mode 100644
index 0000000000..fcf8c73667
--- /dev/null
+++ b/.github/workflows/cron.yml
@@ -0,0 +1,10 @@
+name: Daily Tests
+
+on:
+ schedule:
+ - cron: '0 0 * * 0' # Runs at 00:00 UTC every Sunday
+
+jobs:
+ tests:
+ uses: ./.github/workflows/tests.yml
+ secrets: inherit
diff --git a/.github/workflows/lts.yml b/.github/workflows/lts.yml
index 76399b4136..1e8875ee09 100644
--- a/.github/workflows/lts.yml
+++ b/.github/workflows/lts.yml
@@ -16,19 +16,24 @@ jobs:
##########################################################################################
# Format Source Code
##########################################################################################
- format:
- name: Code Auto-Formatting
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
+ # format:
+ # name: Code Auto-Formatting
+ # runs-on: ubuntu-latest
+ # steps:
+ # - uses: actions/checkout@v6
- - name: Auto-format
- uses: Ortus-Solutions/commandbox-action@v1.0.3
- with:
- cmd: run-script format
+ # # We use snapshot here due to the fixes in BoxLang for the formatter
+ # # Once v1.14.0 releases, we can switch to that version
+ # - name: Setup BoxLang
+ # uses: ortus-boxlang/setup-boxlang@main
+ # with:
+ # version: snapshot
- - name: Commit Format Changes
- uses: stefanzweifel/git-auto-commit-action@v5
- with:
- commit_message: Apply cfformat changes
- push_options: --force
+ # - name: Run Formatter
+ # run: boxlang format --source config,handlers,modules/contentbox,tests/specs
+
+ # - name: Commit Format Changes
+ # uses: stefanzweifel/git-auto-commit-action@v7
+ # with:
+ # commit_message: Apply cfformat changes
+ # push_options: --force
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index d84eac3884..20c06406e2 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -17,18 +17,19 @@ jobs:
uses: ./.github/workflows/tests.yml
secrets: inherit
- format_check:
- name: Checks Source Code Formatting
- runs-on: ubuntu-latest
- steps:
- - name: Checkout Repository
- uses: actions/checkout@v4
+ # format_check:
+ # name: Checks Source Code Formatting
+ # runs-on: ubuntu-latest
+ # steps:
+ # - name: Checkout Repository
+ # uses: actions/checkout@v6
- - name: Setup CommandBox CLI
- uses: Ortus-Solutions/setup-commandbox@v2.0.1
- with:
- install: commandbox-cfformat
- warmup: true
+ # # We use snapshot here due to the fixes in BoxLang for the formatter
+ # # Once v1.14.0 releases, we can switch to that version
+ # - name: Setup BoxLang
+ # uses: ortus-boxlang/setup-boxlang@main
+ # with:
+ # version: snapshot
- - name: Run formatting rules
- run: box run-script format
+ # - name: Run Formatter
+ # run: boxlang format --check --source config,handlers,modules/contentbox,tests/specs
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e9e6b2174b..fddaed8b33 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -40,29 +40,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
- name: Setup Java
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "21"
- name: Setup CommandBox
- uses: Ortus-Solutions/setup-commandbox@v2.0.1
+ uses: ortus-boxlang/setup-boxlang@main
with:
+ with-commandbox: true
forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }}
- - name: Install CFML Dependencies
+ - name: Install Dependencies
run: |
box install --production
box install commandbox-docbox
cd modules/contentbox && box install --production
- - name: Install Node 18
- uses: actions/setup-node@v4
+ - name: Install Node 25
+ uses: actions/setup-node@v6
with:
- node-version: 18
+ node-version: 25
- name: Compile Release Assets
run: |
@@ -101,7 +102,7 @@ jobs:
printf "DB_CONNECTIONSTRING=jdbc:mysql://127.0.0.1:3306/contentbox?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useLegacyDatetimeCode=true\n" >> .env
- name: Download Test Artifacts
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@v8
if: env.SNAPSHOT == 'true'
with:
path: tests/results
@@ -109,21 +110,21 @@ jobs:
- name: Start Docs Server
if: env.SNAPSHOT == 'false'
run: |
- box server start serverConfigFile="server-lucee@5.json" openBrowser=false saveSettings=false
+ box server start serverConfigFile="server-boxlang-cfml@1.json" openBrowser=false saveSettings=false
- name: Build API Docs
run: |
# Normalize swagger doc results if they exist
- if test -f tests/results/contentbox-test-results-lucee@5-coldbox^7-experimental-false/contentbox-swagger.json; then
- cp -v tests/results/contentbox-test-results-lucee@5-coldbox^7-experimental-false/contentbox-swagger.json tests/results/
+ if test -f tests/results/contentbox-test-results-boxlang-cfml@1-coldbox^8-experimental-true/contentbox-swagger.json; then
+ cp -v tests/results/contentbox-test-results-boxlang-cfml@1-coldbox^8-experimental-true/contentbox-swagger.json tests/results/
else
- echo "File tests/results/contentbox-test-results-lucee@5-coldbox^7-experimental-false/contentbox-swagger.json does not exist"
+ echo "File tests/results/contentbox-test-results-boxlang-cfml@1-coldbox^8-experimental-true/contentbox-swagger.json does not exist"
fi
# Run Docs Build
- box run-script build:allDocs
+ box run-script build:apiDocs
- name: Update changelog [unreleased] with latest version
- uses: thomaseizinger/keep-a-changelog-new-release@1.3.0
+ uses: thomaseizinger/keep-a-changelog-new-release@3.1.0
if: env.SNAPSHOT == 'false'
with:
changelogPath: ./changelog.md
@@ -139,7 +140,7 @@ jobs:
working-directory: build/build-contentbox
- name: Commit Changelog [unreleased] with latest version
- uses: EndBug/add-and-commit@v9.1.4
+ uses: EndBug/add-and-commit@v10
if: env.SNAPSHOT == 'false'
with:
author_name: Github Actions
@@ -157,7 +158,7 @@ jobs:
- name: Upload Build Artifacts
if: success()
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v7
with:
name: contentbox-variants
path: |
@@ -195,7 +196,7 @@ jobs:
cd $ROOT_DIR/build/build-contentbox/installer-module && box forgebox publish
- name: Create Github Release
- uses: taiki-e/create-gh-release-action@v1.8.0
+ uses: taiki-e/create-gh-release-action@v1.9.3
continue-on-error: true
if: env.SNAPSHOT == 'false'
with:
@@ -226,13 +227,13 @@ jobs:
needs: [ build ]
steps:
- name: Checkout Development Repository
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
if: env.LTS == 'false'
with:
ref: development
- name: Checkout LTS Repository
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
if: env.LTS == 'true'
- name: Setup CommandBox
@@ -241,7 +242,7 @@ jobs:
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
- name: Download build artifacts
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@v8
with:
name: contentbox-variants
path: .tmp
@@ -261,7 +262,7 @@ jobs:
git pull
- name: Commit Version Bump
- uses: EndBug/add-and-commit@v9.1.4
+ uses: EndBug/add-and-commit@v10
with:
author_name: Github Actions
author_email: info@ortussolutions.com
diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index 1e8546b0b7..713a0aad5a 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -22,33 +22,35 @@ jobs:
##########################################################################################
# Format Source Code
##########################################################################################
- format:
- name: Code Auto-Formatting
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Setup CommandBox CLI
- uses: Ortus-Solutions/setup-commandbox@v2.0.1
- with:
- install: commandbox-cfformat
- warmup: true
-
- - name: Run formatting rules
- run: box run-script format
-
- - name: Commit Format Changes
- uses: stefanzweifel/git-auto-commit-action@v5
- with:
- commit_message: Apply cfformat changes
- push_options: --force
+ # Disabled until we resolve a few things
+ # format:
+ # name: Code Auto-Formatting
+ # runs-on: ubuntu-latest
+ # steps:
+ # - uses: actions/checkout@v6
+
+ # # We use snapshot here due to the fixes in BoxLang for the formatter
+ # # Once v1.14.0 releases, we can switch to that version
+ # - name: Setup BoxLang
+ # uses: ortus-boxlang/setup-boxlang@main
+ # with:
+ # version: snapshot
+
+ # - name: Run Formatter
+ # run: boxlang format --source config,handlers,modules/contentbox,tests/specs
+
+ # - name: Commit Format Changes
+ # uses: stefanzweifel/git-auto-commit-action@v7
+ # with:
+ # commit_message: Apply cfformat changes
+ # push_options: --force
#############################################
# Build Snapshot Release
#############################################
build:
uses: ./.github/workflows/release.yml
- needs: [ tests, format ]
+ needs: [ tests ]
secrets: inherit
with:
snapshot: true
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 3c2f8d1acb..d2ca2a523f 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -18,47 +18,34 @@ jobs:
strategy:
fail-fast: false
matrix:
- cfengine: [ "lucee@5", "adobe@2021", "adobe@2023" ]
- coldboxVersion: [ "^7" ]
+ cfengine: [ "adobe@2023", "adobe@2025" ]
+ coldboxVersion: [ "^8" ]
jdkVersion: [ "21" ]
experimental: [ false ]
include:
- # Lucee 6 has a regression
- - cfengine: "boxlang@1"
- coldboxVersion: "^7"
+ # BoxLang CFML
+ - cfengine: "boxlang-cfml@1"
+ coldboxVersion: "^8"
jdkVersion: "21"
experimental: true
- - cfengine: "boxlang@1"
- coldboxVersion: "be"
- jdkVersion: "21"
- experimental: true
- # Lucee 6 has a regression
- - cfengine: "lucee@6"
- coldboxVersion: "^7"
+ - cfengine: "boxlang-cfml@be"
+ coldboxVersion: "^8"
jdkVersion: "21"
experimental: true
- # - cfengine: "adobe@2025"
- # coldboxVersion: "^7"
- # jdkVersion: "21"
- # experimental: true
# ColdBox BE on all allowed distros
# This makes sure we don't have any issues with the BE of ColdBox
- - cfengine: "lucee@5"
+ - cfengine: "boxlang-cfml@1"
coldboxVersion: "be"
jdkVersion: "21"
experimental: true
- - cfengine: "lucee@6"
- coldboxVersion: "be"
- jdkVersion: "21"
- experimental: true
- - cfengine: "adobe@2023"
+ - cfengine: "adobe@2025"
coldboxVersion: "be"
jdkVersion: "21"
experimental: true
steps:
- name: Checkout Repository
- uses: actions/checkout@v4
+ uses: actions/checkout@v6
- name: Setup Database and Fixtures
run: |
@@ -67,7 +54,7 @@ jobs:
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < tests/resources/sql/mysql/contentbox.sql
- name: Setup Java
- uses: actions/setup-java@v4
+ uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: ${{ matrix.jdkVersion }}
@@ -93,10 +80,8 @@ jobs:
if: contains( matrix.cfengine, 'adobe' )
run: |
# Log4j Hibernate Debug
- mkdir -p .engines/acf2021/WEB-INF/cfusion/lib/
mkdir -p .engines/acf2023/WEB-INF/cfusion/lib/
mkdir -p .engines/acf2025/WEB-INF/cfusion/lib/
- cp build/resources/log4j.properties .engines/acf2021/WEB-INF/cfusion/lib/
cp build/resources/log4j.properties .engines/acf2023/WEB-INF/cfusion/lib/
cp build/resources/log4j.properties .engines/acf2025/WEB-INF/cfusion/lib/
@@ -130,7 +115,7 @@ jobs:
- name: Upload Test Results Artifacts
if: always()
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v7
with:
name: contentbox-test-results-${{ matrix.cfengine }}-coldbox${{ matrix.coldboxVersion }}-experimental-${{ matrix.experimental }}
path: |
@@ -151,9 +136,6 @@ jobs:
- name: Failure Debugging Info
if: ${{ failure() }}
run: |
- if [[ "{{ matrix.cfengine }}" == "adobe@2021" ]] ; then
- cat .engines/acf2021/WEB-INF/cfusion/logs/hibernatesql.log
- fi
if [[ "{{ matrix.cfengine }}" == "adobe@2023" ]] ; then
cat .engines/acf2023/WEB-INF/cfusion/logs/hibernatesql.log
fi
@@ -165,7 +147,7 @@ jobs:
- name: Upload Debugging Info To Artifacts
if: ${{ failure() && !startsWith( 'pull_request', github.event_name ) }}
- uses: actions/upload-artifact@v4
+ uses: actions/upload-artifact@v7
with:
name: Failure Debugging Info - ${{ matrix.cfengine }} jdk:${{ matrix.jdkVersion }} coldbox:${{ matrix.coldboxVersion }}
path: |
@@ -183,7 +165,7 @@ jobs:
steps:
# Download the test results
- name: Download Artifacts
- uses: actions/download-artifact@v4
+ uses: actions/download-artifact@v8
with:
path: artifacts
@@ -191,3 +173,4 @@ jobs:
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: artifacts/**/*.xml
+ compare_to_earlier_commit: false
diff --git a/.gitignore b/.gitignore
index 0f67f25738..98f687a229 100755
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@ WEB-INF/**
/*.log
# Build Dependencies
-coldbox/*
+lib/**
artifacts/**
build/build.number
build/apidocs/docbox
@@ -24,6 +24,7 @@ config/logs/**
# Engines + Docker Libraries
.engines/**
+.boxlang/**
bin/.db/**
tests/resources/dbs/.db/**
@@ -52,8 +53,6 @@ modules/contentbox/themes/default/includes/js
modules/contentbox/themes/default/includes/bootswatch
modules/contentbox/themes/default/includes/rev-manifest.json
modules/contentbox/themes/default/node_modules
-modules/route-visualizer/**
-modules/cbdebugger
# ContentBox Dependency Modules
modules/contentbox/modules/contentbox-deps/modules/*
@@ -70,3 +69,7 @@ testbox/*
/tests/**/logs/**
/tests/test-results/*
tests/resources/patches/tmp/
+
+# AI Skills
+.agents/skills/**
+.agents/guidelines/**
\ No newline at end of file
diff --git a/.mcp.json b/.mcp.json
new file mode 100644
index 0000000000..152917997c
--- /dev/null
+++ b/.mcp.json
@@ -0,0 +1,40 @@
+{
+ "mcpServers":{
+ "boxlang":{
+ "type":"http",
+ "url":"https://ai.ortusbooks.com/~gitbook/mcp"
+ },
+ "cachebox":{
+ "type":"http",
+ "url":"https://cachebox.ortusbooks.com/~gitbook/mcp"
+ },
+ "cbdebugger":{
+ "type":"http",
+ "url":"https://cbdebugger.ortusbooks.com/~gitbook/mcp"
+ },
+ "cfmigrations":{
+ "type":"http",
+ "url":"https://cfmigrations.ortusbooks.com/~gitbook/mcp"
+ },
+ "coldbox":{
+ "type":"http",
+ "url":"https://coldbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "commandbox":{
+ "type":"http",
+ "url":"https://commandbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "logbox":{
+ "type":"http",
+ "url":"https://logbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "testbox":{
+ "type":"http",
+ "url":"https://testbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "wirebox":{
+ "type":"http",
+ "url":"https://wirebox.ortusbooks.com/~gitbook/mcp"
+ }
+ }
+}
diff --git a/.vscode/mcp.json b/.vscode/mcp.json
new file mode 100644
index 0000000000..db5a1138e7
--- /dev/null
+++ b/.vscode/mcp.json
@@ -0,0 +1,41 @@
+{
+ "inputs":[],
+ "servers":{
+ "boxlang":{
+ "type":"http",
+ "url":"https://ai.ortusbooks.com/~gitbook/mcp"
+ },
+ "cachebox":{
+ "type":"http",
+ "url":"https://cachebox.ortusbooks.com/~gitbook/mcp"
+ },
+ "cbdebugger":{
+ "type":"http",
+ "url":"https://cbdebugger.ortusbooks.com/~gitbook/mcp"
+ },
+ "cfmigrations":{
+ "type":"http",
+ "url":"https://cfmigrations.ortusbooks.com/~gitbook/mcp"
+ },
+ "coldbox":{
+ "type":"http",
+ "url":"https://coldbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "commandbox":{
+ "type":"http",
+ "url":"https://commandbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "logbox":{
+ "type":"http",
+ "url":"https://logbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "testbox":{
+ "type":"http",
+ "url":"https://testbox.ortusbooks.com/~gitbook/mcp"
+ },
+ "wirebox":{
+ "type":"http",
+ "url":"https://wirebox.ortusbooks.com/~gitbook/mcp"
+ }
+ }
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index bf804b924f..c51eb04650 100755
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,24 +1,8 @@
{
- "cfml.mappings": [
- {
- "logicalPath": "/contentbox",
- "directoryPath": "./modules/contentbox",
- "isPhysicalDirectoryPath" :false
- },
- {
- "logicalPath": "/coldbox",
- "directoryPath": "./coldbox",
- "isPhysicalDirectoryPath" :false
- },
- {
- "logicalPath": "/cborm",
- "directoryPath": "./modules/cborm",
- "isPhysicalDirectoryPath" :false
- },
- {
- "logicalPath": "/testbox",
- "directoryPath": "./testbox",
- "isPhysicalDirectoryPath" :false
- }
- ]
+ "boxlang.mappings": {
+ "/coldbox" : "./lib/coldbox",
+ "/testbox" : "./lib/testbox",
+ "/cborm" : "./modules/contentbox/modules/contentbox-deps/modules/cborm",
+ "/contentbox" : "./modules/contentbox"
+ }
}
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000000..06834c8f20
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,384 @@
+
+
+
+
+# ContentBox Tester Site - AI Agent Instructions
+
+This is a ColdBox HMVC application using the **flat template structure** where all application code lives in the webroot. Compatible with Adobe ColdFusion 2018+, Lucee 5.x+, and BoxLang 1.0+.
+
+## Project Overview
+
+**Language Mode:** BoxLang
+**ColdBox Version:** ^8
+**Template Type:** Flat (traditional webroot structure)
+
+## Application Structure
+
+```
+/ - Application root (webroot)
+├── Application.cfc - Bootstrap that directly loads ColdBox
+├── index.cfm - Front controller
+├── config/ - Framework and app configuration
+├── handlers/ - Event handlers (controllers)
+├── models/ - Service objects, business logic
+├── views/ - HTML templates
+├── layouts/ - Page layouts wrapping views
+├── includes/ - Public assets (CSS, JS, images)
+├── modules_app/ - Application modules (HMVC)
+├── tests/ - Test suites
+└── lib/ - Framework dependencies
+```
+
+**Key Characteristics:**
+- Everything in webroot (simpler for traditional hosting)
+- No `/app` vs `/public` separation
+- All code is web-accessible by default
+- `COLDBOX_APP_MAPPING = ""` (empty, app at root)
+
+## Framework Knowledge
+
+Core ColdBox and language guidelines are installed in `.ai/guidelines/core/`. Supported tools
+(e.g., VS Code Copilot) load them automatically via file attachments. For other agents, load them
+explicitly when you need framework fundamentals:
+
+- `read_file` on `.ai/guidelines/core/coldbox.md` — ColdBox conventions, handlers, routing, DI reference
+- `read_file` on `.ai/guidelines/core/boxlang.md` — BoxLang syntax and patterns
+
+## Installed Modules
+
+The following ColdBox modules are installed in this project. Use these when generating code, checking available services, and suggesting relevant skills or guidelines:
+
+No additional modules installed yet.
+
+## Handlers Snapshot
+
+Current event handlers and their public actions (auto-updated on `coldbox ai refresh`):
+
+- **Main**: index, onAppInit, onException, onMissingTemplate
+
+## Interceptors Snapshot
+
+Registered interceptors and their interception points (auto-updated on `coldbox ai refresh`):
+
+No interceptors found.
+
+## Layouts
+
+Available layouts (auto-updated on `coldbox ai refresh`):
+
+- **Main.cfm**
+
+## Custom Modules
+
+Application-level modules located in `/modules_app` (auto-updated on `coldbox ai refresh`):
+
+- **contentbox-custom** (`modules_app`)
+
+## AI Integration & Resources
+
+This project includes AI-powered development assistance with on-demand guidelines, skills, and MCP documentation servers.
+
+## Project-Specific Conventions
+
+### Code Style
+
+- **Semicolons:** Optional in CFML/BoxLang. Only use when demarcating properties or in inline component syntax
+- **Handler naming:** Plural nouns (Users.cfc, Orders.cfc)
+- **Service naming:** Descriptive with "Service" suffix (UserService.cfc)
+- **Dependency injection:** Use `property name="service" inject` over manual getInstance()
+
+### Testing
+
+- Tests located in `/tests/specs/`
+- Integration tests extend `BaseTestCase` with `appMapping="/app"`
+- **Critical:** Always call `setup()` in `beforeEach()` for test isolation
+- Run tests: `box testbox run`
+
+### Configuration
+
+- Environment variables defined in `.env` (copy from `.env.example`)
+- Access via `getSystemSetting("VAR_NAME", "default")`
+- Framework config in `config/ColdBox.cfc`
+- Routes in `config/Router.cfc`
+
+### Application Helpers
+
+- `includes/helpers/ApplicationHelper.cfm` - Available in all handlers/views
+- Add common utility functions here
+
+### Development Workflow
+
+```bash
+# Install dependencies
+box install
+
+# Start server
+box server start
+
+# Format code
+box run-script format
+
+# Run tests
+box testbox run
+
+# Reinit framework (dev)
+/?fwreinit=true
+```
+
+## AI Integration
+
+This project includes AI-powered development assistance with guidelines, skills, and MCP documentation servers.
+
+### Directory Structure
+
+```
+/.agents/
+ /manifest.json - AI configuration (language, agents, guidelines, skills, MCP servers)
+ /guidelines/ - Framework documentation and best practices
+ /core/ - Core ColdBox/BoxLang guidelines
+ /modules/ - Module-specific guidelines
+ /custom/ - Your custom guidelines
+ /overrides/ - Override core guidelines
+ /skills/ - Framework/core implementation cookbooks (auto-managed, can be .gitignored)
+ /{name}/ - One folder per skill (flat, no subdirectories)
+ SKILL.md - Skill content (fetched from registry)
+ /skills-custom/ - Project-specific skills (commit these to source control)
+ /{name}/ - One folder per custom skill
+ SKILL.md - Custom skill content (project-authored or overrides)
+ /mcp-servers/ - MCP server configurations
+```
+
+### Manifest
+
+The `.agents/manifest.json` file contains the complete AI integration configuration:
+
+- **language**: Project language mode (boxlang, cfml, hybrid)
+- **templateType**: Application template (modern, flat)
+- **guidelines**: Array of installed guideline names
+- **skills**: Array of core/framework skill names (auto-managed)
+- **customSkills**: Array of project-specific skill names (in `skills-custom/`)
+- **agents**: Array of configured AI agents
+- **mcpServers**: Configured MCP documentation servers (core, module, custom)
+- **activeAgent**: Currently active AI agent (if set)
+- **lastSync**: Last synchronization timestamp
+
+**Reading the manifest** helps you understand available resources and project configuration.
+
+### Using Guidelines & Skills
+
+Guidelines and skills are stored locally in `.agents/` and loaded via `read_file` when needed:
+
+**Core Guidelines** (`.agents/guidelines/core/`) — framework fundamentals:
+- `read_file` on `.agents/guidelines/core/coldbox.md` — ColdBox conventions, handler/routing/DI reference
+- `read_file` on `.agents/guidelines/core/boxlang.md` — BoxLang syntax, classes, lambdas (or `cfml.md` for CFML)
+
+**Module/Custom Guidelines** — load by name on request from `.agents/guidelines/modules/` or `.agents/guidelines/custom/`.
+
+**Skills** (`.agents/skills/{name}/SKILL.md`) — step-by-step implementation patterns. Examples:
+- Implement a CRUD handler: `read_file` on `.agents/skills/coldbox-handler-development/SKILL.md`
+- Build a REST API: `read_file` on `.agents/skills/coldbox-rest-api-development/SKILL.md`
+- Write tests: `read_file` on `.agents/skills/coldbox-testing-handler/SKILL.md`
+
+**Custom Skills** (`.agents/skills-custom/{name}/SKILL.md`) — project-specific patterns. Load by name from `.agents/skills-custom/`.
+
+**To load any skill or guideline:** use `read_file` on the path shown above or in the inventories below.
+
+### Available Guidelines
+
+The following additional guidelines are available for this project. Request them by name when needed:
+
+No additional module guidelines installed.
+
+**To load a guideline:** Request it by name when you need detailed framework or module documentation.
+
+### Available Skills
+
+The following skills provide step-by-step implementation patterns. Request specific skills when you need detailed how-to instructions:
+
+**Module Skills:**
+
+_BoxLang (43):_
+- **boxlang-application-descriptor** - Use this skill when designing or debugging Application.bx behavior: app discover...
+- **boxlang-async-programming** - Use this skill when writing BoxLang asynchronous code: BoxFuture, futureNew, asy...
+- **boxlang-best-practices** - Use this skill when writing, reviewing, or improving BoxLang code to ensure it f...
+- **boxlang-caching** - Use this skill when implementing caching in BoxLang applications: cache provider...
+- **boxlang-cfml-migration** - Use this skill when helping developers migrate from CFML (Adobe ColdFusion or Lu...
+- **boxlang-classes-and-oop** - Use this skill when writing BoxLang classes, components, interfaces, inheritance...
+- **boxlang-code-documenter** - Use this skill when adding documentation comments to BoxLang code: writing funct...
+- **boxlang-code-reviewer** - Use this skill when reviewing BoxLang code for quality, correctness, security vu...
+- **boxlang-configuration** - Use this skill when configuring BoxLang runtime settings via boxlang.json, setti...
+- **boxlang-database-access** - Use this skill when writing BoxLang database code: queryExecute, bx:query, datas...
+- **boxlang-deployment** - Use this skill when deploying BoxLang applications: CommandBox server setup, Doc...
+- **boxlang-docbox** - Use this skill when generating API documentation for BoxLang or CFML projects wi...
+- **boxlang-file-handling** - Use this skill when reading, writing, copying, moving, or deleting files and dir...
+- **boxlang-file-watchers** - Use this skill when implementing BoxLang filesystem watchers: watcherNew/watcher...
+- **boxlang-functional-programming** - Use this skill when working with BoxLang lambdas, closures, arrow functions, hig...
+- **boxlang-interceptors** - Use this skill when working with BoxLang's interceptor/event system: creating in...
+- **boxlang-java-integration** - Use this skill when integrating BoxLang with Java: createObject, static method c...
+- **boxlang-language-fundamentals** - Use this skill when writing or reviewing BoxLang code covering syntax, file type...
+- **boxlang-modules-and-packages** - Use this skill when installing, configuring, or using BoxLang modules: box insta...
+- **boxlang-runtime-aws-lambda** - Use this skill when building, deploying, or debugging BoxLang applications on AW...
+- **boxlang-runtime-chromebook** - Use this skill when setting up or developing BoxLang on a Chromebook, including ...
+- **boxlang-runtime-cli-scripting** - Use this skill when writing BoxLang CLI scripts and classes, handling command-li...
+- **boxlang-runtime-commandbox** - Use this skill when deploying BoxLang as an enterprise Java servlet application ...
+- **boxlang-runtime-compiled-native-binaries** - Use this skill when compiling BoxLang scripts to standalone native executables u...
+- **boxlang-runtime-desktop** - Use this skill when building BoxLang desktop applications with Electron and the ...
+- **boxlang-runtime-desktop-electron** - Use this skill when building BoxLang desktop applications with Electron and the ...
+- **boxlang-runtime-digitalocean-app** - Use this skill when deploying BoxLang applications to DigitalOcean App Platform ...
+- **boxlang-runtime-docker** - Use this skill when containerizing BoxLang applications with Docker, including c...
+- **boxlang-runtime-esp32** - Use this skill when deploying BoxLang to ESP32 microcontrollers using MatchBox's...
+- **boxlang-runtime-github-actions** - Use this skill when setting up GitHub Actions CI/CD pipelines for BoxLang projec...
+- **boxlang-runtime-google-cloud-functions** - Use this skill when building, testing, or deploying BoxLang applications on Goog...
+- **boxlang-runtime-jsr-223** - Use this skill when embedding BoxLang into Java applications via the JSR-223 scr...
+- **boxlang-runtime-matchbox** - Use this skill when using MatchBox, the Rust-based native implementation of BoxL...
+- **boxlang-runtime-miniserver** - Use this skill when running BoxLang as a lightweight web server using the BoxLan...
+- **boxlang-runtime-spring-boot** - Use this skill when integrating BoxLang with Spring Boot applications, including...
+- **boxlang-runtime-wasm-container** - Use this skill when compiling BoxLang applications to server-side WebAssembly (W...
+- **boxlang-runtime-wasm-in-the-browser** - Use this skill when compiling BoxLang to WebAssembly or JavaScript ES modules fo...
+- **boxlang-scheduled-tasks** - Use this skill when creating or managing BoxLang scheduled workloads: Scheduler ...
+- **boxlang-security** - Use this skill when reviewing BoxLang code or applications for security vulnerab...
+- **boxlang-templating** - Use this skill when writing BoxLang markup templates (.bxm files), mixing HTML w...
+- **boxlang-testing** - Use this skill when writing, running, or debugging tests for BoxLang application...
+- **boxlang-web-development** - Use this skill when building BoxLang web applications: Application.bx lifecycle,...
+- **boxlang-zip** - Use this skill when creating, extracting, listing, or modifying ZIP archives in ...
+
+_CacheBox (1):_
+- **cachebox-standalone** - Use this skill when working with CacheBox as a standalone caching framework (out...
+
+_ColdBox (29):_
+- **coldbox-ai-integration** - Use this skill when integrating AI capabilities into a ColdBox application using...
+- **coldbox-app-layouts** - Use this skill when choosing a ColdBox application layout (flat, boxlang, or mod...
+- **coldbox-async-programming** - Use this skill when building async pipelines, working with ColdBox Futures, runn...
+- **coldbox-cache-integration** - Use this skill when implementing caching inside a ColdBox application -- configu...
+- **coldbox-cli** - Use this skill when using the ColdBox CLI (CommandBox module) to scaffold applic...
+- **coldbox-configuration** - Use this skill when configuring a ColdBox application in ColdBox.cfc, setting up...
+- **coldbox-decorators** - Use this skill when extending or overriding ColdBox framework internals via the ...
+- **coldbox-di** - Use this skill when working with dependency injection inside a ColdBox applicati...
+- **coldbox-documenter** - Use this skill when writing or improving documentation comments for ColdBox appl...
+- **coldbox-event-model** - Use this skill when working with the ColdBox event object (prc/rc), managing req...
+- **coldbox-flash-messaging** - Use this skill when implementing flash RAM messaging in ColdBox, using cbMessage...
+- **coldbox-handler-development** - Use this skill when creating ColdBox handlers (controllers), implementing CRUD a...
+- **coldbox-interceptor-development** - Use this skill when creating ColdBox interceptors for cross-cutting concerns, li...
+- **coldbox-layout-development** - Use this skill when creating ColdBox layouts (master page templates), building a...
+- **coldbox-logging** - Use this skill for all ColdBox-specific logging concerns: configuring LogBox ins...
+- **coldbox-module-development** - Use this skill when creating reusable ColdBox modules, writing ModuleConfig.cfc,...
+- **coldbox-proxy** - Use this skill when building ColdBox Proxy objects to expose ColdBox event handl...
+- **coldbox-request-context** - Use this skill when working with the ColdBox RequestContext object (event), mana...
+- **coldbox-rest-api-development** - Use this skill when building RESTful APIs in ColdBox using RestHandler, creating...
+- **coldbox-reviewer** - Use this skill when reviewing ColdBox application code for correctness, security...
+- **coldbox-routing-development** - Use this skill when configuring ColdBox routes, setting up RESTful resource rout...
+- **coldbox-scheduled-tasks** - Use this skill when creating ColdBox scheduled tasks, building Scheduler.cfc fil...
+- **coldbox-testing-base-classes** - Use this skill to understand which ColdBox testing base class to extend for a gi...
+- **coldbox-testing-handler** - Use this skill when testing ColdBox event handlers with execute(), asserting rc/...
+- **coldbox-testing-http-methods** - Use this skill when simulating HTTP requests in ColdBox tests using the get(), p...
+- **coldbox-testing-integration** - Use this skill when writing integration tests for ColdBox that use real dependen...
+- **coldbox-testing-interceptor** - Use this skill when unit testing ColdBox interceptors in isolation using BaseInt...
+- **coldbox-testing-model** - Use this skill when unit testing ColdBox model objects (services, repositories, ...
+- **coldbox-view-rendering** - Use this skill when rendering views and partials in ColdBox, creating reusable v...
+
+_CommandBox (11):_
+- **commandbox-config-settings** - Use this skill for CommandBox global configuration: config set/show/clear comman...
+- **commandbox-deploying** - Use this skill for deploying CommandBox applications to production: Docker with ...
+- **commandbox-developing** - Use this skill for developing CommandBox extensions: creating custom commands (C...
+- **commandbox-embedded-server** - Use this skill for the CommandBox embedded server: starting and stopping servers...
+- **commandbox-package-management** - Use this skill for CommandBox package management: box.json configuration, instal...
+- **commandbox-setup** - Use this skill for installing, configuring, and upgrading CommandBox CLI: Homebr...
+- **commandbox-task-runners** - Use this skill for CommandBox task runners: creating task CFCs, targets, passing...
+- **commandbox-testing** - Use this skill for CommandBox TestBox integration: testbox run command, running ...
+- **commandbox-usage** - Use this skill for CommandBox CLI usage: running commands, namespaces, tab compl...
+- **commandbox-boxlang** - Use this skill when configuring CommandBox to run BoxLang server instances, usin...
+- **commandbox-migrations** - Use this skill when running database migrations from the CommandBox CLI using co...
+
+_LogBox (1):_
+- **logbox** - Use this skill whenever working with LogBox -- standalone or inside a ColdBox ap...
+
+_Other (6):_
+- **ortus-coding-standards** - Use this skill when writing, reviewing, or formatting any Ortus Solutions code (...
+- **database-migrations** - Use this skill when managing database schema changes in ColdBox/BoxLang using cf...
+- **testing-coverage** - Use this skill when setting up code coverage analysis for ColdBox/ColdFusion/Box...
+- **testing-fixtures** - Use this skill when creating test fixtures, factory patterns, or test data build...
+- **cbdebugger** - Use this skill when installing, configuring, or using the CBDebugger visual debu...
+- **route-visualizer** - Use this skill when inspecting all registered ColdBox routes using the route-vis...
+
+_TestBox (9):_
+- **testbox-assertions** - Use this skill when using the TestBox $assert object for xUnit-style assertions:...
+- **testbox-bdd** - Use this skill when writing BDD-style tests with TestBox using describe/it block...
+- **testbox-cbmockdata** - Use this skill when generating realistic fake/mock data in tests using cbMockDat...
+- **testbox-expectations** - Use this skill when writing fluent expectations in TestBox using expect(), expec...
+- **testbox-listeners** - Use this skill when implementing TestBox run listeners (callbacks): onBundleStar...
+- **testbox-mockbox** - Use this skill when creating mocks, stubs, and spies in TestBox using MockBox: c...
+- **testbox-reporters** - Use this skill when selecting or configuring TestBox reporters: ANTJunit, Consol...
+- **testbox-runners** - Use this skill when running TestBox tests: CommandBox CLI (testbox run), BoxLang...
+- **testbox-unit-xunit** - Use this skill when writing xUnit-style tests in TestBox using test functions (t...
+
+_WireBox (2):_
+- **wirebox-di** - Use this skill when working with WireBox dependency injection -- bootstrapping t...
+- **wirebox-aop** - Use this skill when working with WireBox Aspect-Oriented Programming (AOP) -- ac...
+
+**To load a skill:** Use `read_file` on `.agents/skills/{skill-name}/SKILL.md` (e.g., `.agents/skills/coldbox-handler-development/SKILL.md`) for core skills, or `.agents/skills-custom/{skill-name}/SKILL.md` for custom project skills.
+
+## Important Notes
+
+- Framework reinit: Use `?fwreinit=true` or configure `reinitPassword` for production
+- Module routes process before app routes - be aware of conflicts
+- Use PRC for internal data, RC only for user input
+- Always validate user input from RC
+
+## MCP Documentation Servers
+
+This project has access to the following Model Context Protocol (MCP) documentation servers for live, up-to-date information:
+
+**Core Documentation Servers:**
+
+- **boxlang**: BoxLang Language Documentation - https://ai.ortusbooks.com/~gitbook/mcp
+- **coldbox**: ColdBox Framework Documentation - https://coldbox.ortusbooks.com/~gitbook/mcp
+- **commandbox**: CommandBox CLI Documentation - https://commandbox.ortusbooks.com/~gitbook/mcp
+- **testbox**: TestBox Testing Framework - https://testbox.ortusbooks.com/~gitbook/mcp
+- **wirebox**: WireBox Dependency Injection - https://wirebox.ortusbooks.com/~gitbook/mcp
+- **cachebox**: CacheBox Caching Framework - https://cachebox.ortusbooks.com/~gitbook/mcp
+- **logbox**: LogBox Logging Framework - https://logbox.ortusbooks.com/~gitbook/mcp
+
+**Module Documentation Servers:**
+
+- **cfmigrations**: Database Migrations - https://cfmigrations.ortusbooks.com/~gitbook/mcp
+- **cbdebugger**: CBDebugger Debugging Tools - https://cbdebugger.ortusbooks.com/~gitbook/mcp
+
+**Using MCP Servers:** Query these servers when you need current documentation, API references, or code examples. They provide live, up-to-date information directly from official documentation sources.
+
+
+
+
+
+## About This Application
+
+> ⚠️ Fill in this section to give your AI assistant context about your specific application.
+
+### Business Domain
+
+
+
+### Key Services & Models
+
+
+
+### Authentication & Security
+
+
+
+### API Endpoints
+
+
+
+### Database
+
+
+
+### Deployment
+
+
\ No newline at end of file
diff --git a/Application.cfc b/Application.cfc
index 7dbf3c4734..bf8dcdae6a 100644
--- a/Application.cfc
+++ b/Application.cfc
@@ -17,10 +17,10 @@ component {
* MAKE SURE THIS FILE IS NOT WEB ACCESSIBLE!
* Without this, your NON CommandBox ContentBox install will fail.
*/
- this.cbLoadDynamicEnvironment = false;
- this.cbEnvFile = expandPath( "/.env" );
+ this.cbLoadDynamicEnvironment = false
+ this.cbEnvFile = expandPath( "/.env" )
if ( this.cbLoadDynamicEnvironment ) {
- loadEnv();
+ loadEnv()
}
/**
@@ -28,29 +28,20 @@ component {
* Application Properties: Modify as you see fit!
* --------------------------------------------------------------------------
*/
- this.name = "ContentBox CMS";
- this.sessionManagement = true;
- this.sessionTimeout = createTimespan( 0, 1, 0, 0 );
- this.setClientCookies = true;
- this.setDomainCookies = true;
- this.scriptProtect = false;
- this.secureJSON = false;
- this.timezone = "UTC";
-
- /**
- * --------------------------------------------------------------------------
- * Lucee Specific Settings
- * --------------------------------------------------------------------------
- */
-
+ this.name = "ContentBox CMS"
+ this.sessionManagement = true
+ this.sessionTimeout = createTimespan( 0, 1, 0, 0 )
+ this.setClientCookies = true
+ this.setDomainCookies = true
+ this.scriptProtect = false
+ this.secureJSON = false
+ this.timezone = "UTC"
// buffer the output of a tag/function body to output in case of a exception
- this.bufferOutput = true;
- // Activate Gzip Compression
- this.compression = false;
+ this.bufferOutput = true
// Turn on/off white space management
- this.whiteSpaceManagement = "smart";
+ this.whiteSpaceManagement = "smart"
// Turn on/off remote cfc content whitespace
- this.suppressRemoteComponentContent = false;
+ this.suppressRemoteComponentContent = false
/**
* --------------------------------------------------------------------------
@@ -58,12 +49,12 @@ component {
* --------------------------------------------------------------------------
* Modify only if you need to, else default them.
*/
- COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() );
- COLDBOX_APP_MAPPING = "";
- COLDBOX_WEB_MAPPING = "";
- COLDBOX_CONFIG_FILE = "";
- COLDBOX_APP_KEY = "";
- COLDBOX_FAIL_FAST = true;
+ COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() )
+ COLDBOX_APP_MAPPING = ""
+ COLDBOX_WEB_MAPPING = ""
+ COLDBOX_CONFIG_FILE = ""
+ COLDBOX_APP_KEY = ""
+ COLDBOX_FAIL_FAST = true
/**
* --------------------------------------------------------------------------
@@ -74,10 +65,10 @@ component {
* - contentbox : Where the ContentBox module root is installed
* - cborm : Where the cborm library is installed: Needed for ORM Event Handling.
*/
- this.mappings[ "/cbapp" ] = COLDBOX_APP_ROOT_PATH;
- this.mappings[ "/coldbox" ] = COLDBOX_APP_ROOT_PATH & "coldbox";
- this.mappings[ "/contentbox" ] = COLDBOX_APP_ROOT_PATH & "modules/contentbox";
- this.mappings[ "/cborm" ] = this.mappings[ "/contentbox" ] & "/modules/contentbox-deps/modules/cborm";
+ this.mappings[ "/cbapp" ] = COLDBOX_APP_ROOT_PATH
+ this.mappings[ "/coldbox" ] = COLDBOX_APP_ROOT_PATH & "lib/coldbox"
+ this.mappings[ "/contentbox" ] = COLDBOX_APP_ROOT_PATH & "modules/contentbox"
+ this.mappings[ "/cborm" ] = this.mappings[ "/contentbox" ] & "/modules/contentbox-deps/modules/cborm"
/**
* --------------------------------------------------------------------------
@@ -87,11 +78,11 @@ component {
* - Dialect is incredibly important! Do not let Hibernate auto configur it, you can get nasty errors.
* So Make sure you select one.
*/
- request.cbSystemHelper = new coldbox.system.core.delegates.Env();
+
// THE CONTENTBOX DATASOURCE NAME
- this.datasource = "contentbox";
+ this.datasource = "contentbox"
// ORM SETTINGS
- this.ormEnabled = true;
+ this.ormEnabled = true
// cfformat-ignore-start
this.ormSettings = {
// ENTITY LOCATIONS, ADD MORE LOCATIONS AS YOU SEE FIT
@@ -106,12 +97,12 @@ component {
"modules/contentbox/modules_user"
],
// THE DIALECT OF YOUR DATABASE OR LET HIBERNATE FIGURE IT OUT, UP TO YOU TO CONFIGURE.
- dialect : request.cbSystemHelper.getSystemSetting( "ORM_DIALECT", "" ),
+ dialect : _getSystemSetting( "ORM_DIALECT", "" ),
dbcreate : "none",
- secondarycacheenabled: request.cbSystemHelper.getSystemSetting( "ORM_SECONDARY_CACHE", false ),
- cacheprovider : request.cbSystemHelper.getSystemSetting( "ORM_SECONDARY_CACHE", "ehCache" ),
- logSQL : request.cbSystemHelper.getSystemSetting( "ORM_LOGSQL", false ),
- sqlScript : request.cbSystemHelper.getSystemSetting( "ORM_SQL_SCRIPT", "" ),
+ secondarycacheenabled: _getSystemSetting( "ORM_SECONDARY_CACHE", false ),
+ cacheprovider : _getSystemSetting( "ORM_SECONDARY_CACHE", "ehCache" ),
+ logSQL : _getSystemSetting( "ORM_LOGSQL", false ),
+ sqlScript : _getSystemSetting( "ORM_SQL_SCRIPT", "" ),
// ORM SESSION MANAGEMENT SETTINGS, DO NOT CHANGE
flushAtRequestEnd : false,
autoManageSession : false,
@@ -122,10 +113,10 @@ component {
skipCFCWithError : true,
// TURN ON FOR Debugging if ORM mappings are not working.
savemapping : false
- };
+ }
// cfformat-ignore-end
- // applicationStop();abort;
+ // applicationStop()abort
/*****************************************************************************************************/
/************************************** CF APP LISTENERS *********************************************/
@@ -140,9 +131,9 @@ component {
COLDBOX_APP_MAPPING,
COLDBOX_FAIL_FAST,
COLDBOX_WEB_MAPPING
- );
- application.cbBootstrap.loadColdbox();
- return true;
+ )
+ application.cbBootstrap.loadColdbox()
+ return true
}
boolean function onRequestStart( string targetPage ){
@@ -153,9 +144,9 @@ component {
isNull( application.cbController )
) {
if ( this.cbLoadDynamicEnvironment ) {
- loadEnv( force: true );
+ loadEnv( force: true )
}
- reinitApplication();
+ reinitApplication()
}
// Development Reinit + ORM Reloads
@@ -167,36 +158,36 @@ component {
application.cbBootstrap.isFWReinit()
) {
if ( this.cbLoadDynamicEnvironment ) {
- loadEnv( force: true );
+ loadEnv( force: true )
}
- if ( structKeyExists( server, "lucee" ) ) {
- pagePoolClear();
+ if ( getFunctionList().keyExists( "pagePoolClear" ) ) {
+ pagePoolClear()
}
- ormReload();
+ ormReload()
}
// Process ColdBox Request
- application.cbBootstrap.onRequestStart( arguments.targetPage );
+ application.cbBootstrap.onRequestStart( arguments.targetPage )
- return true;
+ return true
}
function onSessionStart(){
if ( !isNull( application.cbBootstrap ) ) {
- application.cbBootStrap.onSessionStart();
+ application.cbBootStrap.onSessionStart()
}
}
function onSessionEnd( struct sessionScope, struct appScope ){
- arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection = arguments );
+ arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection = arguments )
}
boolean function onMissingTemplate( template ){
- return application.cbBootstrap.onMissingTemplate( argumentCollection = arguments );
+ return application.cbBootstrap.onMissingTemplate( argumentCollection = arguments )
}
function onApplicationEnd( struct appScope ){
- arguments.appScope.cbBootstrap.onApplicationEnd( arguments.appScope );
+ arguments.appScope.cbBootstrap.onApplicationEnd( arguments.appScope )
}
/*****************************************************************************************************/
@@ -207,30 +198,30 @@ component {
* Application Reinitialization
**/
private void function reinitApplication(){
- onApplicationStart();
+ onApplicationStart()
}
/**
* This method is only called if you are in a NON CommandBox install to load the environment variables
*/
private void function loadEnv( boolean force = false ){
- var javaSystem = createObject( "java", "java.lang.System" );
- var value = javaSystem.getProperty( "contentbox_runtime_env" );
+ var javaSystem = createObject( "java", "java.lang.System" )
+ var value = javaSystem.getProperty( "contentbox_runtime_env" )
// If not loaded, lock and load.
if ( isNull( value ) || arguments.force ) {
lock name="contentbox_runtime_env" timeout="15" throwOnTimeout="true" type="exclusive" {
// Double lock
if ( isNull( javaSystem.getProperty( "contentbox_runtime_env" ) ) || arguments.force ) {
// Load .env file
- var props = createObject( "java", "java.util.Properties" ).init();
- props.load( createObject( "java", "java.io.FileInputStream" ).init( this.cbEnvFile ) );
+ var props = createObject( "java", "java.util.Properties" ).init()
+ props.load( createObject( "java", "java.io.FileInputStream" ).init( this.cbEnvFile ) )
// Iterate and add
- var availableProps = props.propertyNames();
+ var availableProps = props.propertyNames()
while ( availableProps.hasNext() ) {
- var propName = availableProps.next();
- javaSystem.setProperty( propName, props.getProperty( propName ) );
+ var propName = availableProps.next()
+ javaSystem.setProperty( propName, props.getProperty( propName ) )
}
- javaSystem.setProperty( "contentbox_runtime_env", true );
+ javaSystem.setProperty( "contentbox_runtime_env", true )
}
// end double lock
}
@@ -239,4 +230,24 @@ component {
// end lock check
}
+ /**
+ * Helper to get system settings from either the environment or the java system properties, with an optional default value.
+ * This is used to configure ORM settings via environment variables, which is especially useful in containerized environments.
+ * The order of precedence is: Environment Variables > Java System Properties > Default Value
+ */
+ private string function _getSystemSetting( string settingName, any defaultValue = "" ){
+ var env = server.system.environment
+ var properties = server.system.properties
+
+ if ( structKeyExists( env, settingName ) ) {
+ return env[ settingName ]
+ }
+ else if ( structKeyExists( properties, settingName ) ) {
+ return properties[ settingName ]
+ }
+ else {
+ return defaultValue
+ }
+ }
+
}
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000000..eef4bd20cf
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1 @@
+@AGENTS.md
\ No newline at end of file
diff --git a/box-site.json b/box-site.json
index 4a2671be8c..cb77311dbe 100644
--- a/box-site.json
+++ b/box-site.json
@@ -27,7 +27,7 @@
"Curt Gratz "
],
"dependencies":{
- "coldbox":"^7.0.0+7",
+ "coldbox":"^8",
"contentbox":"~@version.number@+@build.number@",
"commandbox-boxlang":"*",
"commandbox-migrations":"*"
@@ -35,6 +35,10 @@
"devDependencies":{
},
"installPaths":{
+ "coldbox":"lib/coldbox/"
+ },
+ "installPathConventions":{
+ "modules":"lib/modules"
},
"ignores":[
],
@@ -42,9 +46,6 @@
"contentbox:install":"install --force && cd modules/contentbox && install --force",
"contentbox:migrate" : "migrate up manager=contentbox",
"contentbox:migrate:up" : "run-script contentbox:migrate",
- "contentbox:migrate:down" : "migrate down manager=contentbox",
- "format":"cfformat run config/,handlers/,models/,modules_app/**/*.cfc,Application.cfc --overwrite",
- "format:watch":"cfformat watch config/,handlers/,models/,modules_app/**/*.cfc,Application.cfc ./.cfformat.json",
- "format:check":"cfformat check config/**/*.cfc,modules_app/**/*.cfc,modules/contentbox/**/*.cfc,tests/**/*.cfc,Application.cfc"
+ "contentbox:migrate:down" : "migrate down manager=contentbox"
}
}
diff --git a/box.json b/box.json
index d73ab48389..6b50718756 100644
--- a/box.json
+++ b/box.json
@@ -1,6 +1,6 @@
{
"name":"ContentBox Tester Site",
- "version":"6.3.2",
+ "version":"7.0.0",
"author":"Ortus Solutions ",
"shortDescription":"A tester site for developing the ContentBox Modular CMS",
"type":"cms",
@@ -24,42 +24,41 @@
"Curt Gratz "
],
"dependencies":{
- "coldbox":"be",
+ "coldbox":"^8",
"commandbox-migrations":"*"
},
"devDependencies":{
"commandbox-boxlang":"*",
- "commandbox-cfformat":"*",
"commandbox-docbox":"*",
"testbox":"*",
"cbdebugger":"*",
"route-visualizer":"*"
},
"installPaths":{
- "testbox":"testbox/",
- "coldbox":"coldbox/",
- "cbdebugger":"modules/cbdebugger/",
- "route-visualizer":"modules/route-visualizer/"
+ "testbox":"lib/testbox/",
+ "coldbox":"lib/coldbox/",
+ "cbdebugger":"lib/modules/cbdebugger/",
+ "route-visualizer":"lib/modules/route-visualizer/"
+ },
+ "installPathConventions":{
+ "modules":"lib/modules"
},
"ignores":[],
"scripts":{
- "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 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/**/*.cfc,modules_app/**/*.cfc,modules/contentbox/**/*.cfc,tests/**/*.cfc,Application.cfc --overwrite",
- "format:watch":"cfformat watch config/**/*.cfc,modules_app/**/*.cfc,modules/contentbox/**/*.cfc,tests/**/*.cfc,Application.cfc ./.cfformat.json",
- "format:watch:core":"cfformat watch config/**/*.cfc,modules/contentbox/models/**/*.cfc,Application.cfc ./.cfformat.json",
- "format:check":"cfformat check config/**/*.cfc,modules_app/**/*.cfc,modules/contentbox/**/*.cfc,tests/**/*.cfc,Application.cfc ./.cfformat.json",
"contentbox:install":"install --force && cd modules/contentbox && install --force",
"contentbox:migrate:create":"migrate create name=${1} manager=contentbox",
"contentbox:migrate":"migrate up manager=contentbox",
"contentbox:migrate:up":"run-script contentbox:migrate",
"contentbox:migrate:down":"migrate down manager=contentbox",
- "contentbox:migrate:fresh":"migrate fresh manager=contentbox"
+ "contentbox:migrate:fresh":"migrate fresh manager=contentbox",
+ "format":"!boxlang format --source config,handlers,modules/contentbox,tests/specs --excludes modules/contentbox/modules/contentbox-deps",
+ "format:check":"!boxlang format --check --source config,handlers,modules/contentbox,tests/specs --excludes modules/contentbox/modules/contentbox-deps"
},
"testbox":{
"runner":[
diff --git a/build/release.boxr b/build/release.boxr
deleted file mode 100755
index a63f2ccdb2..0000000000
--- a/build/release.boxr
+++ /dev/null
@@ -1,14 +0,0 @@
-# This recipe signifies a new release of the module by doing merges and bumps accordingly
-
-# Check out master and update it locally
-!git checkout -f master
-!git pull origin master
-
-# Merge development into it for release
-!git merge --no-ff development
-
-# Push all branches back out to github
-!git push origin --all
-
-# Check development again
-!git checkout -f development
diff --git a/changelog.md b/changelog.md
index 77535e5d6d..6444018a3f 100644
--- a/changelog.md
+++ b/changelog.md
@@ -9,9 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+- https://contentbox.ortusbooks.com/readme/release-history/7.0.0
+
+### Fixed
+
+- Site creation now attaches default settings to the new site before persistence so ORM cascades insert the parent site before child settings.
+
+## [6.3.2] - 2025-12-05
+
### Fixed
-* Fixed an issue where different engines were handing defaults
+- Fixed an issue where different engines were handing defaults
## [6.3.1] - 2025-10-20
@@ -25,107 +33,109 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
-- CONTENTBOX-1510 - Emails being sanitized and invalidated on Comment form submission
+- CONTENTBOX-1510 - Emails being sanitized and invalidated on Comment form submission
## [6.0.4] - 2024-02-20
### Fixed
-- JS Library Patches
-- [CONTENTBOX-1509](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1509) `featuredImage` URL on initial migration should be nullable
+- JS Library Patches
+- [CONTENTBOX-1509](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1509) `featuredImage` URL on initial migration should be nullable
## [6.0.3] - 2024-02-13
### Updated
-- All github actions
+- All github actions
### Bugs
-- [CONTENTBOX-1507](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1507) BulkSave not accounting for sites when filtering and saving
-- [CONTENTBOX-1506](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1506) Updated all server.jsons to use \`env\` for the ortus orm extension since the latest lucee build broken extensions via jvm args
-- [CONTENTBOX-1505](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1505) RenderView widget exception when using \`view()\` to render the view
+- [CONTENTBOX-1507](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1507) BulkSave not accounting for sites when filtering and saving
+- [CONTENTBOX-1506](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1506) Updated all server.jsons to use \`env\` for the ortus orm extension since the latest lucee build broken extensions via jvm args
+- [CONTENTBOX-1505](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1505) RenderView widget exception when using \`view()\` to render the view
## [6.0.2] - 2024-01-15
### Bugs
-- [CONTENTBOX-1501](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1501) Init migration needs to verify permissions and roles separately to make sure it passes on created dbs
+- [CONTENTBOX-1501](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1501) Init migration needs to verify permissions and roles separately to make sure it passes on created dbs
## [6.0.1] - 2023-12-20
### Bugs
-- [CONTENTBOX-1500](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1500) Defensive coding for permissions migration on new instance
+- [CONTENTBOX-1500](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1500) Defensive coding for permissions migration on new instance
## [6.0.0] - 2023-12-18
### Bugs
-- [CONTENTBOX-1323](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1323) Import With Overwrite Throws an Error
-- [CONTENTBOX-1370](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1370) UI Disappoints in Menu Manager and Broken ContentMenuItem Functionality
-- [CONTENTBOX-1404](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1404) Issue Importing Site using ContentBox 5.03 and a fresh export
-- [CONTENTBOX-1406](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1406) Switching Editors Sends Item Being Edited in to Draft Status
-- [CONTENTBOX-1427](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1427) CBRequest postRender of AdminBar will throw errors if Buffer is flushed to Browser
-- [CONTENTBOX-1428](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1428) Incorrect Site and Parent Re-Assignment When Using Admin Bar Edit
-- [CONTENTBOX-1439](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1439) NOW for a new blog post doesn't update the time anymore with the alpine updates
-- [CONTENTBOX-1445](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1445) Menu Manager Create new does not working
-- [CONTENTBOX-1450](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1450) menu manager sandbox display is broken
-- [CONTENTBOX-1453](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1453) modules_user is not currently included in the ormSettings so some contentbox modules on forgebox don't work without Application.cfc being updated by the user
-- [CONTENTBOX-1454](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1454) files fail to upload in media manager after server restart
-- [CONTENTBOX-1462](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1462) Generated Sitemap has broken links
-- [CONTENTBOX-1467](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1467) FeedGenerator.cfc Incompatible with ACF 2018+
-- [CONTENTBOX-1468](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1468) getOpenGraphMeta broken for description
-- [CONTENTBOX-1472](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1472) Ensure visibility of Menu Toggle in mobile views
-- [CONTENTBOX-1476](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1476) Links do not have enough contrast
-- [CONTENTBOX-1481](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1481) Missing Icons
-- [CONTENTBOX-1482](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1482) PageInclude/EntryInclude/Menu widgets are not including the current site
-- [CONTENTBOX-1484](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1484) Menu Preview Error
-- [CONTENTBOX-1496](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1496) checkAll failing due to window scoping issues
-- [CONTENTBOX-1498](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1498) Missing fieldset tag
-- [CONTENTBOX-1499](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1499) An error is recorded in the log when initialising a custom widget in an add-on module
+- [CONTENTBOX-1323](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1323) Import With Overwrite Throws an Error
+- [CONTENTBOX-1370](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1370) UI Disappoints in Menu Manager and Broken ContentMenuItem Functionality
+- [CONTENTBOX-1404](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1404) Issue Importing Site using ContentBox 5.03 and a fresh export
+- [CONTENTBOX-1406](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1406) Switching Editors Sends Item Being Edited in to Draft Status
+- [CONTENTBOX-1427](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1427) CBRequest postRender of AdminBar will throw errors if Buffer is flushed to Browser
+- [CONTENTBOX-1428](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1428) Incorrect Site and Parent Re-Assignment When Using Admin Bar Edit
+- [CONTENTBOX-1439](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1439) NOW for a new blog post doesn't update the time anymore with the alpine updates
+- [CONTENTBOX-1445](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1445) Menu Manager Create new does not working
+- [CONTENTBOX-1450](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1450) menu manager sandbox display is broken
+- [CONTENTBOX-1453](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1453) modules_user is not currently included in the ormSettings so some contentbox modules on forgebox don't work without Application.cfc being updated by the user
+- [CONTENTBOX-1454](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1454) files fail to upload in media manager after server restart
+- [CONTENTBOX-1462](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1462) Generated Sitemap has broken links
+- [CONTENTBOX-1467](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1467) FeedGenerator.cfc Incompatible with ACF 2018+
+- [CONTENTBOX-1468](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1468) getOpenGraphMeta broken for description
+- [CONTENTBOX-1472](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1472) Ensure visibility of Menu Toggle in mobile views
+- [CONTENTBOX-1476](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1476) Links do not have enough contrast
+- [CONTENTBOX-1481](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1481) Missing Icons
+- [CONTENTBOX-1482](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1482) PageInclude/EntryInclude/Menu widgets are not including the current site
+- [CONTENTBOX-1484](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1484) Menu Preview Error
+- [CONTENTBOX-1496](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1496) checkAll failing due to window scoping issues
+- [CONTENTBOX-1498](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1498) Missing fieldset tag
+- [CONTENTBOX-1499](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1499) An error is recorded in the log when initialising a custom widget in an add-on module
### New Features
-- [CONTENTBOX-1270](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1270) ContentBox Content Templates
-- [CONTENTBOX-1377](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1377) Add Child Layout Property to Pages
-- [CONTENTBOX-1451](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1451) use onServerInstall migration scripts from latest CommandBox on server scripts
-- [CONTENTBOX-1477](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1477) Upgrade to ColdBox 7
-- [CONTENTBOX-1480](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1480) cfconfig definitions additions to the server definitions
-- [CONTENTBOX-1487](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1487) Ability to define domain aliases for sites for domain detection
-- [CONTENTBOX-1491](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1491) Migration to cfmigrations for full database and seeding creations instead of ORM
-- [CONTENTBOX-1492](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1492) Added the cors module to the site since we have API deployments now
-- [CONTENTBOX-1497](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1497) New Content Editing Focus mode to remove distractions
-- [CONTENTBOX-1452](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1452) Convert File Operations to cbfs
+- [CONTENTBOX-1270](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1270) ContentBox Content Templates
+- [CONTENTBOX-1377](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1377) Add Child Layout Property to Pages
+- [CONTENTBOX-1451](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1451) use onServerInstall migration scripts from latest CommandBox on server scripts
+- [CONTENTBOX-1477](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1477) Upgrade to ColdBox 7
+- [CONTENTBOX-1480](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1480) cfconfig definitions additions to the server definitions
+- [CONTENTBOX-1487](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1487) Ability to define domain aliases for sites for domain detection
+- [CONTENTBOX-1491](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1491) Migration to cfmigrations for full database and seeding creations instead of ORM
+- [CONTENTBOX-1492](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1492) Added the cors module to the site since we have API deployments now
+- [CONTENTBOX-1497](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1497) New Content Editing Focus mode to remove distractions
+- [CONTENTBOX-1452](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1452) Convert File Operations to cbfs
### Improvements
-- [CONTENTBOX-721](https://ortussolutions.atlassian.net/browse/CONTENTBOX-721) Menu Manager Improvements
-- [CONTENTBOX-1296](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1296) Add historical slug storage and automatic redirects
-- [CONTENTBOX-1399](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1399) Editors Should Have the Ability to Evict Content Cache with new permission: RELOAD_CACHES
-- [CONTENTBOX-1429](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1429) Sitemap Search in Admin is extremely slow on large sites.
-- [CONTENTBOX-1447](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1447) Logical Groupings for Content Template Form Fields
-- [CONTENTBOX-1448](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1448) Move Global Content Template Assignment Up to Template List
-- [CONTENTBOX-1455](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1455) 'Remove All' button is displayed under Blog > Custom Fields even when there are no custom fields defined.
-- [CONTENTBOX-1458](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1458) Remove content returnformats for pdf to avoid server and bot attacks
-- [CONTENTBOX-1469](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1469) Improve position of the menu toggle
-- [CONTENTBOX-1474](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1474) Enhance logo quality
-- [CONTENTBOX-1488](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1488) latest logins should only be displayed if the tracker is enabled
-- [CONTENTBOX-1489](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1489) SEO for meta data on home page, needs to follow site rules instead of page only rules
-- [CONTENTBOX-1490](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1490) Removed moment js to luxon for increased support and viability
-- [CONTENTBOX-1494](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1494) When using hierarchical slugs on the contentstore and pages the api does not work for retreiveing the right slug due to CF decoding of encoded slugs
+- [CONTENTBOX-721](https://ortussolutions.atlassian.net/browse/CONTENTBOX-721) Menu Manager Improvements
+- [CONTENTBOX-1296](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1296) Add historical slug storage and automatic redirects
+- [CONTENTBOX-1399](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1399) Editors Should Have the Ability to Evict Content Cache with new permission: RELOAD_CACHES
+- [CONTENTBOX-1429](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1429) Sitemap Search in Admin is extremely slow on large sites.
+- [CONTENTBOX-1447](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1447) Logical Groupings for Content Template Form Fields
+- [CONTENTBOX-1448](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1448) Move Global Content Template Assignment Up to Template List
+- [CONTENTBOX-1455](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1455) 'Remove All' button is displayed under Blog > Custom Fields even when there are no custom fields defined.
+- [CONTENTBOX-1458](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1458) Remove content returnformats for pdf to avoid server and bot attacks
+- [CONTENTBOX-1469](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1469) Improve position of the menu toggle
+- [CONTENTBOX-1474](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1474) Enhance logo quality
+- [CONTENTBOX-1488](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1488) latest logins should only be displayed if the tracker is enabled
+- [CONTENTBOX-1489](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1489) SEO for meta data on home page, needs to follow site rules instead of page only rules
+- [CONTENTBOX-1490](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1490) Removed moment js to luxon for increased support and viability
+- [CONTENTBOX-1494](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1494) When using hierarchical slugs on the contentstore and pages the api does not work for retreiveing the right slug due to CF decoding of encoded slugs
### Tasks
-- [CONTENTBOX-1172](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1172) Migrate UI development from bower/grunt to npm/elixir
-- [CONTENTBOX-1321](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1321) Convert from Yarn to NPM for package management
-- [CONTENTBOX-1470](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1470) Update Panels Styles
-- [CONTENTBOX-1471](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1471) Update Tabs Styles
-- [CONTENTBOX-1473](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1473) Update Sidebar Styles
-- [CONTENTBOX-1478](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1478) Remove old tuckey urlrewrite.xml as this is now in the CommandBox Core
-- [CONTENTBOX-1493](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1493) ContentBox Express removed since we now have CommandBox
+- [CONTENTBOX-1172](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1172) Migrate UI development from bower/grunt to npm/elixir
+- [CONTENTBOX-1321](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1321) Convert from Yarn to NPM for package management
+- [CONTENTBOX-1470](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1470) Update Panels Styles
+- [CONTENTBOX-1471](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1471) Update Tabs Styles
+- [CONTENTBOX-1473](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1473) Update Sidebar Styles
+- [CONTENTBOX-1478](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1478) Remove old tuckey urlrewrite.xml as this is now in the CommandBox Core
+- [CONTENTBOX-1493](https://ortussolutions.atlassian.net/browse/CONTENTBOX-1493) ContentBox Express removed since we now have CommandBox
+
+[Unreleased]: https://github.com/Ortus-Solutions/ContentBox/compare/v6.3.2...HEAD
-[Unreleased]: https://github.com/Ortus-Solutions/ContentBox/compare/v6.3.1...HEAD
+[6.3.2]: https://github.com/Ortus-Solutions/ContentBox/compare/v6.3.1...v6.3.2
[6.3.1]: https://github.com/Ortus-Solutions/ContentBox/compare/v6.3.0...v6.3.1
diff --git a/config/Application.cfm b/config/Application.cfm
index e3e4397a3c..7e1e736bef 100755
--- a/config/Application.cfm
+++ b/config/Application.cfm
@@ -1,5 +1,4 @@
-
+******************************************************************************** --->
\ No newline at end of file
diff --git a/config/CacheBox.cfc b/config/CacheBox.cfc
index afa2e9eb34..4eb5057bc1 100755
--- a/config/CacheBox.cfc
+++ b/config/CacheBox.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,13 +10,13 @@ component {
/**
* Configure CacheBox for ColdBox Application Operation
*/
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* CacheBox Configuration (https://cachebox.ortusbooks.com)
* --------------------------------------------------------------------------
*/
- cacheBox = {
+ variables.cacheBox = {
/**
* --------------------------------------------------------------------------
* Default Cache Configuration
@@ -25,17 +25,17 @@ component {
* It also has a default provider of cachebox which cannot be changed.
* All timeouts are in minutes
*/
- defaultCache : {
- 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
- coldboxEnabled : true
+ defaultCache: {
+ 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
+ coldboxEnabled : true
},
/**
* --------------------------------------------------------------------------
@@ -44,7 +44,7 @@ component {
* You can use this section to register different cache regions and map them
* to different cache providers
*/
- caches : {
+ caches: {
/**
* --------------------------------------------------------------------------
* ColdBox Template Cache
@@ -52,18 +52,18 @@ component {
* The ColdBox Template cache region is used for event/view caching and
* other internal facilities that might require a more elastic cache.
*/
- template : {
- provider : "coldbox.system.cache.providers.CacheBoxColdBoxProvider",
- properties : {
- objectDefaultTimeout : 120,
- objectDefaultLastAccessTimeout : 30,
- useLastAccessTimeouts : true,
- freeMemoryPercentageThreshold : 0,
- reapFrequency : 5,
- evictionPolicy : "LRU",
- evictCount : 5,
- maxObjects : 5000,
- objectStore : "ConcurrentSoftReferenceStore" // memory sensitive
+ template: {
+ provider : "coldbox.system.cache.providers.CacheBoxColdBoxProvider",
+ properties: {
+ objectDefaultTimeout : 120,
+ objectDefaultLastAccessTimeout: 30,
+ useLastAccessTimeouts : true,
+ freeMemoryPercentageThreshold : 0,
+ reapFrequency : 5,
+ evictionPolicy : "LRU",
+ evictCount : 5,
+ maxObjects : 5000,
+ objectStore : "ConcurrentSoftReferenceStore" // memory sensitive
}
},
/**
@@ -73,22 +73,22 @@ component {
* Sessions are managed by CacheBox and not CFML so we can distribute to any
* cache provider.
*/
- sessions : {
- provider : "coldbox.system.cache.providers.CacheBoxColdBoxProvider",
- properties : {
- objectDefaultTimeout : 60,
- objectDefaultLastAccessTimeout : 0,
- useLastAccessTimeouts : false,
- freeMemoryPercentageThreshold : 0,
- reapFrequency : 5,
- evictionPolicy : "LRU",
- evictCount : 5,
- maxObjects : 5000, // Can support up to 5000 user sessions concurrently. Modify if needed. 0 = unlimited
- objectStore : "ConcurrentStore"
+ sessions: {
+ provider : "coldbox.system.cache.providers.CacheBoxColdBoxProvider",
+ properties: {
+ objectDefaultTimeout : 60,
+ objectDefaultLastAccessTimeout: 0,
+ useLastAccessTimeouts : false,
+ freeMemoryPercentageThreshold : 0,
+ reapFrequency : 5,
+ evictionPolicy : "LRU",
+ evictCount : 5,
+ maxObjects : 5000, // Can support up to 5000 user sessions concurrently. Modify if needed. 0 = unlimited
+ objectStore : "ConcurrentStore"
}
}
}
};
}
-}
+}
\ No newline at end of file
diff --git a/config/Coldbox.cfc b/config/Coldbox.cfc
index de97ab4d2e..8bf0cb469d 100755
--- a/config/Coldbox.cfc
+++ b/config/Coldbox.cfc
@@ -8,7 +8,7 @@
component {
// Configure Application
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ColdBox Directives
@@ -18,44 +18,44 @@ component {
* you create the appropriate functions and define the environment in your .env or
* in the `environments` struct.
*/
- coldbox = {
+ variables.coldbox = {
// Application Setup
- appName : getSystemSetting( "APPNAME", "ContentBox Modular CMS" ),
- eventName : "event",
+ appName : getSystemSetting( "APPNAME", "ContentBox Modular CMS" ),
+ eventName : "event",
// Development Settings
- reinitPassword : getSystemSetting( "COLDBOX_REINITPASSWORD", "@fwPassword@" ),
- reinitKey : "fwreinit",
- handlersIndexAutoReload : false,
+ reinitPassword : getSystemSetting( "COLDBOX_REINITPASSWORD", "@fwPassword@" ),
+ reinitKey : "fwreinit",
+ handlersIndexAutoReload : false,
// Implicit Events
- defaultEvent : "Main.index",
- requestStartHandler : "",
- requestEndHandler : "",
- applicationStartHandler : "",
- applicationEndHandler : "",
- sessionStartHandler : "",
- sessionEndHandler : "",
- missingTemplateHandler : "",
+ defaultEvent : "Main.index",
+ requestStartHandler : "",
+ requestEndHandler : "",
+ applicationStartHandler : "",
+ applicationEndHandler : "",
+ sessionStartHandler : "",
+ sessionEndHandler : "",
+ missingTemplateHandler : "",
// Extension Points
- applicationHelper : "",
- viewsHelper : "",
- modulesExternalLocation : [],
- viewsExternalLocation : "",
- layoutsExternalLocation : "",
- handlersExternalLocation : "",
- requestContextDecorator : "",
- controllerDecorator : "",
+ applicationHelper : "",
+ viewsHelper : "",
+ modulesExternalLocation : [ "/lib/modules" ],
+ viewsExternalLocation : "",
+ layoutsExternalLocation : "",
+ handlersExternalLocation: "",
+ requestContextDecorator : "",
+ controllerDecorator : "",
// Error/Exception Handling
- exceptionHandler : "",
- invalidEventHandler : "",
- customErrorTemplate : "",
+ exceptionHandler : "",
+ invalidEventHandler : "",
+ customErrorTemplate : "",
// Application Aspects
- handlerCaching : true,
- eventCaching : true,
- viewCaching : true,
+ handlerCaching : true,
+ eventCaching : true,
+ viewCaching : true,
// Will automatically do a mapDirectory() on your `models` for you.
- autoMapModels : true,
+ autoMapModels : true,
// Auto converts a json body payload into the RC
- jsonPayloadToRC : true
+ jsonPayloadToRC : true
};
/**
@@ -63,7 +63,7 @@ component {
* Custom Settings
* --------------------------------------------------------------------------
*/
- settings = {};
+ variables.settings = {};
/**
* --------------------------------------------------------------------------
@@ -76,20 +76,20 @@ component {
*
* Uncomment to use, but make sure your .env ENVIRONMENT key is also removed.
*/
- environments = { development : "localhost" };
+ variables.environments = { development: "localhost" };
/**
* --------------------------------------------------------------------------
* Logging Directives
* --------------------------------------------------------------------------
*/
- logBox = {
+ variables.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"]
};
/**
@@ -97,14 +97,14 @@ component {
* Layout Settings
* --------------------------------------------------------------------------
*/
- layoutSettings = { defaultLayout : "", defaultView : "" };
+ variables.layoutSettings = { defaultLayout: "", defaultView: "" };
/**
* --------------------------------------------------------------------------
* Custom Interception Points
* --------------------------------------------------------------------------
*/
- interceptorSettings = { customInterceptionPoints : [] };
+ variables.interceptorSettings = { customInterceptionPoints: [] };
/**
* --------------------------------------------------------------------------
@@ -112,7 +112,7 @@ component {
* --------------------------------------------------------------------------
* Remember that the order of declaration is the order they will be registered and fired
*/
- interceptors = [];
+ variables.interceptors = [];
/**
* --------------------------------------------------------------------------
@@ -120,13 +120,13 @@ component {
* --------------------------------------------------------------------------
* The available scopes are : session, client, cluster, cache, or a full instantiation CFC path
*/
- flash = {
- scope : "cache",
- properties : { cacheName : "template" },
- inflateToRC : true, // automatically inflate flash data into the RC scope
- inflateToPRC : false, // automatically inflate flash data into the PRC scope
- autoPurge : true, // automatically purge flash data for you
- autoSave : true // automatically save flash scopes at end of a request and on relocations.
+ variables.flash = {
+ scope : "cache",
+ properties : { cacheName: "template" },
+ inflateToRC : true, // automatically inflate flash data into the RC scope
+ inflateToPRC: false, // automatically inflate flash data into the PRC scope
+ autoPurge : true, // automatically purge flash data for you
+ autoSave : true // automatically save flash scopes at end of a request and on relocations.
};
/**
@@ -142,13 +142,13 @@ component {
*
* }
*/
- moduleSettings = {};
+ variables.moduleSettings = {};
}
/**
* Testing Mode.
*/
- function testing(){
+ function testing() {
development();
}
@@ -156,27 +156,29 @@ component {
* Development environment
* ORTUS DEVELOPMENT ENVIRONMENT, REMOVE FOR YOUR APP IF NEEDED
*/
- function development(){
- coldbox.handlersIndexAutoReload = true;
- coldbox.handlerCaching = false;
- coldbox.debugMode = true;
- coldbox.reinitpassword = "";
- coldbox.customErrorTemplate = "/coldbox/system/exceptions/Whoops.cfm";
+ function development() {
+ variables.coldbox.handlersIndexAutoReload = true;
+ variables.coldbox.handlerCaching = false;
+ variables.coldbox.debugMode = true;
+ variables.coldbox.reinitpassword = "";
+ variables.coldbox.customErrorTemplate = "/coldbox/system/exceptions/Whoops.cfm";
// No Singletons for easy testing
- wirebox = {
- // singletonReload : true
- };
+ // variables.wirebox = {// singletonReload : true};
// debugging file
- logbox.appenders.files = {
- class : "coldbox.system.logging.appenders.RollingFileAppender",
- properties : {
- filename : "contentbox",
- filePath : "/cbapp/config/logs/app"
+ variables
+ .logbox
+ .appenders
+ .files = {
+ class : "coldbox.system.logging.appenders.RollingFileAppender",
+ properties: {
+ filename: "contentbox",
+ filePath: "/cbapp/config/logs/app"
}
};
+
// Specific Debugging + Logging
// logbox.debug = [ "cbsecurity" ];
// logbox.debug = [ "coldbox.system.web.services" ];
@@ -184,4 +186,4 @@ component {
// logbox.debug = [ "root" ];
}
-}
+}
\ No newline at end of file
diff --git a/config/Router.cfc b/config/Router.cfc
index 13457821b6..098c3c8a1e 100644
--- a/config/Router.cfc
+++ b/config/Router.cfc
@@ -7,7 +7,7 @@
*/
component {
- function configure(){
+ function configure() {
// Configuration
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
@@ -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 edeea671ff..21ce18d4ad 100644
--- a/config/Scheduler.cfc
+++ b/config/Scheduler.cfc
@@ -3,7 +3,7 @@ component {
/**
* Configure the ColdBox Scheduler
*/
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* Configuration Methods
@@ -13,8 +13,6 @@ component {
* - setExecutor( executorObject ) : change the executor if needed
*/
-
-
/**
* --------------------------------------------------------------------------
* Register Scheduled Tasks
@@ -27,13 +25,14 @@ component {
/**
* Called before the scheduler is going to be shutdown
*/
- function onShutdown(){
+ function onShutdown() {
+
}
/**
* Called after the scheduler has registered all schedules
*/
- function onStartup(){
+ function onStartup() {
log.info( "√ ColdBox Core Scheduler started successfully!" );
}
@@ -43,11 +42,11 @@ component {
* @task The task that got executed
* @exception The ColdFusion exception object
*/
- function onAnyTaskError( required task, required exception ){
+ function onAnyTaskError( required task, required exception ) {
log.error(
- "The global task (#arguments.task.getname()#) failed to executed. Caused by: #exception.message & exception.detail#",
- exception.stacktrace
- );
+ "The global task (#arguments.task.getname()#) failed to executed. Caused by: #exception.message & exception.detail#",
+ exception.stacktrace
+ );
}
/**
@@ -56,11 +55,11 @@ component {
* @task The task that got executed
* @result The result (if any) that the task produced
*/
- function onAnyTaskSuccess( required task, result ){
+ function onAnyTaskSuccess( required task, result ) {
log.info(
- "Global task (#arguments.task.getName()#) completed succesfully in #arguments.task.getStats().lastExecutionTime# ms",
- arguments.task.getStats()
- );
+ "Global task (#arguments.task.getName()#) completed succesfully in #arguments.task.getStats().lastExecutionTime# ms",
+ arguments.task.getStats()
+ );
}
/**
@@ -68,8 +67,10 @@ component {
*
* @task The task about to be executed
*/
- function beforeAnyTask( required task ){
- log.info( "Starting to execute global task (#arguments.task.getName()#)..." );
+ function beforeAnyTask( required task ) {
+ log.info(
+ "Starting to execute global task (#arguments.task.getName()#)..."
+ );
}
/**
@@ -78,7 +79,8 @@ component {
* @task The task that got executed
* @result The result (if any) that the task produced
*/
- function afterAnyTask( required task, result ){
+ function afterAnyTask( required task, result ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/config/WireBox.cfc b/config/WireBox.cfc
index e8b80d7a67..21ca1ccf5a 100755
--- a/config/WireBox.cfc
+++ b/config/WireBox.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,40 +10,37 @@ component extends="coldbox.system.ioc.config.Binder" {
/**
* Configure WireBox, that's it!
*/
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* WireBox Configuration (https://wirebox.ortusbooks.com)
* --------------------------------------------------------------------------
* Configure WireBox
*/
- wireBox = {
+ variables.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/config/modules/HTMLHelper.cfc b/config/modules/HTMLHelper.cfc
index 9ba02a313b..396bd2c748 100644
--- a/config/modules/HTMLHelper.cfc
+++ b/config/modules/HTMLHelper.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ColdBox HTML Helper Settings
@@ -8,12 +8,12 @@ component {
*/
return {
// The base path of JS assets
- js_path : "",
+ js_path : "",
// The base path of CSS assets
- css_path : "",
+ css_path : "",
// Encode values on all dynamically generated tags in the HTML Helper
- encodeValues : false
+ encodeValues: false
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cbdebugger.cfc b/config/modules/cbdebugger.cfc
index 78bd8139e4..6e1f478da4 100644
--- a/config/modules/cbdebugger.cfc
+++ b/config/modules/cbdebugger.cfc
@@ -1,102 +1,103 @@
component {
- function configure(){
+ function configure() {
return {
// 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",
+ debugPassword : "cb",
// This flag enables/disables the end of request debugger panel docked to the bottem of the page.
// If you disable i, then the only way to visualize the debugger is via the `/cbdebugger` endpoint
- requestPanelDock : true,
+ requestPanelDock: true,
// Request Tracker Options
- requestTracker : {
- storage : "memory",
- cacheName : "template",
- trackDebuggerEvents : false,
+ requestTracker : {
+ storage : "memory",
+ cacheName : "template",
+ trackDebuggerEvents : false,
// Expand by default the tracker panel or not
- expanded : true,
+ expanded : true,
// Slow request threshold in milliseconds, if execution time is above it, we mark those transactions as red
- slowExecutionThreshold : 1000,
+ slowExecutionThreshold : 1000,
// How many tracking profilers to keep in stack: Default is to monitor the last 20 requests
- maxProfilers : 50,
+ maxProfilers : 50,
// If enabled, the debugger will monitor the creation time of CFC objects via WireBox
- profileWireBoxObjectCreation : false,
+ profileWireBoxObjectCreation: false,
// Profile model objects annotated with the `profile` annotation
- profileObjects : false,
+ profileObjects : false,
// If enabled, will trace the results of any methods that are being profiled
- traceObjectResults : false,
+ traceObjectResults : false,
// Profile Custom or Core interception points
- profileInterceptions : false,
+ profileInterceptions : false,
// By default all interception events are excluded, you must include what you want to profile
- includedInterceptions : [],
+ includedInterceptions : [],
// Control the execution timers
- executionTimers : {
- expanded : true,
+ executionTimers : {
+ expanded : true,
// Slow transaction timers in milliseconds, if execution time of the timer is above it, we mark it
- slowTimerThreshold : 250
+ slowTimerThreshold: 250
},
// Control the coldbox info reporting
- coldboxInfo : { expanded : true },
+ coldboxInfo: { expanded: true },
// Control the http request reporting
- httpRequest : {
- expanded : false,
+ httpRequest: {
+ expanded : false,
// If enabled, we will profile HTTP Body content, disabled by default as it contains lots of data
- profileHTTPBody : true
+ profileHTTPBody: true
}
},
// ColdBox Tracer Appender Messages
- tracers : { enabled : false, expanded : false },
+ tracers : { enabled: false, expanded: false },
// Request Collections Reporting
- collections : {
+ collections: {
// Enable tracking
- enabled : false,
+ enabled : false,
// Expanded panel or not
- expanded : false,
+ expanded : false,
// How many rows to dump for object collections
- maxQueryRows : 50,
+ maxQueryRows: 50,
// How many levels to output on dumps for objects
- maxDumpTop : 5
+ maxDumpTop : 5
},
// CacheBox Reporting
- cachebox : { enabled : false, expanded : false },
+ cachebox: { enabled: false, expanded: false },
// Modules Reporting
- modules : { enabled : true, expanded : false },
+ modules : { enabled: true, expanded: false },
// Quick and QB Reporting
- qb : {
- enabled : false,
- expanded : false,
+ qb : {
+ enabled : false,
+ expanded : false,
// Log the binding parameters
- logParams : true
+ logParams: true
},
// cborm Reporting
- cborm : {
- enabled : true,
- expanded : false,
+ cborm: {
+ enabled : true,
+ expanded : false,
// Log the binding parameters
- logParams : false
+ logParams: false
},
// Adobe ColdFusion SQL Collector
- acfSql : { enabled : false, expanded : false, logParams : true },
+ acfSql : { enabled: false, expanded: false, logParams: true },
// Lucee SQL Collector
- luceeSQL : { enabled : false, expanded : false, logParams : true },
+ luceeSQL: { enabled: false, expanded: false, logParams: true },
// Async Manager Collector
- async : { enabled : true, expanded : false },
+ async : { enabled: true, expanded: false },
// Hyper Collector
- hyper : {
- enabled : false,
- expanded : false,
- logResponseData : false,
- logRequestBody : false
+ hyper : {
+ enabled : false,
+ expanded : false,
+ logResponseData: false,
+ logRequestBody : false
}
};
}
- function development( settings ){
+ function development( settings ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cbfs.cfc b/config/modules/cbfs.cfc
index 60e371e189..d700da5223 100644
--- a/config/modules/cbfs.cfc
+++ b/config/modules/cbfs.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* CBFS Module Settings
@@ -9,21 +9,20 @@ component {
*/
return {
// The default disk
- "defaultDisk" : "contentbox",
+ "defaultDisk": "contentbox",
// Register the disks on the system
- "disks" : {
+ "disks" : {
// Your default application storage
- "contentbox" : {
- provider : "Local",
- properties : {
- path : "#controller.getAppRootPath()#modules_app/contentbox-custom/_content",
- diskUrl : function(){
- return application.wirebox
+ "contentbox": {
+ provider : "Local",
+ properties: {
+ path : "#controller.getAppRootPath()#modules_app/contentbox-custom/_content",
+ diskUrl: function() {
+ return application
+ .wirebox
.getInstance( "CBHelper@contentBox" )
.site()
- .getSiteRoot()
- &
- "/modules_app/contentbox-custom/_content/"
+ .getSiteRoot() & "/modules_app/contentbox-custom/_content/";
}
}
}
@@ -31,4 +30,4 @@ component {
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cbmailservices.cfc b/config/modules/cbmailservices.cfc
index 98264809cd..a803fc9779 100644
--- a/config/modules/cbmailservices.cfc
+++ b/config/modules/cbmailservices.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ColdBox MailServices
@@ -9,24 +9,22 @@ component {
*/
return {
// The default token Marker Symbol
- tokenMarker : "@",
+ tokenMarker : "@",
// Default protocol to use, it must be defined in the mailers configuration
- defaultProtocol : "files",
+ defaultProtocol: "files",
// Here you can register one or many mailers by name
- mailers : {
- "default" : { class : "CFMail" },
- "files" : {
- class : "File",
- properties : { filePath : "config/logs/mail" }
+ mailers : {
+ "default": { class: "CFMail" },
+ "files" : {
+ class : "File",
+ properties: { filePath: "config/logs/mail" }
}
},
// The defaults for all mail config payloads and protocols
- defaults : {
- // from : "",
- },
+ defaults : {},
// Whether the scheduled task is running or not
- runQueueTask : true
+ runQueueTask: true
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cborm.cfc b/config/modules/cborm.cfc
index aeb97c08a5..8487e638a2 100644
--- a/config/modules/cborm.cfc
+++ b/config/modules/cborm.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ColdBox ORM
@@ -8,25 +8,25 @@ component {
* ColdBox cborm configurations https://forgebox.io/view/cborm
*/
return {
- injection : {
+ injection: {
// enable entity injection via WireBox
- enabled : true,
+ enabled: true,
// Which entities to include in DI ONLY, if empty include all entities
- include : "",
+ include: "",
// Which entities to exclude from DI, if empty, none are excluded
- exclude : ""
+ exclude: ""
},
- resources : {
+ 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
}
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cbsecurity.cfc b/config/modules/cbsecurity.cfc
index 65c7cf67c5..02d3526ce7 100644
--- a/config/modules/cbsecurity.cfc
+++ b/config/modules/cbsecurity.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ColdBox Security Configuration
@@ -20,46 +20,46 @@ component {
* - basicAuth : Leverages basic authentication and basic in-memory user registration in our configuration
* - custom : Any other service that adheres to our IAuthService interface
*/
- authentication : {
+ authentication: {
// The WireBox ID of the authentication service to use which must adhere to the cbsecurity.interfaces.IAuthService interface.
- "provider" : "SecurityService@contentbox",
+ "provider" : "SecurityService@contentbox",
// WireBox ID of the user service to use when leveraging user authentication, we default this to whatever is set
// by cbauth or basic authentication. (Optional)
- "userService" : "AuthorService@contentbox",
+ "userService" : "AuthorService@contentbox",
// The name of the variable to use to store an authenticated user in prc scope on all incoming authenticated requests
- "prcUserVariable" : "oCurrentAuthor"
+ "prcUserVariable": "oCurrentAuthor"
},
- firewall : {
+ firewall: {
// Enable annotation security as well
- "handlerAnnotationSecurity" : true,
+ "handlerAnnotationSecurity" : true,
// The global invalid authentication event or URI or URL to go if an invalid authentication occurs
- "invalidAuthenticationEvent" : "",
+ "invalidAuthenticationEvent" : "",
// Default Auhtentication Action: override or redirect when a user has not logged in
- "defaultAuthenticationAction" : "redirect",
+ "defaultAuthenticationAction": "redirect",
// The global invalid authorization event or URI or URL to go if an invalid authorization occurs
- "invalidAuthorizationEvent" : "",
+ "invalidAuthorizationEvent" : "",
// Default Authorization Action: override or redirect when a user does not have enough permissions to access something
- "defaultAuthorizationAction" : "redirect",
+ "defaultAuthorizationAction" : "redirect",
// You can define your security rules here or externally via a source
// specify an array for inline, or a string (db|json|xml|model) for externally
- "rules" : {
+ "rules" : {
// Use regex in rules
- "useRegex" : true,
+ "useRegex": true,
// Use SSL: Determined by Request
- "useSSL" : false,
+ "useSSL" : false,
// A collection of default name-value pairs to add to ALL rules
// This way you can add global roles, permissions, redirects, etc
- "defaults" : {},
+ "defaults": {},
// You can store all your rules in this inline array
- "inline" : []
+ "inline" : []
},
// The validator is an object that will validate rules and annotations and provide feedback on either authentication or authorization issues.
- "validator" : "SecurityValidator@contentbox",
+ "validator": "SecurityValidator@contentbox",
// Firewall database event logs.
- "logs" : {
- "enabled" : true,
- "table" : "cbsecurity_logs",
- "autoCreate" : true
+ "logs" : {
+ "enabled" : true,
+ "table" : "cbsecurity_logs",
+ "autoCreate": true
}
},
/**
@@ -68,20 +68,20 @@ component {
* --------------------------------------------------------------------------
* These settings configures the cbcsrf module. Look at the module configuration for more information
*/
- csrf : {
+ csrf: {
// By default we load up an interceptor that verifies all non-GET incoming requests against the token validations
- enableAutoVerifier : false,
+ enableAutoVerifier : false,
// A list of events to exclude from csrf verification, regex allowed: e.g. stripe\..*
- verifyExcludes : [],
+ verifyExcludes : [],
// By default, all csrf tokens have a life-span of 30 minutes. After 30 minutes, they expire and we aut-generate new ones.
// If you do not want expiring tokens, then set this value to 0
- rotationTimeout : 30,
+ rotationTimeout : 30,
// Enable the /cbcsrf/generate endpoint to generate cbcsrf tokens for secured users.
- enableEndpoint : false,
+ enableEndpoint : false,
// The WireBox mapping to use for the CacheStorage
- cacheStorage : "CacheStorage@cbstorages",
+ cacheStorage : "CacheStorage@cbstorages",
// Enable/Disable the cbAuth login/logout listener in order to rotate keys
- enableAuthTokenRotator : true
+ enableAuthTokenRotator: true
},
/**
* --------------------------------------------------------------------------
@@ -90,116 +90,115 @@ component {
* This section is the way to configure cbsecurity for header detection, inspection and setting for common
* security exploits like XSS, ClickJacking, Host Spoofing, IP Spoofing, Non SSL usage, HSTS and much more.
*/
- securityHeaders : {
+ securityHeaders: {
// If you trust the upstream then we will check the upstream first for specific headers
- "trustUpstream" : true,
+ "trustUpstream" : true,
// Content Security Policy
// Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks,
// including Cross-Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft, to
// site defacement, to malware distribution.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
- "contentSecurityPolicy" : {
+ "contentSecurityPolicy": {
// Disabled by defautl as it is totally customizable
- "enabled" : false,
+ "enabled": false,
// The custom policy to use, by default we don't include any
- "policy" : ""
+ "policy" : ""
},
// The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the MIME types advertised in
// the Content-Type headers should be followed and not be changed => X-Content-Type-Options: nosniff
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
- "contentTypeOptions" : { "enabled" : true },
- "customHeaders" : {
- // Name : value pairs as you see fit.
- },
+ "contentTypeOptions": { "enabled": true },
+ // Name : value pairs as you see fit. These are added to all responses and can be used for custom headers or to add headers that are not yet supported by cbsecurity
+ "customHeaders" : {},
// Disable Click jacking: X-Frame-Options: DENY OR SAMEORIGIN
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
- "frameOptions" : { "enabled" : true, "value" : "SAMEORIGIN" },
+ "frameOptions" : { "enabled": true, "value": "SAMEORIGIN" },
// HTTP Strict Transport Security (HSTS)
// The HTTP Strict-Transport-Security response header (often abbreviated as HSTS)
// informs browsers that the site should only be accessed using HTTPS, and that any future attempts to access it
// using HTTP should automatically be converted to HTTPS.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security,
- "hsts" : {
- "enabled" : false,
+ "hsts" : {
+ "enabled" : false,
// The time, in seconds, that the browser should remember that a site is only to be accessed using HTTPS, 1 year is the default
- "max-age" : "31536000",
+ "max-age" : "31536000",
// See Preloading Strict Transport Security for details. Not part of the specification.
- "preload" : false,
+ "preload" : false,
// If this optional parameter is specified, this rule applies to all of the site's subdomains as well.
- "includeSubDomains" : false
+ "includeSubDomains": false
},
// Validates the host or x-forwarded-host to an allowed list of valid hosts
- "hostHeaderValidation" : {
- "enabled" : false,
+ "hostHeaderValidation": {
+ "enabled" : false,
// Allowed hosts list
- "allowedHosts" : ""
+ "allowedHosts": ""
},
// Validates the ip address of the incoming request
- "ipValidation" : {
- "enabled" : false,
+ "ipValidation": {
+ "enabled" : false,
// Allowed IP list
- "allowedIPs" : ""
+ "allowedIPs": ""
},
// The Referrer-Policy HTTP header controls how much referrer information (sent with the Referer header) should be included with requests.
// Aside from the HTTP header, you can set this policy in HTML.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
- "referrerPolicy" : { "enabled" : true, "policy" : "same-origin" },
+ "referrerPolicy" : { "enabled": true, "policy": "same-origin" },
// Detect if the incoming requests are NON-SSL and if enabled, redirect with SSL
- "secureSSLRedirects" : { "enabled" : false },
+ "secureSSLRedirects": { "enabled": false },
// Some browsers have built in support for filtering out reflected XSS attacks. Not foolproof, but it assists in XSS protection.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection,
// X-XSS-Protection: 1; mode=block
- "xssProtection" : { "enabled" : true, "mode" : "block" }
+ "xssProtection" : { "enabled": true, "mode": "block" }
},
// JWT Settings
- "jwt" : {
+ "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,
+ "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,
+ "enabled" : true,
// A cache key prefix to use when storing the tokens
- "keyPrefix" : "cbjwt_",
+ "keyPrefix" : "cbjwt_",
// The driver to use: db, cachebox or a WireBox ID
- "driver" : "db",
+ "driver" : "db",
// Driver specific properties
- "properties" : {
- "table" : "cb_jwt",
- "autoCreate" : true,
- "rotationDays" : 7,
- "rotationFrequency" : 60
+ "properties": {
+ "table" : "cb_jwt",
+ "autoCreate" : true,
+ "rotationDays" : 7,
+ "rotationFrequency": 60
}
}
},
- visualizer : {
- "enabled" : true,
- "secured" : true,
- "securityRule" : { "permissions" : "SYSTEM_AUTH_LOGS" }
+ visualizer: {
+ "enabled" : true,
+ "secured" : true,
+ "securityRule": { "permissions": "SYSTEM_AUTH_LOGS" }
}
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cbstorages.cfc b/config/modules/cbstorages.cfc
index 526d48e290..d9616545de 100644
--- a/config/modules/cbstorages.cfc
+++ b/config/modules/cbstorages.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ColdBox Storages
@@ -9,38 +9,38 @@ component {
*/
return {
// Cache Storage Settings
- cacheStorage : {
+ 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(){}
- identifierProvider : "" // If it's a simple value, we ignore it.
+ identifierProvider: "" // If it's a simple value, we ignore it.
},
// Cookie Storage settings
- cookieStorage : {
+ 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 encryption key to use for the encryption
- encryptionKey : generateSecretKey( "AES", "128" ),
+ encryptionKey : generateSecretKey( "AES", "128" ),
// The unique seeding key to use: keep it secret, keep it safe
- encryptionSeed : "cbstorages",
+ encryptionSeed : "cbstorages",
// The algorithm to use: https://cfdocs.org/encrypt
- encryptionAlgorithm : "AES",
+ encryptionAlgorithm: "AES",
// The encryption encoding to use
- encryptionEncoding : "Base64"
+ encryptionEncoding : "Base64"
}
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/cbswagger.cfc b/config/modules/cbswagger.cfc
index 5e9e5faef5..844282d7df 100644
--- a/config/modules/cbswagger.cfc
+++ b/config/modules/cbswagger.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* CBSwagger Configuration
@@ -9,125 +9,121 @@ component {
*/
return {
// The route prefix to search. Routes beginning with this prefix will be determined to be api routes
- "routes" : [ "cbapi" ],
+ "routes" : [ "cbapi"],
// Routes to exclude from the generated spec
- "excludeRoutes" : [ "cbapi/v1/:anything/" ],
+ "excludeRoutes": [ "cbapi/v1/:anything/"],
// The default output format, either json or yml
- "defaultFormat" : "json",
+ "defaultFormat": "json",
// A convention route, relative to your app root, where request/response samples are stored ( e.g. resources/apidocs/responses/[module].[handler].[action].[HTTP Status Code].json )
- "samplesPath" : "resources/apidocs",
+ "samplesPath" : "resources/apidocs",
// Information about your API
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#infoObject
- "info" : {
+ "info" : {
// REQUIRED A title for your API
- "title" : "ContentBox CMS API",
+ "title" : "ContentBox CMS API",
// A short description of the application. CommonMark syntax MAY be used for rich text representation.
- "description" : "The ContentBox Headless CMS API",
+ "description" : "The ContentBox Headless CMS API",
// A URL to the Terms of Service for the API. MUST be in the format of a URL.
- "termsOfService" : "",
+ "termsOfService": "",
// Contact information for the exposed API.
- "contact" : {
+ "contact" : {
// The identifying name of the contact person/organization.
- "name" : "Ortus Solutions",
+ "name" : "Ortus Solutions",
// The URL pointing to the contact information. MUST be in the format of a URL.
- "url" : "https://www.ortussolutions.com",
+ "url" : "https://www.ortussolutions.com",
// The email address of the contact person/organization. MUST be in the format of an email address.
- "email" : "info@ortussolutions.com"
+ "email": "info@ortussolutions.com"
},
// License information for the exposed API.
- "license" : {
+ "license": {
// The license name used for the API.
- "name" : "Apache2",
+ "name": "Apache2",
// A URL to the license used for the API. MUST be in the format of a URL.
- "url" : "https://www.apache.org/licenses/LICENSE-2.0.html"
+ "url" : "https://www.apache.org/licenses/LICENSE-2.0.html"
},
// REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
- "version" : "@version.number@"
+ "version": "@version.number@"
},
// 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",
- "description" : "Development Server"
+ "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" : {
- "ApiKeyAuth" : {
- "type" : "apiKey",
- "description" : "User your JWT as an Api Key for security",
- "name" : "x-auth-token",
- "in" : "header"
+ "securitySchemes": {
+ "ApiKeyAuth": {
+ "type" : "apiKey",
+ "description": "User your JWT as an Api Key for security",
+ "name" : "x-auth-token",
+ "in" : "header"
},
- "ApiKeyQueryAuth" : {
- "type" : "apiKey",
- "description" : "User your JWT as an Api Key for security",
- "name" : "x-auth-token",
- "in" : "query"
+ "ApiKeyQueryAuth": {
+ "type" : "apiKey",
+ "description": "User your JWT as an Api Key for security",
+ "name" : "x-auth-token",
+ "in" : "query"
},
- "BearerAuth" : {
- "type" : "http",
- "description" : "User your JWT in the bearer Authorization header",
- "scheme" : "bearer",
- "bearerFormat" : "JWT"
+ "BearerAuth": {
+ "type" : "http",
+ "description" : "User your JWT in the bearer Authorization header",
+ "scheme" : "bearer",
+ "bearerFormat": "JWT"
}
}
},
// 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" : [
- { "ApiKeyAuth" : [] },
- { "ApiKeyQueryAuth" : [] },
- { "BearerAuth" : [] }
- ],
+ "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" : [
- { "name" : "Authors", "description" : "Author operations" },
+ "tags" : [
+ { "name": "Authors", "description": "Author operations" },
{
- "name" : "Authentication",
- "description" : "Authentication operations"
+ "name" : "Authentication",
+ "description": "Authentication operations"
},
{
- "name" : "Categories",
- "description" : "Category operations"
+ "name" : "Categories",
+ "description": "Category operations"
},
{
- "name" : "Comments",
- "description" : "Comment operations"
+ "name" : "Comments",
+ "description": "Comment operations"
},
{
- "name" : "ContentStore",
- "description" : "Content store operations"
+ "name" : "ContentStore",
+ "description": "Content store operations"
},
{
- "name" : "Entries",
- "description" : "Blog entry operations"
+ "name" : "Entries",
+ "description": "Blog entry operations"
},
- { "name" : "Menus", "description" : "Menu operations" },
- { "name" : "Pages", "description" : "Pages operations" },
- { "name" : "Sites", "description" : "Site operations" },
+ { "name": "Menus", "description": "Menu operations" },
+ { "name": "Pages", "description": "Pages operations" },
+ { "name": "Sites", "description": "Site operations" },
{
- "name" : "Settings",
- "description" : "Global setting operations"
+ "name" : "Settings",
+ "description": "Global setting operations"
},
{
- "name" : "Versions",
- "description" : "Content versions 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"
}
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/contentbox.cfc b/config/modules/contentbox.cfc
index 0fed9eac24..dc02f718e9 100644
--- a/config/modules/contentbox.cfc
+++ b/config/modules/contentbox.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* ContentBox Runtime Config
@@ -8,17 +8,15 @@ component {
*/
return {
// 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" : {}
}
};
}
-}
+}
\ No newline at end of file
diff --git a/config/modules/mementifier.cfc b/config/modules/mementifier.cfc
index bc71dc717a..047bf75a77 100644
--- a/config/modules/mementifier.cfc
+++ b/config/modules/mementifier.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* Mementifier Settings
@@ -9,22 +9,22 @@ component {
*/
return {
// 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"
};
}
-}
+}
\ No newline at end of file
diff --git a/handlers/Main.cfc b/handlers/Main.cfc
index 8ac50581f8..258a2e41b8 100755
--- a/handlers/Main.cfc
+++ b/handlers/Main.cfc
@@ -1 +1,45 @@
-component{
// Default Action
function index(event,rc,prc){
prc.welcomeMessage = "Welcome to ContentBox Modular CMS!";
event.setView( "main/index" );
}
/************************************** IMPLICIT ACTIONS *********************************************/
function onAppInit(event,rc,prc){
}
function onRequestStart(event,rc,prc){
}
function onRequestEnd(event,rc,prc){
}
function onSessionStart(event,rc,prc){
}
function onSessionEnd(event,rc,prc){
var sessionScope = event.getValue("sessionReference");
var applicationScope = event.getValue("applicationReference");
}
function onException(event,rc,prc){
//Grab Exception From request collection, placed by ColdBox
var exceptionBean = event.getValue("ExceptionBean");
//Place exception handler below:
}
function onMissingTemplate(event,rc,prc){
//Grab missingTemplate From request collection, placed by ColdBox
var missingTemplate = event.getValue("missingTemplate");
}
}
\ No newline at end of file
+component {
+
+ // Default Action
+ function index( event, rc, prc ) {
+ prc.welcomeMessage = "Welcome to ContentBox Modular CMS!";
+ event.setView( "main/index" );
+ }
+
+ /************************************** IMPLICIT ACTIONS *********************************************/
+
+ function onAppInit( event, rc, prc ) {
+
+ }
+
+ function onRequestStart( event, rc, prc ) {
+
+ }
+
+ function onRequestEnd( event, rc, prc ) {
+
+ }
+
+ function onSessionStart( event, rc, prc ) {
+
+ }
+
+ function onSessionEnd( event, rc, prc ) {
+ var sessionScope = event.getValue( "sessionReference" );
+ var applicationScope = event.getValue( "applicationReference" );
+ }
+
+ function onException( event, rc, prc ) {
+ // Grab Exception From request collection, placed by ColdBox
+ var exceptionBean = event.getValue( "ExceptionBean" );
+
+
+ // Place exception handler below:
+ }
+
+ function onMissingTemplate( event, rc, prc ) {
+ // Grab missingTemplate From request collection, placed by ColdBox
+ var missingTemplate = event.getValue( "missingTemplate" );
+ }
+
+}
\ No newline at end of file
diff --git a/layouts/Main.cfm b/layouts/Main.cfm
index daf62c53c5..25da1b7700 100644
--- a/layouts/Main.cfm
+++ b/layouts/Main.cfm
@@ -1 +1,16 @@
-
#html.doctype()#
Welcome to ContentBox!
#renderView()#
\ No newline at end of file
+
+#html.doctype()#
+
+
+
+ Welcome to ContentBox!
+
+
+
+
+
+
+ #renderView()#
+
+
+
diff --git a/lib/.gitkeep b/lib/.gitkeep
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/modules/contentbox/Application.cfc b/modules/contentbox/Application.cfc
index 21e64113d3..bb2ba391db 100644
--- a/modules/contentbox/Application.cfc
+++ b/modules/contentbox/Application.cfc
@@ -1,5 +1,4 @@
component {
-
abort;
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/ModuleConfig.cfc b/modules/contentbox/ModuleConfig.cfc
index 4bda2cb294..2c169390d9 100755
--- a/modules/contentbox/ModuleConfig.cfc
+++ b/modules/contentbox/ModuleConfig.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,142 +6,140 @@
* ContentBox Core module configuration
*/
component {
-
// Module Properties
- this.title = "ContentBox Core";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "This is the core module used to power the admin, RESTful and UI modules";
- this.viewParentLookup = true;
+ this.title = "ContentBox Core";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "This is the core module used to power the admin, RESTful and UI modules";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
- this.entryPoint = "cbcore";
- this.modelNamespace = "contentbox";
- this.cfmapping = "contentbox";
+ this.entryPoint = "cbcore";
+ this.modelNamespace = "contentbox";
+ this.cfmapping = "contentbox";
// Load ContentBox Dependencies First.
- this.dependencies = [ "contentbox-deps" ];
+ this.dependencies = [ "contentbox-deps"];
/**
* Configure Module
*/
- function configure(){
+ function configure() {
// Verify custom module, this is needed for registration and loading.
verifyCustomModule();
// contentbox settings
- settings = {
+ variables.settings = {
// Code name
- "codename" : "Psalm 144:1",
- "codenameLink" : "https://www.bible.com/bible/114/psa.144.1.nkjv",
+ "codename" : "Psalm 144:1",
+ "codenameLink": "https://www.bible.com/bible/114/psa.144.1.nkjv",
// Officially supported languages for modules
- "languages" : [ "de_DE", "en_US", "es_SV", "it_IT", "pt_BR" ],
+ "languages" : [ "de_DE", "en_US", "es_SV", "it_IT", "pt_BR"],
// cbSecurity settings
- "cbSecurity" : {
+ "cbSecurity" : {
// Load the security rules for ContentBox from our db model
- "firewall" : {
- "rules" : {
- "provider" : {
- "source" : "model",
- "properties" : {
- "model" : "securityRuleService@contentbox",
- "method" : "getSecurityRules"
+ "firewall": {
+ "rules": {
+ "provider": {
+ "source" : "model",
+ "properties": {
+ "model" : "securityRuleService@contentbox",
+ "method": "getSecurityRules"
}
}
}
}
},
// Array of mixins 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" : {}
}
};
// i18n
- cbi18n = { resourceBundles : { "cbcore" : "#moduleMapping#/i18n/cbcore" } };
+ variables.cbi18n = { resourceBundles: { "cbcore": "#moduleMapping#/i18n/cbcore" } };
// CB Module Conventions
- conventions = { layoutsLocation : "themes", viewsLocation : "themes" };
+ variables.conventions = { layoutsLocation: "themes", viewsLocation: "themes" };
// Parent Affected Settings
- parentSettings = {
+ variables.parentSettings = {
// File Browser module name override
- filebrowser_module_name : "contentbox-filebrowser"
+ filebrowser_module_name: "contentbox-filebrowser"
};
// ContentBox Core Custom Events
- interceptorSettings = {
- customInterceptionPoints : [
- "cb_onContentRendering",
- "cb_onContentStoreRendering"
- ]
+ variables.interceptorSettings = {
+ customInterceptionPoints: [ "cb_onContentRendering", "cb_onContentStoreRendering"]
};
// Async Executors for ContentBox Core
// executors = { "contentbox-tasks" : { type : "scheduled", threads : 20 } };
// interceptors
- interceptors = [
+ variables.interceptors = [
// Rate Limiter
{
- class : "contentbox.models.security.RateLimiter",
- name : "RateLimiter@contentbox"
+ class: "contentbox.models.security.RateLimiter",
+ name : "RateLimiter@contentbox"
},
// CB RSS Cache Cleanup Ghost
{
- class : "contentbox.models.rss.RSSCacheCleanup",
- name : "RSSCacheCleanup@contentbox"
+ class: "contentbox.models.rss.RSSCacheCleanup",
+ name : "RSSCacheCleanup@contentbox"
},
// CB Content Cache Cleanup Ghost
{
- class : "contentbox.models.content.util.ContentCacheCleanup",
- name : "ContentCacheCleanup@contentbox"
+ class: "contentbox.models.content.util.ContentCacheCleanup",
+ name : "ContentCacheCleanup@contentbox"
},
// Content Subscriptions
{
- class : "contentbox.models.subscriptions.SubscriptionListener",
- name : "SubscriptionListener@contentbox"
+ class: "contentbox.models.subscriptions.SubscriptionListener",
+ name : "SubscriptionListener@contentbox"
},
// Content Renderers, remember order is important.
{
- class : "contentbox.models.content.renderers.LinkRenderer",
- name : "LinkRenderer@contentbox"
+ class: "contentbox.models.content.renderers.LinkRenderer",
+ name : "LinkRenderer@contentbox"
},
{
- class : "contentbox.models.content.renderers.WidgetRenderer",
- name : "WidgetRenderer@contentbox"
+ class: "contentbox.models.content.renderers.WidgetRenderer",
+ name : "WidgetRenderer@contentbox"
},
{
- class : "contentbox.models.content.renderers.SettingRenderer",
- name : "SettingRenderer@contentbox"
+ class: "contentbox.models.content.renderers.SettingRenderer",
+ name : "SettingRenderer@contentbox"
},
{
- class : "contentbox.models.content.renderers.MarkdownRenderer",
- name : "MarkdownRenderer@contentbox"
+ class: "contentbox.models.content.renderers.MarkdownRenderer",
+ name : "MarkdownRenderer@contentbox"
}
];
// Manual Mappings
// binder.map( "customFieldService@contentbox" ).toDSL( "entityService:cbCustomField" );
- binder.map( "SystemUtil@contentbox" ).to( "coldbox.system.core.util.Util" );
+ variables
+ .binder
+ .map( "SystemUtil@contentbox" )
+ .to( "coldbox.system.core.util.Util" );
}
/**
* Development tier
*/
- function development(){
+ function development() {
+
}
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
// Create `cb` alias : REMOVE BY CONTENTBOX NEXT MAJOR VERSION
binder.mapDirectory( packagePath = "contentbox.models", namespace = "@cb" );
var settingService = wirebox.getInstance( "settingService@contentbox" );
@@ -156,20 +154,19 @@ component {
if ( !diskService.has( "contentbox" ) ) {
diskService.register(
- "contentbox",
- "Local",
- {
- path : expandPath( settingService.getSetting( "cb_media_directoryRoot" ) ),
- diskUrl : function(){
- return variables.wirebox
- .getInstance( "CBHelper@contentBox" )
- .site()
- .getSiteRoot()
- &
- "/modules_app/contentbox-custom/_content"
+ "contentbox",
+ "Local",
+ {
+ path : expandPath( settingService.getSetting( "cb_media_directoryRoot" ) ),
+ diskUrl: function() {
+ return variables
+ .wirebox
+ .getInstance( "CBHelper@contentBox" )
+ .site()
+ .getSiteRoot() & "/modules_app/contentbox-custom/_content";
+ }
}
- }
- );
+ );
}
// Startup the ContentBox modules, if any
@@ -179,7 +176,8 @@ component {
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
+
}
/************************************** APP LISTENERS *********************************************/
@@ -188,20 +186,19 @@ component {
* Listen to when application and all modules are fully loaded.
* We use this interception to startup some services and discoveries.
*/
- function afterConfigurationLoad( event, data, rc, prc ){
+ function afterConfigurationLoad( event, data, rc, prc ) {
// Discover all widgets
wirebox.getInstance( "widgetservice@contentbox" ).getWidgets();
}
-
/************************************** PRIVATE *********************************************/
/**
* Verify the custom module exists. If not, we will auto-generate one to avoid conflicts
* and issues with new custom approaches.
*/
- private function verifyCustomModule(){
- var appPath = controller.getSetting( "ApplicationPath" );
+ private function verifyCustomModule() {
+ var appPath = controller.getSetting( "ApplicationPath" );
var customModulesPath = appPath & "modules_app/contentbox-custom";
// Verify modules_app: just in case
@@ -223,4 +220,4 @@ component {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/config/Scheduler.cfc b/modules/contentbox/config/Scheduler.cfc
index edb2c171db..faa9492cfc 100644
--- a/modules/contentbox/config/Scheduler.cfc
+++ b/modules/contentbox/config/Scheduler.cfc
@@ -3,7 +3,7 @@ component {
/**
* Configure the ColdBox Scheduler
*/
- function configure(){
+ function configure() {
/**
* --------------------------------------------------------------------------
* Configuration Methods
@@ -13,8 +13,6 @@ component {
* - setExecutor( executorObject ) : change the executor if needed
*/
-
-
/**
* --------------------------------------------------------------------------
* Register Scheduled Tasks
@@ -25,58 +23,61 @@ component {
// Rotates the login audit logs
task( "login-tracker-rotation" )
- .call( () => {
- getInstance( "LoginTrackerService@contentbox" ).rotate();
- } )
+ .call(
+ () => {
+ getInstance( "LoginTrackerService@contentbox" ).rotate();
+ }
+ )
.everyHour()
.delay( 1, "hours" )
.onOneServer();
- ;
// Deletes all moderated comments that have expired in the inbox
task( "comment-expirations" )
- .call( () => {
- getInstance( "siteService@contentbox" )
- .getAll()
- .each( function( thisSite ){
- var commentExpirationDays = getInstance( "settingService@contentbox" ).getSiteSetting(
- arguments.thisSite.getSlug(),
- "cb_comments_moderation_expiration"
+ .call(
+ () => {
+ getInstance( "siteService@contentbox" ).getAll().each(
+ function( thisSite ) {
+ var commentExpirationDays = getInstance( "settingService@contentbox" ).getSiteSetting( arguments.thisSite.getSlug(),
+ "cb_comments_moderation_expiration" );
+
+ if ( commentExpirationDays > 0 ) {
+ log.info(
+ "Starting to expire comments on site: #arguments.thisSite.getSlug()#..."
+ );
+
+ getInstance( "commentService@contentbox" ).deleteUnApproved( expirationDays = commentExpirationDays );
+
+ log.info(
+ "Moderated comments expired for site (#arguments.thisSite.getSlug()#) using (#commentExpirationDays#) days for expiration!"
+ );
+ } else {
+ log.info(
+ "Comment expiration not enabled for site (#arguments.thisSite.getSlug()#), skipping."
+ );
+ }
+ }
);
-
- if ( commentExpirationDays > 0 ) {
- 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(
- expirationDays = commentExpirationDays
- );
-
- log.info(
- "Moderated comments expired for site (#arguments.thisSite.getSlug()#) using (#commentExpirationDays#) days for expiration!"
- );
- } else {
- log.info(
- "Comment expiration not enabled for site (#arguments.thisSite.getSlug()#), skipping."
- );
- }
- } );
- } )
+ }
+ )
.everyHour()
.delay( 1, "hours" )
+ // now we have the green light to find and kill any old, moderated comments
+
.onOneServer();
}
/**
* Called before the scheduler is going to be shutdown
*/
- function onShutdown(){
+ function onShutdown() {
+
}
/**
* Called after the scheduler has registered all schedules
*/
- function onStartup(){
+ function onStartup() {
log.info( "√ ContentBox Core Scheduler started successfully!" );
}
@@ -86,11 +87,11 @@ component {
* @task The task that got executed
* @exception The ColdFusion exception object
*/
- function onAnyTaskError( required task, required exception ){
+ function onAnyTaskError( required task, required exception ) {
log.error(
- "The task (#arguments.task.getname()#) failed to executed. Caused by: #exception.message & exception.detail#",
- exception.stacktrace
- );
+ "The task (#arguments.task.getname()#) failed to executed. Caused by: #exception.message & exception.detail#",
+ exception.stacktrace
+ );
}
/**
@@ -99,11 +100,11 @@ component {
* @task The task that got executed
* @result The result (if any) that the task produced
*/
- function onAnyTaskSuccess( required task, result ){
+ function onAnyTaskSuccess( required task, result ) {
log.info(
- "Task (#arguments.task.getName()#) completed succesfully in #arguments.task.getStats().lastExecutionTime# ms",
- arguments.task.getStats()
- );
+ "Task (#arguments.task.getName()#) completed succesfully in #arguments.task.getStats().lastExecutionTime# ms",
+ arguments.task.getStats()
+ );
}
/**
@@ -111,8 +112,10 @@ component {
*
* @task The task about to be executed
*/
- function beforeAnyTask( required task ){
- log.info( "Starting to execute task (#arguments.task.getName()#)..." );
+ function beforeAnyTask( required task ) {
+ log.info(
+ "Starting to execute task (#arguments.task.getName()#)..."
+ );
}
/**
@@ -121,7 +124,8 @@ component {
* @task The task that got executed
* @result The result (if any) that the task produced
*/
- function afterAnyTask( required task, result ){
+ function afterAnyTask( required task, result ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2020_01_01_150933_init.cfc b/modules/contentbox/migrations/2020_01_01_150933_init.cfc
index b0dbd863c0..44cbff231c 100755
--- a/modules/contentbox/migrations/2020_01_01_150933_init.cfc
+++ b/modules/contentbox/migrations/2020_01_01_150933_init.cfc
@@ -2,80 +2,88 @@
* This migration is to migrate ContentBox v4 databases to v5 standards.
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
- include template = "./util/MigrationUtils.cfm";
+ include template="./util/MigrationUtils.cfm";
- function up( schema, query ){
+ function up( schema, query ) {
// In order of dependency
var migrations = [
- "sites" : { table : "cb_site" },
- "settings" : { table : "cb_setting" },
- "permissions" : { table : "cb_permission" },
- "permission_groups" : { table : "cb_permissionGroup" },
- "group_permissions" : { table : "cb_groupPermissions" },
- "roles" : { table : "cb_role" },
- "role_permissions" : { table : "cb_rolePermissions" },
- "author" : { table : "cb_author" },
- "author_permissions" : { table : "cb_authorPermissions" },
- "author_permission_groups": { table : "cb_authorPermissionGroups" },
- "category" : { table : "cb_category" },
- "content" : { table : "cb_content" },
- "content_versions" : { table : "cb_contentVersion" },
- "content_categories" : { table : "cb_contentCategories" },
- "contentStore" : { table : "cb_contentStore" },
- "entry" : { table : "cb_entry" },
- "page" : { table : "cb_page" },
- "stats" : { table : "cb_stats" },
- "related_content" : { table : "cb_relatedContent" },
- "content_templates" : { table : "cb_contentTemplate" },
- "comments" : { table : "cb_comment" },
- "custom_fields" : { table : "cb_customfield" },
- "login_attempts" : { table : "cb_loginAttempts" },
- "menus" : { table : "cb_menu" },
- "menu_items" : { table : "cb_menuItem" },
- "modules" : { table : "cb_module" },
- "relocations" : { table : "cb_relocations" },
- "security_rules" : { table : "cb_securityRule" },
- "subscribers" : { table : "cb_subscribers" },
- "subscriptions" : { table : "cb_subscriptions" },
- "comment_subscriptions" : { table : "cb_commentSubscriptions" },
- "security_logs" : { table : "cbsecurity_logs" },
- "jwt" : { table : "cb_jwt" }
+ "sites" : { table: "cb_site" },
+ "settings" : { table: "cb_setting" },
+ "permissions" : { table: "cb_permission" },
+ "permission_groups" : { table: "cb_permissionGroup" },
+ "group_permissions" : { table: "cb_groupPermissions" },
+ "roles" : { table: "cb_role" },
+ "role_permissions" : { table: "cb_rolePermissions" },
+ "author" : { table: "cb_author" },
+ "author_permissions" : { table: "cb_authorPermissions" },
+ "author_permission_groups": { table: "cb_authorPermissionGroups" },
+ "category" : { table: "cb_category" },
+ "content" : { table: "cb_content" },
+ "content_versions" : { table: "cb_contentVersion" },
+ "content_categories" : { table: "cb_contentCategories" },
+ "contentStore" : { table: "cb_contentStore" },
+ "entry" : { table: "cb_entry" },
+ "page" : { table: "cb_page" },
+ "stats" : { table: "cb_stats" },
+ "related_content" : { table: "cb_relatedContent" },
+ "content_templates" : { table: "cb_contentTemplate" },
+ "comments" : { table: "cb_comment" },
+ "custom_fields" : { table: "cb_customfield" },
+ "login_attempts" : { table: "cb_loginAttempts" },
+ "menus" : { table: "cb_menu" },
+ "menu_items" : { table: "cb_menuItem" },
+ "modules" : { table: "cb_module" },
+ "relocations" : { table: "cb_relocations" },
+ "security_rules" : { table: "cb_securityRule" },
+ "subscribers" : { table: "cb_subscribers" },
+ "subscriptions" : { table: "cb_subscriptions" },
+ "comment_subscriptions" : { table: "cb_commentSubscriptions" },
+ "security_logs" : { table: "cbsecurity_logs" },
+ "jwt" : { table: "cb_jwt" }
];
- systemOutput( "Starting to initialize the ContentBox Database, this will take a while...", true );
+ systemOutput(
+ "Starting to initialize the ContentBox Database, this will take a while...",
+ true
+ );
- migrations.each( ( migration, record ) => {
- systemOutput( "Migrating [#migration#]...", true );
+ migrations.each(
+ ( migration, record ) => {
+ systemOutput( "Migrating [#migration#]...", true );
- if ( !schema.hasTable( record.table ) ) {
- systemOutput( "- Table doesn't exist (#record.table#) creating it...", true );
- new "init.create_#migration#"( ).up( schema, query );
+ if ( !schema.hasTable( record.table ) ) {
+ systemOutput(
+ "- Table doesn't exist (#record.table#) creating it...",
+ true
+ );
+ new "init.create_#migration#"().up( schema, query );
- // Seeding Permissions
- if ( migration == "permissions" ) {
- systemOutput( "- Seeding permissions...", true );
- new init.seed_permissions().seed( schema, query );
- }
+ if ( migration == "permissions" ) {
+ systemOutput( "- Seeding permissions...", true );
+ new init.seed_permissions().seed( schema, query );
+ }
- // Seeding Roles
- if ( migration == "role_permissions" ) {
- systemOutput( "- Seeding roles...", true );
- new init.seed_roles().seed( schema, query );
+ if ( migration == "role_permissions" ) {
+ systemOutput( "- Seeding roles...", true );
+ new init.seed_roles().seed( schema, query );
+ }
+ } else {
+ systemOutput(
+ "√ Table (#record.table#) already exists, skipping...",
+ true
+ );
+ }
}
- } else {
- systemOutput( "√ Table (#record.table#) already exists, skipping...", true );
- }
- } );
+ );
systemOutput( "√ Database structure complete", true );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc
index 4346c7849f..03e6b0a28e 100755
--- a/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc
+++ b/modules/contentbox/migrations/2020_08_24_150933_v5Upgrade.cfc
@@ -2,41 +2,21 @@
* This migration is to migrate ContentBox v4 databases to v5 standards.
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- variables.today = now();
- variables.siteTables = [
- "cb_category",
- "cb_content",
- "cb_menu",
- "cb_setting"
- ];
+ variables.today = now();
+ variables.siteTables = [ "cb_category", "cb_content", "cb_menu", "cb_setting"];
variables.newPermissions = [
{
- name : "SITES_ADMIN",
- description : "Ability to manage sites"
+ name : "SITES_ADMIN",
+ description: "Ability to manage sites"
}
];
- private function isContentBox4(){
- 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 ){
+ 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() ) {
@@ -49,13 +29,13 @@ component {
// Get the db schema name, we might need it when dropping keys
variables.dbSchema = migrationService.getSchema();
- variables.uuidLib = createObject( "java", "java.util.UUID" );
+ variables.uuidLib = createObject( "java", "java.util.UUID" );
scopeGrammarUDFs( argumentCollection = arguments );
try {
migrateIdentifiersToGUIDs( argumentCollection = arguments );
- } catch ( any e ) {
+ } catch (any e) {
systemOutput( e.message, true );
systemOutput( e.stacktrace, true );
transactionRollback();
@@ -79,24 +59,31 @@ component {
// Update Slugs/Titles to 1000 characters
dropIndexesForTableColumn( "cb_content", "title" );
dropIndexesForTableColumn( "cb_content", "slug" );
- 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 ).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" );
- } );
+ 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 ).nullable() );
+ table.modifyColumn( "featuredImageURL",
+ table.string( "featuredImageURL", 500 ).nullable() );
+
+ 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" );
- } );
+ schema.alter(
+ "cb_category",
+ ( table ) => {
+ table.addColumn( table.boolean( "isPublic" ).default( true ) );
+ table.index( [ "isPublic"], "idx_isPublic" );
+ }
+ );
}
- } catch ( any e ) {
+ } catch (any e) {
transactionRollback();
systemOutput( e.stacktrace, true );
rethrow;
@@ -104,321 +91,100 @@ component {
}
}
- function down( schema, query ){
+ function down( schema, query ) {
if ( !isContentBox4() ) {
return;
}
// Remove Site Relationships
- variables.siteTables.each( ( thisTable ) => {
- schema.alter( thisTable, ( table ) => {
- table.dropColumn( "FK_siteID" );
- } );
- systemOutput( "√ - Removed site relationship to '#thisTable#'", true );
- } );
+ variables.siteTables.each(
+ ( thisTable ) => {
+ schema.alter(
+ thisTable,
+ ( table ) => {
+ table.dropColumn( "FK_siteID" );
+ }
+ );
+ systemOutput( "√ - Removed site relationship to '#thisTable#'", true );
+ }
+ );
// Remove Site Table
arguments.schema.drop( "cb_site" );
// Remove permissions
- arguments.query
+ arguments
+ .query
.newQuery()
.from( "cb_permission" )
.where( "permission", "SITES_ADMIN" )
.delete();
}
- /********************* MIGRATION UPDATES *************************/
-
- private function removeUniqueConstraints( schema, query ){
- // Remove Setting Name Unique Constraint
- dropIndexesForTableColumn( "cb_setting", "name" );
- systemOutput( "√ - Setting name unique constraint dropped", true );
-
- // Remove Content Unique Constraint
- dropIndexesForTableColumn( "cb_content", "slug" );
- systemOutput( "√ - Content slug unique constraint dropped", true );
-
- // Remove category unique constraint
- dropIndexesForTableColumn( "cb_category", "slug" );
- systemOutput( "√ - Content Category slug unique constraint dropped", true );
-
- // Remove menu unique constraint
- dropIndexesForTableColumn( "cb_menu", "slug" );
- systemOutput( "√ - Menu slug unique constraint dropped", true );
- }
-
- private function createSiteRelationships( schema, query, siteId ){
- variables.siteTables.each( ( thisTable ) => {
- if ( !hasColumn( thisTable, "FK_siteID" ) ) {
- // Add site id relationship
- schema.alter( thisTable, ( table ) => {
- table.addColumn( table.string( "FK_siteID", 36 ).nullable() );
- table.addConstraint(
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" )
- .onDelete( "CASCADE" )
- );
- } );
- systemOutput( "√ - Created site column on '#thisTable#'", true );
- } else {
- systemOutput( "! - Skipped creating site column on '#thisTable#', it already had one", true );
- }
-
- // Seed with site id
- if ( thisTable != "cb_setting" ) {
- query
- .newQuery()
- .from( thisTable )
- .whereNull( "FK_siteID" )
- .update( { "FK_siteID" : siteId } );
-
- systemOutput( "√ - Populated '#thisTable#' with default site data", true );
- }
- } );
- }
-
- /**
- * Updates the admin with newer permissions
- */
- private function updateAdminPermissions( schema, query ){
- var admin = arguments.query
- .newQuery()
- .select( "roleID" )
- .from( "cb_role" )
- .where( "role", "Administrator" )
- .first();
-
- var siteAdmin = arguments.query
- .newQuery()
- .select( "permissionID" )
- .from( "cb_permission" )
- .where( "permission", "SITES_ADMIN" )
- .first();
-
- var sitePermissionFound = !arguments.query
- .newQuery()
- .select( "FK_permissionID" )
- .from( "cb_rolePermissions" )
- .where( "FK_permissionID", siteAdmin.permissionID )
- .first()
- .isEmpty();
-
- if ( !sitePermissionFound ) {
- arguments.query
- .newQuery()
- .from( "cb_rolePermissions" )
- .insert( {
- "FK_roleID" : admin.roleID,
- "FK_permissionID" : siteAdmin.permissionID
- } );
- systemOutput( "√ - Admin role updated with new permissions", true );
- } else {
- systemOutput( "√ - Admin role already has the new permissions, skipping", true );
- }
- }
-
- /**
- * Creates the new permissions
- */
- private function createPermissions( schema, query ){
- variables.newPermissions.each( ( thisPermission ) => {
- var isNewPermission = query
- .newQuery()
- .select( "permissionID" )
- .from( "cb_permission" )
- .where( "permission", thisPermission.name )
- .first()
- .isEmpty();
-
- if ( !isNewPermission ) {
- systemOutput( "√ - #thisPermission.name# permission already in database skipping", true );
- return;
- }
-
- query
- .newQuery()
- .from( "cb_permission" )
- .insert( {
- "permissionID" : uuidLib.randomUUID().toString(),
- "createdDate" : today,
- "modifiedDate" : today,
- "isDeleted" : 0,
- "permission" : thisPermission.name,
- "description" : thisPermission.description
- } );
- systemOutput( "√ - #thisPermission.name# permission created", true );
- } );
- }
-
- /**
- * Create multi-site support
- */
- private function createDefaultSite( schema, query ){
- // Create the site table
- arguments.schema.create( "cb_site", ( table ) => {
- table.string( "siteID", 36 ).primaryKey();
- table.dateTime( "createdDate" );
- table.dateTime( "modifiedDate" );
- table.boolean( "isDeleted" ).default( false );
- table.string( "name" );
- table.string( "slug" ).unique();
- table.longText( "description" ).nullable();
- table.string( "domainRegex" ).nullable();
- table.string( "keywords" ).nullable();
- table.string( "tagline" ).nullable();
- table.string( "homepage" ).nullable();
- table.boolean( "isBlogEnabled" ).default( true );
- table.boolean( "isSitemapEnabled" ).default( true );
- table.boolean( "poweredByHeader" ).default( true );
- table.boolean( "adminBar" ).default( true );
- table.boolean( "isSSL" ).default( false );
- table.string( "activeTheme" ).nullable();
- table.longText( "notificationEmails" ).nullable();
- table.boolean( "notifyOnEntries" ).default( true );
- table.boolean( "notifyOnPages" ).default( true );
- table.boolean( "notifyOnContentStore" ).default( true );
- table.string( "domain" ).nullable();
- table.boolean( "isActive" ).default( true );
- } );
- systemOutput( "√ - Site table created", true );
-
- schema.alter( "cb_setting", function( table ){
- table.addColumn( table.string( "FK_siteID", 36 ).nullable() );
- table.addConstraint(
- table
- .string( "FK_siteID", 36 )
- .references( "siteID" )
- .onTable( "cb_site" )
- );
- } );
-
- var allSettings = arguments.query
- .newQuery()
- .from( "cb_setting" )
- .whereNull( "FK_siteID" )
- .get()
- .reduce( ( results, thisSetting ) => {
- results[ thisSetting.name ] = thisSetting.value;
- return results;
- }, {} );
-
- var initialSiteIdentifier = uuidLib.randomUUID().toString();
- arguments.query
- .newQuery()
- .from( "cb_site" )
- .insert( {
- "siteID" : initialSiteIdentifier,
- "createdDate" : today,
- "modifiedDate" : today,
- "isDeleted" : 0,
- "isActive" : 1,
- "name" : allSettings.cb_site_name,
- "slug" : "default",
- "homepage" : allSettings.cb_site_homepage,
- "description" : allSettings.cb_site_description,
- "keywords" : allSettings.cb_site_keywords,
- "tagline" : allSettings.cb_site_tagline,
- "domainRegex" : "127\.0\.0\.1",
- "isBlogEnabled" : allSettings.cb_site_disable_blog ? 0 : 1,
- "isSitemapEnabled" : allSettings.cb_site_sitemap ? 1 : 0,
- "poweredByHeader" : allSettings.cb_site_poweredby ? 1 : 0,
- "adminBar" : allSettings.cb_site_adminbar ? 1 : 0,
- "isSSL" : allSettings.cb_admin_ssl ? 1 : 0,
- "activeTheme" : allSettings.cb_site_theme,
- "domain" : "127.0.0.1",
- "notificationEmails" : allSettings.cb_site_email
- } );
- systemOutput( "√ - Default site created", true );
-
- var siteSettings = [
- // Global HTML: Panel Section
- "cb_html_beforeHeadEnd",
- "cb_html_afterBodyStart",
- "cb_html_beforeBodyEnd",
- "cb_html_beforeContent",
- "cb_html_afterContent",
- "cb_html_beforeSideBar",
- "cb_html_afterSideBar",
- "cb_html_afterFooter",
- "cb_html_preEntryDisplay",
- "cb_html_postEntryDisplay",
- "cb_html_preIndexDisplay",
- "cb_html_postIndexDisplay",
- "cb_html_preArchivesDisplay",
- "cb_html_postArchivesDisplay",
- "cb_html_preCommentForm",
- "cb_html_postCommentForm",
- "cb_html_prePageDisplay",
- "cb_html_postPageDisplay",
- // Site Comment Settings
- "cb_comments_enabled",
- "cb_comments_maxDisplayChars",
- "cb_comments_notify",
- "cb_comments_moderation_notify",
- "cb_comments_notifyemails",
- "cb_comments_moderation",
- "cb_comments_moderation_whitelist",
- "cb_comments_moderation_blacklist",
- "cb_comments_moderation_blockedlist",
- "cb_comments_moderation_expiration"
- ];
-
- // Assign all null site settings to the default
- query
- .newQuery()
- .from( "cb_setting" )
- .whereIn( "name", siteSettings )
- .update( { "FK_siteID" : initialSiteIdentifier } );
-
- return initialSiteIdentifier;
- }
-
/**
* Migrate numeric IDs to Guids
*/
- function migrateIdentifiersToGUIDs( schema, query ){
- systemOutput( "> Starting to process migration of identifiers to uuid's...", true );
+ 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
+ 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 );
- } );
-
- systemOutput( "√√ - Finalized adding new primary keys to all tables", true );
+ .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
+ );
+ }
+ );
+
+ systemOutput(
+ "√√ - Finalized adding new primary keys to all tables",
+ true
+ );
systemOutput( "", true );
systemOutput( "> Beginning to process child tables...", true );
systemOutput( "", true );
// Create child table foreign and future PKs
- childTables
- .keyArray()
- .each( function( tableName ){
- systemOutput( "> Starting to process child table: #tableName#", true );
+ childTables.keyArray().each(
+ function( tableName ) {
+ systemOutput( "> Starting to process child table: #tableName#", true );
- var pkColumn = childTables[ tableName ].key;
- dropForeignKeysAndConstraints( tableName, pkColumn );
- systemOutput( " √ - (#tableName#) Dropped foreign key and constraints", true );
+ var pkColumn = childTables[ tableName ].key;
+ dropForeignKeysAndConstraints( tableName, pkColumn );
+ systemOutput(
+ " √ - (#tableName#) Dropped foreign key and constraints",
+ true
+ );
- var tmpColumn = "tmp_" & pkColumn;
- schema.alter( tableName, function( table ){
- table.addColumn( table.string( tmpColumn, 36 ).nullable() );
- } );
- populateChildFKValues( tmpColumn, tableName );
- systemOutput( " √ - (#tableName#) rekeyed to new parent uuid", true );
- } );
+ 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 );
+ }
+ );
systemOutput( "√√ - Finalized rekeying all child tables", true );
systemOutput( "", true );
@@ -426,80 +192,120 @@ 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 );
+ FKMap.keyArray().each(
+ function( tableName ) {
systemOutput(
- " √ - (#tableName#) Dropped foreign key and constraints (#arguments.keyConfig.column#)",
+ "> Starting to process (#arguments.tableName#) foreign keys...",
true
);
- var tmpColumn = "tmp_" & arguments.keyConfig.column;
- schema.alter( tableName, function( table ){
- table.addColumn( table.string( tmpColumn, 36 ).nullable() );
- } );
- populateFKValues( tmpColumn, tableName, arguments.keyConfig );
- schema.alter( tableName, function( table ){
- table.dropColumn( keyConfig.column );
- table.renameColumn( tmpColumn, table.string( keyConfig.column, 36 ).nullable() );
- } );
- systemOutput(
- " √ - (#tableName#) foreign key (#arguments.keyConfig.column#) rekeyed as a uuid into (#tmpColumn#)",
- true
- );
- } );
- } );
+ var FKeys = FKMap[ arguments.tableName ];
+ FKeys.each(
+ function( keyConfig ) {
+ dropForeignKeysAndConstraints( tableName, arguments.keyConfig.column );
+ systemOutput(
+ " √ - (#tableName#) Dropped foreign key and constraints (#arguments.keyConfig.column#)",
+ true
+ );
+
+ var tmpColumn = "tmp_" & arguments.keyConfig.column;
+ schema.alter(
+ tableName,
+ function( table ) {
+ table.addColumn( table.string( tmpColumn, 36 ).nullable() );
+ }
+ );
+ populateFKValues(
+ tmpColumn,
+ tableName,
+ arguments.keyConfig
+ );
+ schema.alter(
+ tableName,
+ function( table ) {
+ table.dropColumn( keyConfig.column );
+ table.renameColumn( tmpColumn,
+ table.string( keyConfig.column, 36 ).nullable() );
+ }
+ );
+ 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(
+ "√√ - 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(
+ "> Beginning to drop original primary keys and rekeying tables with new uuids...",
+ true
+ );
systemOutput( "", true );
// Change primary keys over on master tables
- idTables
- .keyArray()
- .each( function( tableName ){
- systemOutput( "> Starting to process (#arguments.tableName#)...", true );
- var pkColumn = idTables[ tableName ];
- schema.alter( tableName, function( table ){
- queryExecute( pkDropSQL( tableName, pkColumn ) );
- table.dropColumn( pkColumn );
- // Rename it back to what it was called
- table.renameColumn( "id", table.string( pkColumn, 36 ).unique() )
- table.addConstraint( table.primaryKey( pkColumn ) );
- } );
- systemOutput( " √ (#arguments.tableName#) new uuid key set and finalized!", true );
- } );
-
- systemOutput( "√√ - Finalized rekeying all tables with new identifiers and old identifiers dropped", true );
+ 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 );
+
+ table.renameColumn( "id", table.string( pkColumn, 36 ).unique() );
+ table.addConstraint( table.primaryKey( pkColumn ) );
+ }
+ );
+ 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 );
- systemOutput( "> Beginning restore all foreign key constraints...", true );
+ systemOutput(
+ "> Beginning restore all foreign key constraints...",
+ true
+ );
systemOutput( "", true );
// Now restore the foreign key constraints
- FKMap
- .keyArray()
- .each( function( tableName ){
- systemOutput( "> Starting to process (#arguments.tableName#)...", true );
- var FKeys = FKMap[ tableName ];
- FKeys.each( function( keyConfig ){
- var tmpColumn = "tmp_" & keyConfig.column;
- schema.alter( tableName, function( table ){
- table.addConstraint(
- table
- .string( keyConfig.column, 36 )
- .references( keyConfig.reference.column )
- .onTable( keyConfig.reference.table )
+ FKMap.keyArray().each(
+ function( tableName ) {
+ systemOutput( "> Starting to process (#arguments.tableName#)...", true );
+ var FKeys = FKMap[ tableName ];
+ FKeys.each(
+ function( keyConfig ) {
+ var tmpColumn = "tmp_" & keyConfig.column;
+ schema.alter(
+ tableName,
+ function( table ) {
+ table.addConstraint( table
+ .string( keyConfig.column, 36 )
+ .references( keyConfig.reference.column )
+ .onTable( keyConfig.reference.table ) );
+ }
+ );
+ }
);
- } );
- } );
- systemOutput( " √ (#arguments.tableName#) foreign key constraints finalized!", true );
- } );
+ systemOutput(
+ " √ (#arguments.tableName#) foreign key constraints finalized!",
+ true
+ );
+ }
+ );
systemOutput( "√√ - All foreign key constraints finalized", true );
systemOutput( "", true );
@@ -507,36 +313,52 @@ component {
systemOutput( "", true );
// Change primary keys over on child tables
- childTables
- .keyArray()
- .each( function( tableName ){
- systemOutput( "> Processing child table (#arguments.tableName#)...", true );
- var pkColumn = childTables[ tableName ].key;
- var tmpColumn = "tmp_" & pkColumn;
- schema.alter( tableName, function( table ){
- queryExecute( pkDropSQL( tableName, pkColumn ) );
- // ensure it is a not null field before we make it PK
- table.modifyColumn( tmpColumn, table.string( tmpColumn, 36 ) );
- } );
- schema.alter( tableName, function( table ){
- table.addConstraint( table.primaryKey( tmpColumn ) );
- } );
- schema.alter( tableName, function( table ){
- table.dropColumn( pkColumn );
- table.renameColumn( tmpColumn, table.string( pkColumn, 36 ) );
- } );
- schema.alter( tableName, function( table ){
- table.addConstraint(
- table
- .string( pkColumn, 36 )
- .references( pkColumn )
- .onTable( childTables[ tableName ].parent )
+ childTables.keyArray().each(
+ function( tableName ) {
+ systemOutput(
+ "> Processing child table (#arguments.tableName#)...",
+ true
);
- } );
- systemOutput( " √ (#arguments.tableName#) finalized!", true );
- } );
+ var pkColumn = childTables[ tableName ].key;
+ var tmpColumn = "tmp_" & pkColumn;
+ schema.alter(
+ tableName,
+ function( table ) {
+ queryExecute( pkDropSQL( tableName, pkColumn ) );
+
+ 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( "√√√ - All tables migrated from incremental identifiers to GUIDs", true );
+ systemOutput(
+ "√√√ - All tables migrated from incremental identifiers to GUIDs",
+ true
+ );
systemOutput( "", true );
systemOutput( "", true );
}
@@ -544,166 +366,166 @@ component {
/**
* Utility functions per database
*/
- function scopeGrammarUDFs( query, schema ){
+ 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_permissionGroup" : "permissionGroupID",
- "cb_role" : "roleID",
- "cb_securityRule" : "ruleID",
- "cb_setting" : "settingID",
- "cb_stats" : "statsID",
- "cb_subscribers" : "subscriberID",
- "cb_subscriptions" : "subscriptionID"
+ "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"
};
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" : [
+ "cb_authorPermissionGroups": [
{
- "column" : "FK_permissionGroupID",
- "reference" : {
- "table" : "cb_permissionGroup",
- "column" : "permissionGroupID"
+ "column" : "FK_permissionGroupID",
+ "reference": {
+ "table" : "cb_permissionGroup",
+ "column": "permissionGroupID"
}
},
{
- "column" : "FK_authorID",
- "reference" : { "table" : "cb_author", "column" : "authorID" }
+ "column" : "FK_authorID",
+ "reference": { "table": "cb_author", "column": "authorID" }
}
],
- "cb_authorPermissions" : [
+ "cb_authorPermissions": [
{
- "column" : "FK_permissionID",
- "reference" : { "table" : "cb_permission", "column" : "permissionID" }
+ "column" : "FK_permissionID",
+ "reference": { "table": "cb_permission", "column": "permissionID" }
},
{
- "column" : "FK_authorID",
- "reference" : { "table" : "cb_author", "column" : "authorID" }
+ "column" : "FK_authorID",
+ "reference": { "table": "cb_author", "column": "authorID" }
}
],
- "cb_rolePermissions" : [
+ "cb_rolePermissions": [
{
- "column" : "FK_permissionID",
- "reference" : { "table" : "cb_permission", "column" : "permissionID" }
+ "column" : "FK_permissionID",
+ "reference": { "table": "cb_permission", "column": "permissionID" }
},
{
- "column" : "FK_roleID",
- "reference" : { "table" : "cb_role", "column" : "roleID" }
+ "column" : "FK_roleID",
+ "reference": { "table": "cb_role", "column": "roleID" }
}
],
- "cb_relatedContent" : [
+ "cb_relatedContent": [
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
},
{
- "column" : "FK_relatedContentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_relatedContentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_groupPermissions" : [
+ "cb_groupPermissions": [
{
- "column" : "FK_permissionGroupID",
- "reference" : {
- "table" : "cb_permissionGroup",
- "column" : "permissionGroupID"
+ "column" : "FK_permissionGroupID",
+ "reference": {
+ "table" : "cb_permissionGroup",
+ "column": "permissionGroupID"
}
},
{
- "column" : "FK_permissionID",
- "reference" : { "table" : "cb_permission", "column" : "permissionID" }
+ "column" : "FK_permissionID",
+ "reference": { "table": "cb_permission", "column": "permissionID" }
}
],
- "cb_contentCategories" : [
+ "cb_contentCategories": [
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
},
{
- "column" : "FK_categoryID",
- "reference" : { "table" : "cb_category", "column" : "categoryID" }
+ "column" : "FK_categoryID",
+ "reference": { "table": "cb_category", "column": "categoryID" }
}
],
- "cb_commentSubscriptions" : [
+ "cb_commentSubscriptions": [
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_author" : [
+ "cb_author": [
{
- "column" : "FK_roleID",
- "reference" : { "table" : "cb_role", "column" : "roleID" }
+ "column" : "FK_roleID",
+ "reference": { "table": "cb_role", "column": "roleID" }
}
],
- "cb_menuItem" : [
+ "cb_menuItem": [
{
- "column" : "FK_menuID",
- "reference" : { "table" : "cb_menu", "column" : "menuID" }
+ "column" : "FK_menuID",
+ "reference": { "table": "cb_menu", "column": "menuID" }
},
{
- "column" : "FK_parentID",
- "reference" : { "table" : "cb_menuItem", "column" : "menuItemID" }
+ "column" : "FK_parentID",
+ "reference": { "table": "cb_menuItem", "column": "menuItemID" }
}
],
- "cb_customField" : [
+ "cb_customField": [
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_stats" : [
+ "cb_stats": [
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_comment" : [
+ "cb_comment": [
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_content" : [
+ "cb_content": [
{
- "column" : "FK_authorID",
- "reference" : { "table" : "cb_author", "column" : "authorID" }
+ "column" : "FK_authorID",
+ "reference": { "table": "cb_author", "column": "authorID" }
},
{
- "column" : "FK_parentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_parentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_contentVersion" : [
+ "cb_contentVersion": [
{
- "column" : "FK_authorID",
- "reference" : { "table" : "cb_author", "column" : "authorID" }
+ "column" : "FK_authorID",
+ "reference": { "table": "cb_author", "column": "authorID" }
},
{
- "column" : "FK_contentID",
- "reference" : { "table" : "cb_content", "column" : "contentID" }
+ "column" : "FK_contentID",
+ "reference": { "table": "cb_content", "column": "contentID" }
}
],
- "cb_subscriptions" : [
+ "cb_subscriptions": [
{
- "column" : "FK_subscriberID",
- "reference" : { "table" : "cb_subscribers", "column" : "subscriberID" }
+ "column" : "FK_subscriberID",
+ "reference": { "table": "cb_subscribers", "column": "subscriberID" }
}
]
};
@@ -715,19 +537,25 @@ component {
switch ( listLast( getMetadata( grammar ).name, "." ) ) {
case "MySQLGrammar": {
- variables.guidFn = "UUID()";
- variables.populateFKValues = function( tmpColumn, tableName, keyConfig ){
+ variables.guidFn = "UUID()";
+ variables.populateFKValues = function( tmpColumn, tableName, keyConfig ) {
queryExecute(
"
UPDATE #arguments.tableName# as target
- JOIN #arguments.keyConfig.reference.table# as ref
- ON target.#arguments.keyConfig.column# = ref.#arguments.keyConfig.reference.column#
+ 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 ){
+ variables.populateChildFKValues = function( tmpColumn, tableName ) {
queryExecute(
"
UPDATE #arguments.tableName#
@@ -739,95 +567,133 @@ component {
);
};
- variables.pkDropSQL = function( tableName, pkColumn ){
+ 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" ] )
+ .select( [ "CONSTRAINT_NAME"] )
.from( "INFORMATION_SCHEMA.KEY_COLUMN_USAGE" )
.where( "TABLE_NAME", tableName )
.where( "COLUMN_NAME", columnName )
- .where( "CONSTRAINT_NAME", "!=", "PRIMARY" )
+ .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#" );
- } );
+ .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" ] )
+ .select( [ "INDEX_NAME"] )
.from( "INFORMATION_SCHEMA.STATISTICS" )
.where( "TABLE_NAME", tableName )
.where( "COLUMN_NAME", columnName )
- .where( "INDEX_NAME", "!=", "PRIMARY" )
+ .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 );
- } );
- } );
+ .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" ] )
+ .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(
+ "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#" );
- } );
+ .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 ){
+ variables.dropIndexesForTableColumn = function( tableName, columnName ) {
query
.newQuery()
- .select( [ "INDEX_NAME" ] )
+ .select( [ "INDEX_NAME"] )
.from( "INFORMATION_SCHEMA.STATISTICS" )
.where( "TABLE_NAME", tableName )
.where( "COLUMN_NAME", columnName )
- .where( "INDEX_NAME", "!=", "PRIMARY" )
+ .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 );
- } );
- } );
- }
+ .map( function( row ) {
+ return row.index_name;
+ } )
+ .each(
+ function( indexName ) {
+ schema.alter(
+ tableName,
+ function( table ) {
+ table.dropConstraint( indexName );
+ }
+ );
+ }
+ );
+ };
break;
}
case "SqlServerGrammar": {
- variables.guidFn = "NEWID()";
- variables.pkDropSQL = function( tableName ){
+ variables.guidFn = "NEWID()";
+ variables.pkDropSQL = function( tableName ) {
var constraintName = queryExecute(
"SELECT name
FROM sys.key_constraints
@@ -835,20 +701,26 @@ component {
).name;
return "ALTER TABLE #tableName# DROP CONSTRAINT #constraintName#";
- }
- variables.populateFKValues = function( tmpColumn, tableName, keyConfig ){
+ };
+ variables.populateFKValues = function( tmpColumn, tableName, keyConfig ) {
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#
+ JOIN #arguments
+ .keyConfig
+ .reference
+ .table# as ref
+ ON target.#arguments.keyConfig.column# = ref.#arguments
+ .keyConfig
+ .reference
+ .column#
"
);
};
- variables.populateChildFKValues = function( tmpColumn, tableName ){
+ variables.populateChildFKValues = function( tmpColumn, tableName ) {
queryExecute(
"
UPDATE #arguments.tableName#
@@ -861,10 +733,10 @@ component {
);
};
- variables.dropForeignKeysAndConstraints = function( tableName, columnName, dropReferenced = true ){
+ variables.dropForeignKeysAndConstraints = function( tableName, columnName, dropReferenced = true ) {
query
.newQuery()
- .select( [ "sys.foreign_keys.name" ] )
+ .select( [ "sys.foreign_keys.name"] )
.from( "sys.foreign_keys" )
.join(
"sys.foreign_key_columns",
@@ -876,21 +748,27 @@ component {
"sys.tables.OBJECT_ID",
"sys.foreign_keys.referenced_object_id"
)
- .whereRaw( "OBJECT_NAME( sys.foreign_keys.parent_object_id ) = '#tableName#'" )
+ .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#" );
- } );
+ .map( function( row ) {
+ return row.name;
+ } )
+ .each(
+ function( constraintName ) {
+ queryExecute(
+ "ALTER TABLE #tableName# DROP CONSTRAINT #constraintName#"
+ );
+ }
+ );
query
.newQuery()
- .select( [ "name" ] )
+ .select( [ "name"] )
.from( "sys.indexes" )
.join(
"sys.index_columns",
@@ -902,14 +780,18 @@ component {
"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#"
- );
- } );
+ .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 ) ) {
@@ -929,24 +811,32 @@ component {
"sys.tables.OBJECT_ID",
"sys.foreign_keys.referenced_object_id"
)
- .whereRaw( "OBJECT_NAME (sys.foreign_keys.referenced_object_id) = '#tableName#'" )
+ .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#" );
- } );
+ .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 ){
+ variables.dropIndexesForTableColumn = function( tableName, columnName ) {
query
.newQuery()
- .select( [ "name" ] )
+ .select( [ "name"] )
.from( "sys.indexes" )
.join(
"sys.index_columns",
@@ -958,23 +848,27 @@ component {
"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#" );
+ .map( function( row ) {
+ return row.name;
+ } )
+ .each(
+ function( indexName ) {
+ try {
+ queryExecute( "ALTER TABLE #tableName# DROP CONSTRAINT #indexName#" );
+ } catch (any e) {
+ queryExecute( "DROP INDEX #indexName# on #tableName#" );
+ }
}
- } );
- }
+ );
+ };
break;
}
case "PostgresGrammar":
+
case "OracleGrammar": {
- throw( "Database Migrations from ContentBox v4 to v5 are not supported for this DBMS platform" );
+ throw(
+ "Database Migrations from ContentBox v4 to v5 are not supported for this DBMS platform"
+ );
}
default: {
throw(
@@ -984,4 +878,302 @@ component {
}
}
-}
+ private function isContentBox4() {
+ 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;
+ }
+ }
+ }
+
+ /********************* MIGRATION UPDATES *************************/
+
+ private function removeUniqueConstraints( schema, query ) {
+ // Remove Setting Name Unique Constraint
+ dropIndexesForTableColumn( "cb_setting", "name" );
+ systemOutput( "√ - Setting name unique constraint dropped", true );
+
+ // Remove Content Unique Constraint
+ dropIndexesForTableColumn( "cb_content", "slug" );
+ systemOutput( "√ - Content slug unique constraint dropped", true );
+
+ // Remove category unique constraint
+ dropIndexesForTableColumn( "cb_category", "slug" );
+ systemOutput(
+ "√ - Content Category slug unique constraint dropped",
+ true
+ );
+
+ // Remove menu unique constraint
+ dropIndexesForTableColumn( "cb_menu", "slug" );
+ systemOutput( "√ - Menu slug unique constraint dropped", true );
+ }
+
+ private function createSiteRelationships( schema, query, siteId ) {
+ variables.siteTables.each(
+ ( thisTable ) => {
+ if ( !hasColumn( thisTable, "FK_siteID" ) ) {
+ schema.alter(
+ thisTable,
+ ( table ) => {
+ table.addColumn( table.string( "FK_siteID", 36 ).nullable() );
+ table.addConstraint( table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" )
+ .onDelete( "CASCADE" ) );
+ }
+ );
+ systemOutput( "√ - Created site column on '#thisTable#'", true );
+ } else {
+ systemOutput(
+ "! - Skipped creating site column on '#thisTable#', it already had one",
+ true
+ );
+ }
+
+ if ( thisTable != "cb_setting" ) {
+ query
+ .newQuery()
+ .from( thisTable )
+ .whereNull( "FK_siteID" )
+ .update( { "FK_siteID": siteId } );
+
+ systemOutput(
+ "√ - Populated '#thisTable#' with default site data",
+ true
+ );
+ }
+ }
+ );
+ }
+
+ /**
+ * Updates the admin with newer permissions
+ */
+ private function updateAdminPermissions( schema, query ) {
+ var admin = arguments
+ .query
+ .newQuery()
+ .select( "roleID" )
+ .from( "cb_role" )
+ .where( "role", "Administrator" )
+ .first();
+
+ var siteAdmin = arguments
+ .query
+ .newQuery()
+ .select( "permissionID" )
+ .from( "cb_permission" )
+ .where( "permission", "SITES_ADMIN" )
+ .first();
+
+ var sitePermissionFound = !arguments
+ .query
+ .newQuery()
+ .select( "FK_permissionID" )
+ .from( "cb_rolePermissions" )
+ .where( "FK_permissionID", siteAdmin.permissionID )
+ .first()
+ .isEmpty();
+
+ if ( !sitePermissionFound ) {
+ arguments
+ .query
+ .newQuery()
+ .from( "cb_rolePermissions" )
+ .insert(
+ {
+ "FK_roleID" : admin.roleID,
+ "FK_permissionID": siteAdmin.permissionID
+ }
+ );
+ systemOutput( "√ - Admin role updated with new permissions", true );
+ } else {
+ systemOutput(
+ "√ - Admin role already has the new permissions, skipping",
+ true
+ );
+ }
+ }
+
+ /**
+ * Creates the new permissions
+ */
+ private function createPermissions( schema, query ) {
+ variables.newPermissions.each(
+ ( thisPermission ) => {
+ var isNewPermission = query
+ .newQuery()
+ .select( "permissionID" )
+ .from( "cb_permission" )
+ .where( "permission", thisPermission.name )
+ .first()
+ .isEmpty();
+
+ if ( !isNewPermission ) {
+ systemOutput(
+ "√ - #thisPermission.name# permission already in database skipping",
+ true
+ );
+ return;
+ }
+
+ query
+ .newQuery()
+ .from( "cb_permission" )
+ .insert(
+ {
+ "permissionID": uuidLib.randomUUID().toString(),
+ "createdDate" : today,
+ "modifiedDate": today,
+ "isDeleted" : 0,
+ "permission" : thisPermission.name,
+ "description" : thisPermission.description
+ }
+ );
+ systemOutput( "√ - #thisPermission.name# permission created", true );
+ }
+ );
+ }
+
+ /**
+ * Create multi-site support
+ */
+ private function createDefaultSite( schema, query ) {
+ // Create the site table
+ arguments.schema.create(
+ "cb_site",
+ ( table ) => {
+ table.string( "siteID", 36 ).primaryKey();
+ table.dateTime( "createdDate" );
+ table.dateTime( "modifiedDate" );
+ table.boolean( "isDeleted" ).default( false );
+ table.string( "name" );
+ table.string( "slug" ).unique();
+ table.longText( "description" ).nullable();
+ table.string( "domainRegex" ).nullable();
+ table.string( "keywords" ).nullable();
+ table.string( "tagline" ).nullable();
+ table.string( "homepage" ).nullable();
+ table.boolean( "isBlogEnabled" ).default( true );
+ table.boolean( "isSitemapEnabled" ).default( true );
+ table.boolean( "poweredByHeader" ).default( true );
+ table.boolean( "adminBar" ).default( true );
+ table.boolean( "isSSL" ).default( false );
+ table.string( "activeTheme" ).nullable();
+ table.longText( "notificationEmails" ).nullable();
+ table.boolean( "notifyOnEntries" ).default( true );
+ table.boolean( "notifyOnPages" ).default( true );
+ table.boolean( "notifyOnContentStore" ).default( true );
+ table.string( "domain" ).nullable();
+ table.boolean( "isActive" ).default( true );
+ }
+ );
+ systemOutput( "√ - Site table created", true );
+
+ schema.alter(
+ "cb_setting",
+ function( table ) {
+ table.addColumn( table.string( "FK_siteID", 36 ).nullable() );
+ table.addConstraint( table
+ .string( "FK_siteID", 36 )
+ .references( "siteID" )
+ .onTable( "cb_site" ) );
+ }
+ );
+
+ var allSettings = arguments
+ .query
+ .newQuery()
+ .from( "cb_setting" )
+ .whereNull( "FK_siteID" )
+ .get()
+ .reduce(
+ ( results, thisSetting ) => {
+ results[ thisSetting.name ] = thisSetting.value;
+ return results;
+ },
+ {}
+ );
+
+ var initialSiteIdentifier = uuidLib.randomUUID().toString();
+ arguments
+ .query
+ .newQuery()
+ .from( "cb_site" )
+ .insert(
+ {
+ "siteID" : initialSiteIdentifier,
+ "createdDate" : today,
+ "modifiedDate" : today,
+ "isDeleted" : 0,
+ "isActive" : 1,
+ "name" : allSettings.cb_site_name,
+ "slug" : "default",
+ "homepage" : allSettings.cb_site_homepage,
+ "description" : allSettings.cb_site_description,
+ "keywords" : allSettings.cb_site_keywords,
+ "tagline" : allSettings.cb_site_tagline,
+ "domainRegex" : "127\.0\.0\.1",
+ "isBlogEnabled" : allSettings.cb_site_disable_blog ? 0 : 1,
+ "isSitemapEnabled" : allSettings.cb_site_sitemap ? 1 : 0,
+ "poweredByHeader" : allSettings.cb_site_poweredby ? 1 : 0,
+ "adminBar" : allSettings.cb_site_adminbar ? 1 : 0,
+ "isSSL" : allSettings.cb_admin_ssl ? 1 : 0,
+ "activeTheme" : allSettings.cb_site_theme,
+ "domain" : "127.0.0.1",
+ "notificationEmails": allSettings.cb_site_email
+ }
+ );
+ systemOutput( "√ - Default site created", true );
+
+ var siteSettings = [
+ // Global HTML: Panel Section
+ "cb_html_beforeHeadEnd",
+ "cb_html_afterBodyStart",
+ "cb_html_beforeBodyEnd",
+ "cb_html_beforeContent",
+ "cb_html_afterContent",
+ "cb_html_beforeSideBar",
+ "cb_html_afterSideBar",
+ "cb_html_afterFooter",
+ "cb_html_preEntryDisplay",
+ "cb_html_postEntryDisplay",
+ "cb_html_preIndexDisplay",
+ "cb_html_postIndexDisplay",
+ "cb_html_preArchivesDisplay",
+ "cb_html_postArchivesDisplay",
+ "cb_html_preCommentForm",
+ "cb_html_postCommentForm",
+ "cb_html_prePageDisplay",
+ "cb_html_postPageDisplay",
+ // Site Comment Settings
+ "cb_comments_enabled",
+ "cb_comments_maxDisplayChars",
+ "cb_comments_notify",
+ "cb_comments_moderation_notify",
+ "cb_comments_notifyemails",
+ "cb_comments_moderation",
+ "cb_comments_moderation_whitelist",
+ "cb_comments_moderation_blacklist",
+ "cb_comments_moderation_blockedlist",
+ "cb_comments_moderation_expiration"
+ ];
+
+ // Assign all null site settings to the default
+ query
+ .newQuery()
+ .from( "cb_setting" )
+ .whereIn( "name", siteSettings )
+ .update( { "FK_siteID": initialSiteIdentifier } );
+
+ return initialSiteIdentifier;
+ }
+
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc b/modules/contentbox/migrations/2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc
index 9cab82c06a..9d653f85d5 100755
--- a/modules/contentbox/migrations/2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc
+++ b/modules/contentbox/migrations/2022_03_07_155812_v5_1_0_page_sslonly_removals.cfc
@@ -7,24 +7,29 @@
* @author Davis Vega
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( hasColumn( "cb_page", "SSLOnly" ) ) {
- schema.alter( "cb_page", ( table ) => {
- table.dropColumn( "SSLOnly" );
- } );
+ schema.alter(
+ "cb_page",
+ ( table ) => {
+ table.dropColumn( "SSLOnly" );
+ }
+ );
} else {
- systemOutput( "- skipping 'sslonly' removal, cb_page doesn't have the column", true );
+ systemOutput(
+ "- skipping 'sslonly' removal, cb_page doesn't have the column",
+ true
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_04_20_143337_v5_3_0_deprecateMobileLayout.cfc b/modules/contentbox/migrations/2022_04_20_143337_v5_3_0_deprecateMobileLayout.cfc
index a0d65113c6..56c80dcec8 100644
--- a/modules/contentbox/migrations/2022_04_20_143337_v5_3_0_deprecateMobileLayout.cfc
+++ b/modules/contentbox/migrations/2022_04_20_143337_v5_3_0_deprecateMobileLayout.cfc
@@ -6,25 +6,30 @@
* @author Daniel Garcia
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( hasColumn( "cb_page", "mobileLayout" ) ) {
// Remove the mobileLayout column from the `cb_page` table
- schema.alter( "cb_page", ( table ) => {
- table.dropColumn( "mobileLayout" );
- } );
+ schema.alter(
+ "cb_page",
+ ( table ) => {
+ table.dropColumn( "mobileLayout" );
+ }
+ );
} else {
- systemOutput( "- skipping 'mobileLayout' removal, cb_page doesn't have the column", true );
+ systemOutput(
+ "- skipping 'mobileLayout' removal, cb_page doesn't have the column",
+ true
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_05_27_133613_v_5_3_0_CONTENTBOX-1437-Drop-cacheLayout-Column.cfc b/modules/contentbox/migrations/2022_05_27_133613_v_5_3_0_CONTENTBOX-1437-Drop-cacheLayout-Column.cfc
index 166440901e..7b8786bea6 100755
--- a/modules/contentbox/migrations/2022_05_27_133613_v_5_3_0_CONTENTBOX-1437-Drop-cacheLayout-Column.cfc
+++ b/modules/contentbox/migrations/2022_05_27_133613_v_5_3_0_CONTENTBOX-1437-Drop-cacheLayout-Column.cfc
@@ -6,24 +6,29 @@
* @author Jon Clausen
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( hasColumn( "cb_content", "cacheLayout" ) ) {
- schema.alter( "cb_content", ( table ) => {
- table.dropColumn( "cacheLayout" );
- } );
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.dropColumn( "cacheLayout" );
+ }
+ );
} else {
- systemOutput( "- skipping 'cacheLayout' removal, cb_content doesn't have the column", true );
+ systemOutput(
+ "- skipping 'cacheLayout' removal, cb_content doesn't have the column",
+ true
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_08_05_153052_v_5_3_0_EditorsCanPublishNow.cfc b/modules/contentbox/migrations/2022_08_05_153052_v_5_3_0_EditorsCanPublishNow.cfc
index 2fdc6fb803..d970b366a6 100755
--- a/modules/contentbox/migrations/2022_08_05_153052_v_5_3_0_EditorsCanPublishNow.cfc
+++ b/modules/contentbox/migrations/2022_08_05_153052_v_5_3_0_EditorsCanPublishNow.cfc
@@ -6,33 +6,41 @@
* @author Luis Majano
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
// Update permission descriptions
- arguments.qb
+ arguments
+ .qb
.newQuery()
.from( "cb_permission" )
.where( "permission", "CONTENTSTORE_EDITOR" )
- .update( { "description" : "Ability to create, edit and publish content store elements" } );
- arguments.qb
+ .update(
+ { "description": "Ability to create, edit and publish content store elements" }
+ );
+ arguments
+ .qb
.newQuery()
.from( "cb_permission" )
.where( "permission", "ENTRIES_EDITOR" )
- .update( { "description" : "Ability to create, edit and publish blog entries" } );
- arguments.qb
+ .update(
+ { "description": "Ability to create, edit and publish blog entries" }
+ );
+ arguments
+ .qb
.newQuery()
.from( "cb_permission" )
.where( "permission", "PAGES_EDITOR" )
- .update( { "description" : "Ability to create, edit and publish pages" } );
+ .update(
+ { "description": "Ability to create, edit and publish pages" }
+ );
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_10_13_133204_v_6_0_0_Unique-Site-Slug-Relocation.cfc b/modules/contentbox/migrations/2022_10_13_133204_v_6_0_0_Unique-Site-Slug-Relocation.cfc
index 17e4e1d909..eade5e90f4 100755
--- a/modules/contentbox/migrations/2022_10_13_133204_v_6_0_0_Unique-Site-Slug-Relocation.cfc
+++ b/modules/contentbox/migrations/2022_10_13_133204_v_6_0_0_Unique-Site-Slug-Relocation.cfc
@@ -3,31 +3,37 @@
* https://ortussolutions.atlassian.net/browse/CONTENTBOX-1296
*/
component {
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( schema.hasTable( "cb_relocations" ) ) {
- schema.alter( "cb_relocations", function( table ){
- table.unique( [ "slug", "FK_siteID" ] );
- } );
+ schema.alter(
+ "cb_relocations",
+ function( table ) {
+ table.unique( [ "slug", "FK_siteID"] );
+ }
+ );
} else {
- arguments.schema.create( "cb_relocations", ( table ) => {
- table.string( "relocationID", 36 ).primaryKey();
- table.dateTime( "createdDate" );
- table.dateTime( "modifiedDate" );
- table.boolean( "isDeleted" ).default( false );
- table.string( "slug", 500 );
- table.string( "target", 500 ).nullable();
- table.string( "FK_siteID", 36 );
- table.string( "FK_contentID", 36 ).nullable();
- table.unique( [ "slug", "FK_siteID" ] );
- } );
+ arguments.schema.create(
+ "cb_relocations",
+ ( table ) => {
+ table.string( "relocationID", 36 ).primaryKey();
+ table.dateTime( "createdDate" );
+ table.dateTime( "modifiedDate" );
+ table.boolean( "isDeleted" ).default( false );
+ table.string( "slug", 500 );
+ table.string( "target", 500 ).nullable();
+ table.string( "FK_siteID", 36 );
+ table.string( "FK_contentID", 36 ).nullable();
+ table.unique( [ "slug", "FK_siteID"] );
+ }
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_10_14_173737_v_6_0_0_Slow-Admin-Search.cfc b/modules/contentbox/migrations/2022_10_14_173737_v_6_0_0_Slow-Admin-Search.cfc
index 43c72d801d..e38f4cf878 100755
--- a/modules/contentbox/migrations/2022_10_14_173737_v_6_0_0_Slow-Admin-Search.cfc
+++ b/modules/contentbox/migrations/2022_10_14_173737_v_6_0_0_Slow-Admin-Search.cfc
@@ -4,13 +4,17 @@
*/
component {
- function up( schema, qb ){
- schema.alter( "cb_contentVersion", function( table ){
- table.index( [ "isActive", "content" ], "idx_content_isActive" );
- } );
+ function up( schema, qb ) {
+ schema.alter(
+ "cb_contentVersion",
+ function( table ) {
+ table.index( [ "isActive", "content"], "idx_content_isActive" );
+ }
+ );
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_11_17_234941_v_6_0_0_SecurityRules-cbsecurity3.cfc b/modules/contentbox/migrations/2022_11_17_234941_v_6_0_0_SecurityRules-cbsecurity3.cfc
index a4fc007aa2..ec5ee4fe30 100755
--- a/modules/contentbox/migrations/2022_11_17_234941_v_6_0_0_SecurityRules-cbsecurity3.cfc
+++ b/modules/contentbox/migrations/2022_11_17_234941_v_6_0_0_SecurityRules-cbsecurity3.cfc
@@ -2,25 +2,31 @@
* Add the new columns for the security rules in cbsecurity 3.x
*/
component {
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( !hasColumn( "cb_securityRule", "httpMethods" ) ) {
- schema.alter( "cb_securityRule", ( table ) => {
- table.addColumn( table.string( "httpMethods" ).default( "*" ) );
- } );
+ schema.alter(
+ "cb_securityRule",
+ ( table ) => {
+ table.addColumn( table.string( "httpMethods" ).default( "*" ) );
+ }
+ );
}
if ( !hasColumn( "cb_securityRule", "allowedIPs" ) ) {
- schema.alter( "cb_securityRule", ( table ) => {
- table.addColumn( table.string( "allowedIPs" ).default( "*" ) );
- } );
+ schema.alter(
+ "cb_securityRule",
+ ( table ) => {
+ table.addColumn( table.string( "allowedIPs" ).default( "*" ) );
+ }
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_11_23_142439_v_6_0_0_Convert-Featured-cbfs.cfc b/modules/contentbox/migrations/2022_11_23_142439_v_6_0_0_Convert-Featured-cbfs.cfc
index 6ef1ca47a0..52db94589d 100755
--- a/modules/contentbox/migrations/2022_11_23_142439_v_6_0_0_Convert-Featured-cbfs.cfc
+++ b/modules/contentbox/migrations/2022_11_23_142439_v_6_0_0_Convert-Featured-cbfs.cfc
@@ -3,16 +3,15 @@
* https://ortussolutions.atlassian.net/browse/CONTENTBOX-1452
*/
component {
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
var mediaRoot = qb
.newQuery()
.from( "cb_setting" )
.where( "name", "cb_media_directoryRoot" )
- .where( "isCore", 1 )
+ .where( "isCore", qb.getGrammar().convertToBooleanType( true ) )
.first();
if ( !structKeyExists( mediaRoot, "value" ) ) {
@@ -22,28 +21,48 @@ component {
mediaRoot = mediaRoot.value;
- qb.newQuery()
+ qb
+ .newQuery()
.from( "cb_content" )
- .where( "featuredImage", "!=", "%:%" )
- .select( [ "contentID", "featuredImage" ] )
+ .where(
+ "featuredImage",
+ "!=",
+ "%:%"
+ )
+ .select( [ "contentID", "featuredImage"] )
.get()
- .each( function( item ){
- if ( findNoCase( mediaRoot, item.featuredImage ) ) {
- qb.newQuery()
- .from( "cb_content" )
- .where( "contentID", item.contentID )
- .update( { "featuredImage" : replaceNoCase( item.featuredImage, mediaRoot, "contentbox:" ) } );
+ .each(
+ function( item ) {
+ if ( findNoCase( mediaRoot, item.featuredImage ) ) {
+ qb
+ .newQuery()
+ .from( "cb_content" )
+ .where( "contentID", item.contentID )
+ .update(
+ {
+ "featuredImage": replaceNoCase(
+ item.featuredImage,
+ mediaRoot,
+ "contentbox:"
+ )
+ }
+ );
+ }
}
- } );
+ );
if ( hasColumn( "cb_content", "featuredImageURL" ) ) {
- schema.alter( "cb_content", function( table ){
- table.dropColumn( "featuredImageURL" );
- } );
+ schema.alter(
+ "cb_content",
+ function( table ) {
+ table.dropColumn( "featuredImageURL" );
+ }
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2022_11_23_144748_v_6_0_0_Add-Site-Disk.cfc b/modules/contentbox/migrations/2022_11_23_144748_v_6_0_0_Add-Site-Disk.cfc
index 783bc9e40f..69f7e87893 100755
--- a/modules/contentbox/migrations/2022_11_23_144748_v_6_0_0_Add-Site-Disk.cfc
+++ b/modules/contentbox/migrations/2022_11_23_144748_v_6_0_0_Add-Site-Disk.cfc
@@ -3,19 +3,22 @@
* https://ortussolutions.atlassian.net/browse/CONTENTBOX-1452
*/
component {
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( !hasColumn( "cb_site", "mediaDisk" ) ) {
- schema.alter( "cb_site", function( table ){
- table.addColumn( table.string( "mediaDisk", 50 ).nullable() );
- } );
+ schema.alter(
+ "cb_site",
+ function( table ) {
+ table.addColumn( table.string( "mediaDisk", 50 ).nullable() );
+ }
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2023_07_13_092814_v_6_0_0_ContentTemplates.cfc b/modules/contentbox/migrations/2023_07_13_092814_v_6_0_0_ContentTemplates.cfc
index d892fa6bde..52dbe17028 100755
--- a/modules/contentbox/migrations/2023_07_13_092814_v_6_0_0_ContentTemplates.cfc
+++ b/modules/contentbox/migrations/2023_07_13_092814_v_6_0_0_ContentTemplates.cfc
@@ -3,71 +3,86 @@
* https://ortussolutions.atlassian.net/browse/CONTENTBOX-1270
*/
component {
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
// Content Templates
if ( !schema.hasTable( "cb_contentTemplate" ) ) {
- arguments.schema.create( "cb_contentTemplate", ( table ) => {
- // Columns
- table.string( "templateID", 36 ).primaryKey();
- table.dateTime( "createdDate" );
- table.dateTime( "modifiedDate" );
- table.boolean( "isDeleted" ).default( false );
- table.boolean( "isGlobal" ).default( false );
- table.string( "contentType", 50 );
- table.string( "name", 255 );
- table.string( "description", 1000 );
- table.longText( "definition" );
+ arguments.schema.create(
+ "cb_contentTemplate",
+ ( table ) => {
+ table.string( "templateID", 36 ).primaryKey();
+ table.dateTime( "createdDate" );
+ table.dateTime( "modifiedDate" );
+ table.boolean( "isDeleted" ).default( false );
+ table.boolean( "isGlobal" ).default( false );
+ table.string( "contentType", 50 );
+ table.string( "name", 255 );
+ table.string( "description", 1000 );
+ table.longText( "definition" );
- // Relationships
- table.string( "FK_authorID", 36 );
- table.string( "FK_siteID", 36 ).nullable();
- table
- .foreignKey( "FK_authorID" )
- .references( "authorID" )
- .onTable( "cb_author" );
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
+ table.string( "FK_authorID", 36 );
+ table.string( "FK_siteID", 36 ).nullable();
+ table
+ .foreignKey( "FK_authorID" )
+ .references( "authorID" )
+ .onTable( "cb_author" );
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
- // Indexes
- table.index( [ "contentType" ], "idx_contentType" );
- } );
+ table.index( [ "contentType"], "idx_contentType" );
+ }
+ );
} else {
- systemOutput( "- skipping 'cb_contentTemplate' creation, table already there", true );
+ systemOutput(
+ "- skipping 'cb_contentTemplate' creation, table already there",
+ true
+ );
}
// Relationship between Content Templates and Content
if ( !hasColumn( "cb_content", "FK_contentTemplateID" ) ) {
- schema.alter( "cb_content", ( table ) => {
- table.addColumn( table.string( "FK_contentTemplateID", 36 ).nullable() );
- table
- .foreignKey( "FK_contentTemplateID" )
- .references( "templateID" )
- .onTable( "cb_contentTemplate" );
- } );
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.addColumn( table.string( "FK_contentTemplateID", 36 ).nullable() );
+ table
+ .foreignKey( "FK_contentTemplateID" )
+ .references( "templateID" )
+ .onTable( "cb_contentTemplate" );
+ }
+ );
} else {
- systemOutput( "- skipping 'cb_content.FK_contentTemplateID' creation, column already there", true );
+ systemOutput(
+ "- skipping 'cb_content.FK_contentTemplateID' creation, column already there",
+ true
+ );
}
if ( !hasColumn( "cb_content", "FK_childContentTemplateID" ) ) {
- schema.alter( "cb_content", ( table ) => {
- table.addColumn( table.string( "FK_childContentTemplateID", 36 ).nullable() );
- table
- .foreignKey( "FK_childContentTemplateID" )
- .references( "templateID" )
- .onTable( "cb_contentTemplate" );
- } );
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.addColumn( table.string( "FK_childContentTemplateID", 36 ).nullable() );
+ table
+ .foreignKey( "FK_childContentTemplateID" )
+ .references( "templateID" )
+ .onTable( "cb_contentTemplate" );
+ }
+ );
} else {
- systemOutput( "- skipping 'cb_content.FK_childContentTemplateID' creation, column already there", true );
+ systemOutput(
+ "- skipping 'cb_content.FK_childContentTemplateID' creation, column already there",
+ true
+ );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2023_10_18_173527_v_6_0_0_SiteDomainAliases.cfc b/modules/contentbox/migrations/2023_10_18_173527_v_6_0_0_SiteDomainAliases.cfc
index 524c80f51f..c171676e43 100755
--- a/modules/contentbox/migrations/2023_10_18_173527_v_6_0_0_SiteDomainAliases.cfc
+++ b/modules/contentbox/migrations/2023_10_18_173527_v_6_0_0_SiteDomainAliases.cfc
@@ -2,20 +2,23 @@
* Sites can now have domain aliases for matching on the request
*/
component {
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
+ function up( schema, qb ) {
if ( !hasColumn( "cb_site", "domainAliases" ) ) {
- schema.alter( "cb_site", function( table ){
- table.addColumn( table.text( "domainAliases" ).nullable() );
- } );
+ schema.alter(
+ "cb_site",
+ function( table ) {
+ table.addColumn( table.text( "domainAliases" ).nullable() );
+ }
+ );
queryExecute( "update cb_site set domainAliases = '[]'" );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2023_12_12_164002_EditorsCanClearCaches.cfc b/modules/contentbox/migrations/2023_12_12_164002_EditorsCanClearCaches.cfc
index db50390d67..0753ffe352 100755
--- a/modules/contentbox/migrations/2023_12_12_164002_EditorsCanClearCaches.cfc
+++ b/modules/contentbox/migrations/2023_12_12_164002_EditorsCanClearCaches.cfc
@@ -6,40 +6,41 @@
* @author Luis Majano
*/
component {
-
// DI
property name="migrationService" inject="MigrationService@cfmigrations";
-
// Include Utils
include template="./util/MigrationUtils.cfm";
- function up( schema, qb ){
- var today = now();
+ function up( schema, qb ) {
+ var today = now();
var permID = createUUID();
if (
- !qb.newQuery()
+ !qb
+ .newQuery()
.from( "cb_permission" )
.where( "permission", "RELOAD_CACHES" )
.count()
) {
- qb.newQuery()
+ qb
+ .newQuery()
.from( "cb_permission" )
- .insert( {
- "permissionID" : permID,
- "createdDate" : today,
- "modifiedDate" : today,
- "isDeleted" : 0,
- "permission" : "RELOAD_CACHES",
- "description" : "Ability to reload caches"
- } );
+ .insert(
+ {
+ "permissionID": permID,
+ "createdDate" : today,
+ "modifiedDate": today,
+ "isDeleted" : 0,
+ "permission" : "RELOAD_CACHES",
+ "description" : "Ability to reload caches"
+ }
+ );
systemOutput( "√ - Reload Caches permission created", true );
} else {
var permId = qb
.newQuery()
.from( "cb_permission" )
.where( "permission", "RELOAD_CACHES" )
- .first()
- .permissionID;
+ .first().permissionID;
}
// Assign to Editors and Administrators
@@ -51,15 +52,17 @@ component {
.first();
if (
- !qb.newQuery()
+ !qb
+ .newQuery()
.from( "cb_rolePermissions" )
.where( "FK_permissionID", permID )
.where( "FK_roleID", admin.roleID )
.count()
) {
- qb.newQuery()
+ qb
+ .newQuery()
.from( "cb_rolePermissions" )
- .insert( { "FK_roleID" : admin.roleID, "FK_permissionID" : permID } );
+ .insert( { "FK_roleID": admin.roleID, "FK_permissionID": permID } );
systemOutput( "√ - Admin role updated with new permissions", true );
}
@@ -71,20 +74,23 @@ component {
.first();
if (
- !qb.newQuery()
+ !qb
+ .newQuery()
.from( "cb_rolePermissions" )
.where( "FK_permissionID", permID )
.where( "FK_roleID", editor.roleID )
.count()
) {
- qb.newQuery()
+ qb
+ .newQuery()
.from( "cb_rolePermissions" )
- .insert( { "FK_roleID" : editor.roleID, "FK_permissionID" : permID } );
+ .insert( { "FK_roleID": editor.roleID, "FK_permissionID": permID } );
systemOutput( "√ - Editor role updated with new permissions", true );
}
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/2026_05_19_210955_performance_updates.cfc b/modules/contentbox/migrations/2026_05_19_210955_performance_updates.cfc
new file mode 100755
index 0000000000..0b3a97ad8e
--- /dev/null
+++ b/modules/contentbox/migrations/2026_05_19_210955_performance_updates.cfc
@@ -0,0 +1,46 @@
+component {
+
+ function up( schema, qb ) {
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.index(
+ [ "isPublished", "contentType", "passwordProtection", "FK_siteID", "publishedDate"],
+ "idx_content_published_search"
+ );
+ }
+ );
+
+ schema.alter(
+ "cb_contentCategories",
+ ( table ) => {
+ table.index(
+ [ "FK_categoryID", "FK_contentID"],
+ "idx_category_content"
+ );
+ table.index(
+ [ "FK_contentID", "FK_categoryID"],
+ "idx_content_category"
+ );
+ }
+ );
+ }
+
+ function down( schema, qb ) {
+ schema.alter(
+ "cb_contentCategories",
+ ( table ) => {
+ table.dropIndex( "idx_content_category" );
+ table.dropIndex( "idx_category_content" );
+ }
+ );
+
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.dropIndex( "idx_content_published_search" );
+ }
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_author.cfc b/modules/contentbox/migrations/init/create_author.cfc
index db8bba004b..97c20f087f 100755
--- a/modules/contentbox/migrations/init/create_author.cfc
+++ b/modules/contentbox/migrations/init/create_author.cfc
@@ -1,40 +1,40 @@
component {
- function up( schema, query ){
- schema.create( "cb_author", ( table ) => {
- // Base Columns
- table.string( "authorID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_author",
+ ( table ) => {
+ table.string( "authorID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "firstName", 100 );
- table.string( "lastName", 100 );
- table.string( "email" );
- table.string( "username" ).unique();
- table.string( "password" );
- table.boolean( "isActive" ).default( true );
- table.datetime( "lastLogin" ).nullable();
- table.longText( "biography" ).nullable();
- table.longText( "preferences" ).nullable();
- table.boolean( "isPasswordReset" ).default( false );
- table.boolean( "is2FactorAuth" ).default( false );
+ table.string( "firstName", 100 );
+ table.string( "lastName", 100 );
+ table.string( "email" );
+ table.string( "username" ).unique();
+ table.string( "password" );
+ table.boolean( "isActive" ).default( true );
+ table.datetime( "lastLogin" ).nullable();
+ table.longText( "biography" ).nullable();
+ table.longText( "preferences" ).nullable();
+ table.boolean( "isPasswordReset" ).default( false );
+ table.boolean( "is2FactorAuth" ).default( false );
- // Relationships
- table.string( "FK_roleID", 36 );
- table
- .foreignKey( "FK_roleID" )
- .references( "roleID" )
- .onTable( "cb_role" );
+ table.string( "FK_roleID", 36 );
+ table
+ .foreignKey( "FK_roleID" )
+ .references( "roleID" )
+ .onTable( "cb_role" );
- // Indexes
- table.index( [ "email" ], "idx_email" );
- table.index( [ "isDeleted" ], "idx_author_deleted" );
- table.index( [ "isActive" ], "idx_activeAuthor" );
- table.index( [ "isPasswordReset" ], "idx_passwordReset" );
- table.index( [ "is2FactorAuth" ], "idx_2factorauth" );
- table.index( [ "username", "password", "isActive" ], "idx_login" );
- } );
+ table.index( [ "email"], "idx_email" );
+ table.index( [ "isDeleted"], "idx_author_deleted" );
+ table.index( [ "isActive"], "idx_activeAuthor" );
+ table.index( [ "isPasswordReset"], "idx_passwordReset" );
+ table.index( [ "is2FactorAuth"], "idx_2factorauth" );
+ table.index( [ "username", "password", "isActive"], "idx_login" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_author_permission_groups.cfc b/modules/contentbox/migrations/init/create_author_permission_groups.cfc
index 63f48be61a..eae775e861 100644
--- a/modules/contentbox/migrations/init/create_author_permission_groups.cfc
+++ b/modules/contentbox/migrations/init/create_author_permission_groups.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_authorPermissionGroups", function( table ){
- table.string( "FK_permissionGroupID", 36 );
- table.string( "FK_authorID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_authorPermissionGroups",
+ function( table ) {
+ table.string( "FK_permissionGroupID", 36 );
+ table.string( "FK_authorID", 36 );
- table
- .foreignKey( "FK_permissionGroupID" )
- .references( "permissionGroupID" )
- .onTable( "cb_permissionGroup" );
- table
- .foreignKey( "FK_authorID" )
- .references( "authorID" )
- .onTable( "cb_author" );
- } );
+ table
+ .foreignKey( "FK_permissionGroupID" )
+ .references( "permissionGroupID" )
+ .onTable( "cb_permissionGroup" );
+ table
+ .foreignKey( "FK_authorID" )
+ .references( "authorID" )
+ .onTable( "cb_author" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_author_permissions.cfc b/modules/contentbox/migrations/init/create_author_permissions.cfc
index 7244c79072..97ed6d65c3 100644
--- a/modules/contentbox/migrations/init/create_author_permissions.cfc
+++ b/modules/contentbox/migrations/init/create_author_permissions.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_authorPermissions", function( table ){
- table.string( "FK_permissionID", 36 );
- table.string( "FK_authorID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_authorPermissions",
+ function( table ) {
+ table.string( "FK_permissionID", 36 );
+ table.string( "FK_authorID", 36 );
- table
- .foreignKey( "FK_permissionID" )
- .references( "permissionID" )
- .onTable( "cb_permission" );
- table
- .foreignKey( "FK_authorID" )
- .references( "authorID" )
- .onTable( "cb_author" );
- } );
+ table
+ .foreignKey( "FK_permissionID" )
+ .references( "permissionID" )
+ .onTable( "cb_permission" );
+ table
+ .foreignKey( "FK_authorID" )
+ .references( "authorID" )
+ .onTable( "cb_author" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_category.cfc b/modules/contentbox/migrations/init/create_category.cfc
index aaf91d7c6c..de06c7310d 100755
--- a/modules/contentbox/migrations/init/create_category.cfc
+++ b/modules/contentbox/migrations/init/create_category.cfc
@@ -1,33 +1,34 @@
component {
- function up( schema, query ){
- schema.create( "cb_category", function( table ){
- // Base Columns
- table.string( "categoryID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_category",
+ function( table ) {
+ table.string( "categoryID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "slug" );
- table.string( "category" );
- table.boolean( "isPublic" ).default( true );
+ table.string( "slug" );
+ table.string( "category" );
+ table.boolean( "isPublic" ).default( true );
- // Relationships
- table.string( "FK_siteID", 36 );
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
+ table.string( "FK_siteID", 36 );
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
- // Index
- table.index( [ "isPublic" ], "idx_isPublic" );
- table.index( [ "slug" ], "idx_categorySlug" );
- table.index( [ "category" ], "idx_categoryName" );
- table.index( [ "isDeleted" ], "idx_category_deleted" );
- } );
+ table.index( [ "isPublic"], "idx_isPublic" );
+ table.index( [ "slug"], "idx_categorySlug" );
+ table.index( [ "category"], "idx_categoryName" );
+ table.index( [ "isDeleted"], "idx_category_deleted" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_comment_subscriptions.cfc b/modules/contentbox/migrations/init/create_comment_subscriptions.cfc
index 8b58d74d90..6e6c529ccc 100644
--- a/modules/contentbox/migrations/init/create_comment_subscriptions.cfc
+++ b/modules/contentbox/migrations/init/create_comment_subscriptions.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_commentSubscriptions", function( table ){
- table.string( "subscriptionID", 36 );
- table.string( "FK_contentID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_commentSubscriptions",
+ function( table ) {
+ table.string( "subscriptionID", 36 );
+ table.string( "FK_contentID", 36 );
- table
- .foreignKey( "subscriptionID" )
- .references( "subscriptionID" )
- .onTable( "cb_subscriptions" );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- } );
+ table
+ .foreignKey( "subscriptionID" )
+ .references( "subscriptionID" )
+ .onTable( "cb_subscriptions" );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_comments.cfc b/modules/contentbox/migrations/init/create_comments.cfc
index b13b90c9e6..4a461e37ae 100755
--- a/modules/contentbox/migrations/init/create_comments.cfc
+++ b/modules/contentbox/migrations/init/create_comments.cfc
@@ -1,32 +1,32 @@
component {
- function up( schema, query ){
- schema.create( "cb_comment", ( table ) => {
- // Base Columns
- table.string( "commentID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_comment",
+ ( table ) => {
+ table.string( "commentID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.longText( "content" );
- table.string( "author", 100 );
- table.string( "authorIP", 100 );
- table.string( "authorEmail" );
- table.string( "authorURL" ).nullable();
- table.boolean( "isApproved" ).default( false );
+ table.longText( "content" );
+ table.string( "author", 100 );
+ table.string( "authorIP", 100 );
+ table.string( "authorEmail" );
+ table.string( "authorURL" ).nullable();
+ table.boolean( "isApproved" ).default( false );
- // Relationships
- table.string( "FK_contentID", 36 );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
+ table.string( "FK_contentID", 36 );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
- // Indexes
- table.index( [ "isApproved", "FK_contentID" ], "idx_contentComment" );
- table.index( [ "isApproved" ], "idx_approved" );
- table.index( [ "isDeleted" ], "idx_comments_deleted" );
- } );
+ table.index( [ "isApproved", "FK_contentID"], "idx_contentComment" );
+ table.index( [ "isApproved"], "idx_approved" );
+ table.index( [ "isDeleted"], "idx_comments_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_content.cfc b/modules/contentbox/migrations/init/create_content.cfc
index 23a6537831..9f3263fdc8 100644
--- a/modules/contentbox/migrations/init/create_content.cfc
+++ b/modules/contentbox/migrations/init/create_content.cfc
@@ -1,64 +1,65 @@
component {
- function up( schema, query ){
- schema.create( "cb_content", function( table ){
- // Base Columns
- table.string( "contentID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
- // Content Columns
- table.string( "contentType" );
- table.string( "title", 500 );
- table.string( "slug" );
- table.datetime( "publishedDate" ).nullable();
- table.datetime( "expireDate" ).nullable();
- table.boolean( "isPublished" ).default( true );
- table.boolean( "allowComments" ).default( true );
- table.string( "passwordProtection", 100 ).nullable();
- table.string( "HTMLKeywords", 160 ).nullable();
- table.string( "HTMLDescription", 160 ).nullable();
- table.string( "HTMLTitle" ).nullable();
- table.boolean( "cache" ).default( true );
- table.integer( "cacheTimeout" ).default( 0 );
- table.integer( "cacheLastAccessTimeout" ).default( 0 );
- table.string( "markup", 100 ).default( "HTML" );
- table.boolean( "showInSearch" ).default( true );
- table.string( "featuredImage", 500 ).nullable();
+ function up( schema, query ) {
+ schema.create(
+ "cb_content",
+ function( table ) {
+ table.string( "contentID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- // Relationships
- table.string( "FK_siteID", 36 );
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
- table.string( "FK_authorID", 36 );
- table
- .foreignKey( "FK_authorID" )
- .references( "authorID" )
- .onTable( "cb_author" );
- table.string( "FK_parentID", 36 ).nullable();
- table
- .foreignKey( "FK_parentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
+ table.string( "contentType" );
+ table.string( "title", 500 );
+ table.string( "slug" );
+ table.datetime( "publishedDate" ).nullable();
+ table.datetime( "expireDate" ).nullable();
+ table.boolean( "isPublished" ).default( true );
+ table.boolean( "allowComments" ).default( true );
+ table.string( "passwordProtection", 100 ).nullable();
+ table.string( "HTMLKeywords", 160 ).nullable();
+ table.string( "HTMLDescription", 160 ).nullable();
+ table.string( "HTMLTitle" ).nullable();
+ table.boolean( "cache" ).default( true );
+ table.integer( "cacheTimeout" ).default( 0 );
+ table.integer( "cacheLastAccessTimeout" ).default( 0 );
+ table.string( "markup", 100 ).default( "HTML" );
+ table.boolean( "showInSearch" ).default( true );
+ table.string( "featuredImage", 500 ).nullable();
- // Index
- table.index( [ "contentType" ], "idx_discriminator" );
- table.index( [ "isPublished", "contentType" ], "idx_published" );
- table.index( [ "slug" ], "idx_slug" );
- table.index( [ "slug", "isPublished" ], "idx_publishedSlug" );
- table.index( [ "publishedDate" ], "idx_publishedDate" );
- table.index( [ "expireDate" ], "idx_expireDate" );
- table.index( [ "title", "isPublished" ], "idx_search" );
- table.index( [ "cache" ], "idx_cache" );
- table.index( [ "cacheTimeout" ], "idx_cachetimeout" );
- table.index( [ "cacheLastAccessTimeout" ], "idx_cachelastaccesstimeout" );
- table.index( [ "showInSearch" ], "idx_showInSearch" );
- } );
+ table.string( "FK_siteID", 36 );
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
+ table.string( "FK_authorID", 36 );
+ table
+ .foreignKey( "FK_authorID" )
+ .references( "authorID" )
+ .onTable( "cb_author" );
+ table.string( "FK_parentID", 36 ).nullable();
+ table
+ .foreignKey( "FK_parentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+
+ table.index( [ "contentType"], "idx_discriminator" );
+ table.index( [ "isPublished", "contentType"], "idx_published" );
+ table.index( [ "slug"], "idx_slug" );
+ table.index( [ "slug", "isPublished"], "idx_publishedSlug" );
+ table.index( [ "publishedDate"], "idx_publishedDate" );
+ table.index( [ "expireDate"], "idx_expireDate" );
+ table.index( [ "title", "isPublished"], "idx_search" );
+ table.index( [ "cache"], "idx_cache" );
+ table.index( [ "cacheTimeout"], "idx_cachetimeout" );
+ table.index( [ "cacheLastAccessTimeout"], "idx_cachelastaccesstimeout" );
+ table.index( [ "showInSearch"], "idx_showInSearch" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_contentStore.cfc b/modules/contentbox/migrations/init/create_contentStore.cfc
index a0f1dca260..eb05586565 100644
--- a/modules/contentbox/migrations/init/create_contentStore.cfc
+++ b/modules/contentbox/migrations/init/create_contentStore.cfc
@@ -1,23 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_contentStore", function( table ){
- table.string( "contentID", 36 ).primaryKey();
- table
- .integer( "order" )
- .default( 0 )
- .nullable();
- table.string( "description", 500 ).nullable();
+ function up( schema, query ) {
+ schema.create(
+ "cb_contentStore",
+ function( table ) {
+ table.string( "contentID", 36 ).primaryKey();
+ table
+ .integer( "order" )
+ .default( 0 )
+ .nullable();
+ table.string( "description", 500 ).nullable();
- // Relationships
- table
- .foreignKey( "contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- } );
+ table
+ .foreignKey( "contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_content_categories.cfc b/modules/contentbox/migrations/init/create_content_categories.cfc
index 1f788b5191..2c7b99927f 100644
--- a/modules/contentbox/migrations/init/create_content_categories.cfc
+++ b/modules/contentbox/migrations/init/create_content_categories.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_contentCategories", function( table ){
- table.string( "FK_contentID", 36 );
- table.string( "FK_categoryID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_contentCategories",
+ function( table ) {
+ table.string( "FK_contentID", 36 );
+ table.string( "FK_categoryID", 36 );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- table
- .foreignKey( "FK_categoryID" )
- .references( "categoryID" )
- .onTable( "cb_category" );
- } );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ table
+ .foreignKey( "FK_categoryID" )
+ .references( "categoryID" )
+ .onTable( "cb_category" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_content_templates.cfc b/modules/contentbox/migrations/init/create_content_templates.cfc
index 6e53e12038..dd25e88091 100644
--- a/modules/contentbox/migrations/init/create_content_templates.cfc
+++ b/modules/contentbox/migrations/init/create_content_templates.cfc
@@ -4,55 +4,62 @@
*/
component {
- function up( schema, qb ){
- schema.create( "cb_contentTemplate", ( table ) => {
- // Base Columns
- table.string( "templateID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
-
- table.boolean( "isGlobal" ).default( false );
- table.string( "contentType", 50 ).nullable();
- table.string( "name", 255 );
- table.string( "description", 1000 ).nullable();
- table.longText( "definition" );
-
- // Relationships
- table.string( "FK_authorID", 36 );
- table
- .foreignKey( "FK_authorID" )
- .references( "authorID" )
- .onTable( "cb_author" );
- table.string( "FK_siteID", 36 );
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
-
- // Indexes
- table.index( [ "contentType" ], "idx_contentType" );
- } );
+ function up( schema, qb ) {
+ schema.create(
+ "cb_contentTemplate",
+ ( table ) => {
+ table.string( "templateID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
+
+ table.boolean( "isGlobal" ).default( false );
+ table.string( "contentType", 50 ).nullable();
+ table.string( "name", 255 );
+ table.string( "description", 1000 ).nullable();
+ table.longText( "definition" );
+
+ table.string( "FK_authorID", 36 );
+ table
+ .foreignKey( "FK_authorID" )
+ .references( "authorID" )
+ .onTable( "cb_author" );
+ table.string( "FK_siteID", 36 );
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
+
+ table.index( [ "contentType"], "idx_contentType" );
+ }
+ );
// Relationship between Content Templates and Content
- schema.alter( "cb_content", ( table ) => {
- table.addColumn( table.string( "FK_contentTemplateID", 36 ).nullable() );
- table
- .foreignKey( "FK_contentTemplateID" )
- .references( "templateID" )
- .onTable( "cb_contentTemplate" );
- } );
-
- schema.alter( "cb_content", ( table ) => {
- table.addColumn( table.string( "FK_childContentTemplateID", 36 ).nullable() );
- table
- .foreignKey( "FK_childContentTemplateID" )
- .references( "templateID" )
- .onTable( "cb_contentTemplate" );
- } );
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.addColumn( table.string( "FK_contentTemplateID", 36 ).nullable() );
+ table
+ .foreignKey( "FK_contentTemplateID" )
+ .references( "templateID" )
+ .onTable( "cb_contentTemplate" );
+ }
+ );
+
+ schema.alter(
+ "cb_content",
+ ( table ) => {
+ table.addColumn( table.string( "FK_childContentTemplateID", 36 ).nullable() );
+ table
+ .foreignKey( "FK_childContentTemplateID" )
+ .references( "templateID" )
+ .onTable( "cb_contentTemplate" );
+ }
+ );
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_content_versions.cfc b/modules/contentbox/migrations/init/create_content_versions.cfc
index b5089c778c..b28d4d94f7 100644
--- a/modules/contentbox/migrations/init/create_content_versions.cfc
+++ b/modules/contentbox/migrations/init/create_content_versions.cfc
@@ -1,39 +1,40 @@
component {
- function up( schema, query ){
- schema.create( "cb_contentVersion", function( table ){
- // Base Columns
- table.string( "contentVersionID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
- // Content Version Columns
- table.longText( "content" );
- table.longText( "changelog" ).nullable();
- table.integer( "version" ).default( 1 );
- table.boolean( "isActive" ).default( true );
+ function up( schema, query ) {
+ schema.create(
+ "cb_contentVersion",
+ function( table ) {
+ table.string( "contentVersionID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- // Relationships
- table.string( "FK_authorID", 36 );
- table
- .foreignKey( "FK_authorID" )
- .references( "authorID" )
- .onTable( "cb_author" );
- table.string( "FK_contentID", 36 );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
+ table.longText( "content" );
+ table.longText( "changelog" ).nullable();
+ table.integer( "version" ).default( 1 );
+ table.boolean( "isActive" ).default( true );
- // Index
- table.index( [ "version" ], "idx_version" );
- table.index( [ "isActive" ], "idx_activeContentVersion" );
- table.index( [ "FK_contentID", "isActive" ], "idx_contentVersions" );
- table.index( [ "isActive" ], "idx_content_isActive" );
- } );
+ table.string( "FK_authorID", 36 );
+ table
+ .foreignKey( "FK_authorID" )
+ .references( "authorID" )
+ .onTable( "cb_author" );
+ table.string( "FK_contentID", 36 );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+
+ table.index( [ "version"], "idx_version" );
+ table.index( [ "isActive"], "idx_activeContentVersion" );
+ table.index( [ "FK_contentID", "isActive"], "idx_contentVersions" );
+ table.index( [ "isActive"], "idx_content_isActive" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_custom_fields.cfc b/modules/contentbox/migrations/init/create_custom_fields.cfc
index 6e4a2ebb05..eb904c3c16 100644
--- a/modules/contentbox/migrations/init/create_custom_fields.cfc
+++ b/modules/contentbox/migrations/init/create_custom_fields.cfc
@@ -1,23 +1,24 @@
component {
- function up( schema, query ){
- schema.create( "cb_customfield", ( table ) => {
- // Base Columns
- table.string( "customFieldID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_customfield",
+ ( table ) => {
+ table.string( "customFieldID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "key" );
- table.longText( "value" );
+ table.string( "key" );
+ table.longText( "value" );
- // Relationships
- table.string( "FK_contentID", 36 );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- } );
+ table.string( "FK_contentID", 36 );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_entry.cfc b/modules/contentbox/migrations/init/create_entry.cfc
index b397f8b49f..0884da09e6 100644
--- a/modules/contentbox/migrations/init/create_entry.cfc
+++ b/modules/contentbox/migrations/init/create_entry.cfc
@@ -1,19 +1,22 @@
component {
- function up( schema, query ){
- schema.create( "cb_entry", function( table ){
- table.string( "contentID", 36 ).primaryKey();
- table.longtext( "excerpt" ).nullable();
+ function up( schema, query ) {
+ schema.create(
+ "cb_entry",
+ function( table ) {
+ table.string( "contentID", 36 ).primaryKey();
+ table.longtext( "excerpt" ).nullable();
- // Relationships
- table
- .foreignKey( "contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- } );
+ table
+ .foreignKey( "contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_group_permissions.cfc b/modules/contentbox/migrations/init/create_group_permissions.cfc
index 82489a6b83..24bd48a3a6 100644
--- a/modules/contentbox/migrations/init/create_group_permissions.cfc
+++ b/modules/contentbox/migrations/init/create_group_permissions.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_groupPermissions", function( table ){
- table.string( "FK_permissionGroupID", 36 );
- table.string( "FK_permissionID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_groupPermissions",
+ function( table ) {
+ table.string( "FK_permissionGroupID", 36 );
+ table.string( "FK_permissionID", 36 );
- table
- .foreignKey( "FK_permissionGroupID" )
- .references( "permissionGroupID" )
- .onTable( "cb_permissionGroup" );
- table
- .foreignKey( "FK_permissionID" )
- .references( "permissionID" )
- .onTable( "cb_permission" );
- } );
+ table
+ .foreignKey( "FK_permissionGroupID" )
+ .references( "permissionGroupID" )
+ .onTable( "cb_permissionGroup" );
+ table
+ .foreignKey( "FK_permissionID" )
+ .references( "permissionID" )
+ .onTable( "cb_permission" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_jwt.cfc b/modules/contentbox/migrations/init/create_jwt.cfc
index 985c2fbe44..61b7931c05 100644
--- a/modules/contentbox/migrations/init/create_jwt.cfc
+++ b/modules/contentbox/migrations/init/create_jwt.cfc
@@ -1,18 +1,19 @@
component {
- function up( schema, query ){
- schema.create( "cb_jwt", ( table ) => {
- // Base Columns
- table.string( "id", 36 ).primaryKey();
- table.datetime( "expiration" );
- table.datetime( "issued" );
- table.longtext( "token" );
- table.string( "cacheKey" );
- table.string( "subject" );
+ function up( schema, query ) {
+ schema.create(
+ "cb_jwt",
+ ( table ) => {
+ table.string( "id", 36 ).primaryKey();
+ table.datetime( "expiration" );
+ table.datetime( "issued" );
+ table.longtext( "token" );
+ table.string( "cacheKey" );
+ table.string( "subject" );
- // Indexes
- table.index( [ "cacheKey" ], "idx_cacheKey" );
- } );
+ table.index( [ "cacheKey"], "idx_cacheKey" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_login_attempts.cfc b/modules/contentbox/migrations/init/create_login_attempts.cfc
index ef5869bbd4..2dad9a6b3e 100644
--- a/modules/contentbox/migrations/init/create_login_attempts.cfc
+++ b/modules/contentbox/migrations/init/create_login_attempts.cfc
@@ -1,20 +1,21 @@
component {
- function up( schema, query ){
- schema.create( "cb_loginAttempts", ( table ) => {
- // Base Columns
- table.string( "loginAttemptsID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_loginAttempts",
+ ( table ) => {
+ table.string( "loginAttemptsID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "value" );
- table.bigInteger( "attempts" );
- table.string( "lastLoginSuccessIP", 100 ).nullable();
+ table.string( "value" );
+ table.bigInteger( "attempts" );
+ table.string( "lastLoginSuccessIP", 100 ).nullable();
- // Index
- table.index( [ "value" ], "idx_values" );
- } );
+ table.index( [ "value"], "idx_values" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_menu_items.cfc b/modules/contentbox/migrations/init/create_menu_items.cfc
index 2f01dab225..83c43f5918 100755
--- a/modules/contentbox/migrations/init/create_menu_items.cfc
+++ b/modules/contentbox/migrations/init/create_menu_items.cfc
@@ -1,43 +1,43 @@
component {
- function up( schema, query ){
- schema.create( "cb_menuItem", ( table ) => {
- // Base Columns
- table.string( "menuItemID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_menuItem",
+ ( table ) => {
+ table.string( "menuItemID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.boolean( "active" ).default( false );
- table.string( "title", 200 );
- table.string( "label", 200 ).nullable();
- table.string( "itemClass", 200 ).nullable();
- table.string( "data", 200 ).nullable();
- table.string( "menuType" );
- table.string( "menuSlug" ).nullable();
- table.string( "mediaPath" ).nullable();
- table.string( "contentSlug" ).nullable();
- table.string( "url" ).nullable();
- table.string( "js" ).nullable();
- table.string( "target" ).nullable();
- table.string( "urlClass" ).nullable();
+ table.boolean( "active" ).default( false );
+ table.string( "title", 200 );
+ table.string( "label", 200 ).nullable();
+ table.string( "itemClass", 200 ).nullable();
+ table.string( "data", 200 ).nullable();
+ table.string( "menuType" );
+ table.string( "menuSlug" ).nullable();
+ table.string( "mediaPath" ).nullable();
+ table.string( "contentSlug" ).nullable();
+ table.string( "url" ).nullable();
+ table.string( "js" ).nullable();
+ table.string( "target" ).nullable();
+ table.string( "urlClass" ).nullable();
- // Relationships
- table.string( "FK_menuID", 36 );
- table
- .foreignKey( "FK_menuID" )
- .references( "menuID" )
- .onTable( "cb_menu" );
- table.string( "FK_parentID", 36 ).nullable();
- table
- .foreignKey( "FK_parentID" )
- .references( "menuItemID" )
- .onTable( "cb_menuItem" );
+ table.string( "FK_menuID", 36 );
+ table
+ .foreignKey( "FK_menuID" )
+ .references( "menuID" )
+ .onTable( "cb_menu" );
+ table.string( "FK_parentID", 36 ).nullable();
+ table
+ .foreignKey( "FK_parentID" )
+ .references( "menuItemID" )
+ .onTable( "cb_menuItem" );
- // Index
- table.index( [ "title" ], "idx_menuItemTitle" );
- table.index( [ "isDeleted" ], "idx_menuitems_deleted" );
- } );
+ table.index( [ "title"], "idx_menuItemTitle" );
+ table.index( [ "isDeleted"], "idx_menuitems_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_menus.cfc b/modules/contentbox/migrations/init/create_menus.cfc
index a98fedec91..f82d15bcd6 100644
--- a/modules/contentbox/migrations/init/create_menus.cfc
+++ b/modules/contentbox/migrations/init/create_menus.cfc
@@ -1,30 +1,30 @@
component {
- function up( schema, query ){
- schema.create( "cb_menu", ( table ) => {
- // Base Columns
- table.string( "menuID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_menu",
+ ( table ) => {
+ table.string( "menuID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "title", 200 );
- table.string( "slug", 200 );
- table.string( "menuClass", 160 ).nullable();
- table.string( "listClass", 160 ).nullable();
- table.string( "listType", 20 ).nullable();
+ table.string( "title", 200 );
+ table.string( "slug", 200 );
+ table.string( "menuClass", 160 ).nullable();
+ table.string( "listClass", 160 ).nullable();
+ table.string( "listType", 20 ).nullable();
- // Relationships
- table.string( "FK_siteID", 36 );
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
+ table.string( "FK_siteID", 36 );
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
- // Index
- table.index( [ "title" ], "idx_menutitle" );
- table.index( [ "slug" ], "idx_menuslug" );
- } );
+ table.index( [ "title"], "idx_menutitle" );
+ table.index( [ "slug"], "idx_menuslug" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_modules.cfc b/modules/contentbox/migrations/init/create_modules.cfc
index 03ec87f9bf..59bdd2ce11 100755
--- a/modules/contentbox/migrations/init/create_modules.cfc
+++ b/modules/contentbox/migrations/init/create_modules.cfc
@@ -1,31 +1,32 @@
component {
- function up( schema, query ){
- schema.create( "cb_module", ( table ) => {
- // Base Columns
- table.string( "moduleID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_module",
+ ( table ) => {
+ table.string( "moduleID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "name" );
- table.string( "title" ).nullable();
- table.string( "version" ).nullable();
- table.string( "entryPoint" ).nullable();
- table.string( "author" ).nullable();
- table.string( "webURL", 500 ).nullable();
- table.string( "forgeBoxSlug" ).nullable();
- table.longText( "description" ).nullable();
- table.boolean( "isActive" ).default( false );
- table.string( "moduleType" ).nullable();
+ table.string( "name" );
+ table.string( "title" ).nullable();
+ table.string( "version" ).nullable();
+ table.string( "entryPoint" ).nullable();
+ table.string( "author" ).nullable();
+ table.string( "webURL", 500 ).nullable();
+ table.string( "forgeBoxSlug" ).nullable();
+ table.longText( "description" ).nullable();
+ table.boolean( "isActive" ).default( false );
+ table.string( "moduleType" ).nullable();
- // Indexes
- table.index( [ "name" ], "idx_moduleName" );
- table.index( [ "entryPoint" ], "idx_entryPoint" );
- table.index( [ "isActive" ], "idx_activeModule" );
- table.index( [ "moduleType" ], "idx_moduleType" );
- table.index( [ "isDeleted" ], "idx_modules_deleted" );
- } );
+ table.index( [ "name"], "idx_moduleName" );
+ table.index( [ "entryPoint"], "idx_entryPoint" );
+ table.index( [ "isActive"], "idx_activeModule" );
+ table.index( [ "moduleType"], "idx_moduleType" );
+ table.index( [ "isDeleted"], "idx_modules_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_page.cfc b/modules/contentbox/migrations/init/create_page.cfc
index 019b5b93e8..0c43ee4023 100644
--- a/modules/contentbox/migrations/init/create_page.cfc
+++ b/modules/contentbox/migrations/init/create_page.cfc
@@ -1,25 +1,28 @@
component {
- function up( schema, query ){
- schema.create( "cb_page", function( table ){
- table.string( "contentID", 36 ).primaryKey();
- table.boolean( "showInMenu" ).default( true );
- table
- .integer( "order" )
- .default( 0 )
- .nullable();
- table.longtext( "excerpt" ).nullable();
- table.string( "layout", 200 ).nullable();
+ function up( schema, query ) {
+ schema.create(
+ "cb_page",
+ function( table ) {
+ table.string( "contentID", 36 ).primaryKey();
+ table.boolean( "showInMenu" ).default( true );
+ table
+ .integer( "order" )
+ .default( 0 )
+ .nullable();
+ table.longtext( "excerpt" ).nullable();
+ table.string( "layout", 200 ).nullable();
- // Relationships
- table
- .foreignKey( "contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- } );
+ table
+ .foreignKey( "contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_permission_groups.cfc b/modules/contentbox/migrations/init/create_permission_groups.cfc
index 205544d2e9..b9f96929c9 100644
--- a/modules/contentbox/migrations/init/create_permission_groups.cfc
+++ b/modules/contentbox/migrations/init/create_permission_groups.cfc
@@ -1,19 +1,22 @@
component {
- function up( schema, query ){
- schema.create( "cb_permissionGroup", function( table ){
- // Base Columns
- table.string( "permissionGroupID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_permissionGroup",
+ function( table ) {
+ table.string( "permissionGroupID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "name" ).unique();
- table.longText( "description" ).nullable();
- } );
+ table.string( "name" ).unique();
+ table.longText( "description" ).nullable();
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_permissions.cfc b/modules/contentbox/migrations/init/create_permissions.cfc
index b8dda8be65..fc4ef98efc 100644
--- a/modules/contentbox/migrations/init/create_permissions.cfc
+++ b/modules/contentbox/migrations/init/create_permissions.cfc
@@ -1,19 +1,22 @@
component {
- function up( schema, query ){
- schema.create( "cb_permission", function( table ){
- // Base Columns
- table.string( "permissionID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_permission",
+ function( table ) {
+ table.string( "permissionID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "permission" ).unique();
- table.longText( "description" ).nullable();
- } );
+ table.string( "permission" ).unique();
+ table.longText( "description" ).nullable();
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_related_content.cfc b/modules/contentbox/migrations/init/create_related_content.cfc
index a64f04e017..f7a684b51d 100644
--- a/modules/contentbox/migrations/init/create_related_content.cfc
+++ b/modules/contentbox/migrations/init/create_related_content.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_relatedContent", function( table ){
- table.string( "FK_contentID", 36 );
- table.string( "FK_relatedContentID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_relatedContent",
+ function( table ) {
+ table.string( "FK_contentID", 36 );
+ table.string( "FK_relatedContentID", 36 );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- table
- .foreignKey( "FK_relatedContentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
- } );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ table
+ .foreignKey( "FK_relatedContentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_relocations.cfc b/modules/contentbox/migrations/init/create_relocations.cfc
index a22bd43482..7c4d55e62b 100644
--- a/modules/contentbox/migrations/init/create_relocations.cfc
+++ b/modules/contentbox/migrations/init/create_relocations.cfc
@@ -4,34 +4,36 @@
*/
component {
- function up( schema, qb ){
- schema.create( "cb_relocations", ( table ) => {
- table.string( "relocationID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, qb ) {
+ schema.create(
+ "cb_relocations",
+ ( table ) => {
+ table.string( "relocationID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "slug", 500 );
- table.string( "target", 500 ).nullable();
+ table.string( "slug", 500 );
+ table.string( "target", 500 ).nullable();
- // Relationships
- table.string( "FK_siteID", 36 );
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
- table.string( "FK_contentID", 36 ).nullable();
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
+ table.string( "FK_siteID", 36 );
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
+ table.string( "FK_contentID", 36 ).nullable();
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
- // Indexes
- table.unique( [ "slug", "FK_siteID" ] );
- } );
+ table.unique( [ "slug", "FK_siteID"] );
+ }
+ );
}
- function down( schema, qb ){
+ function down( schema, qb ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_role_permissions.cfc b/modules/contentbox/migrations/init/create_role_permissions.cfc
index 396f1c87ea..0a1f81c99f 100644
--- a/modules/contentbox/migrations/init/create_role_permissions.cfc
+++ b/modules/contentbox/migrations/init/create_role_permissions.cfc
@@ -1,22 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_rolePermissions", function( table ){
- table.string( "FK_permissionID", 36 );
- table.string( "FK_roleID", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cb_rolePermissions",
+ function( table ) {
+ table.string( "FK_permissionID", 36 );
+ table.string( "FK_roleID", 36 );
- table
- .foreignKey( "FK_permissionID" )
- .references( "permissionID" )
- .onTable( "cb_permission" );
- table
- .foreignKey( "FK_roleID" )
- .references( "roleID" )
- .onTable( "cb_role" );
- } );
+ table
+ .foreignKey( "FK_permissionID" )
+ .references( "permissionID" )
+ .onTable( "cb_permission" );
+ table
+ .foreignKey( "FK_roleID" )
+ .references( "roleID" )
+ .onTable( "cb_role" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_roles.cfc b/modules/contentbox/migrations/init/create_roles.cfc
index 143467548d..a7f0b9ca8b 100644
--- a/modules/contentbox/migrations/init/create_roles.cfc
+++ b/modules/contentbox/migrations/init/create_roles.cfc
@@ -1,19 +1,22 @@
component {
- function up( schema, query ){
- schema.create( "cb_role", function( table ){
- // Base Columns
- table.string( "roleID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_role",
+ function( table ) {
+ table.string( "roleID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "role" ).unique();
- table.longText( "description" ).nullable();
- } );
+ table.string( "role" ).unique();
+ table.longText( "description" ).nullable();
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_security_logs.cfc b/modules/contentbox/migrations/init/create_security_logs.cfc
index 0aeed0a3bb..ceee1fc19a 100644
--- a/modules/contentbox/migrations/init/create_security_logs.cfc
+++ b/modules/contentbox/migrations/init/create_security_logs.cfc
@@ -1,32 +1,33 @@
component {
- function up( schema, query ){
- schema.create( "cbsecurity_logs", ( table ) => {
- // Base Columns
- table.string( "id", 36 ).primaryKey();
- table.datetime( "logDate" ).withCurrent();
- table.longText( "securityRule" );
- table.string( "action", 20 );
- table.string( "blockType", 20 );
- table.string( "ip", 100 );
- table.string( "host" );
- table.string( "httpMethod", 25 );
- table.string( "path" );
- table.string( "queryString" );
- table.string( "referer" );
- table.string( "userAgent" );
- table.string( "userId", 36 );
+ function up( schema, query ) {
+ schema.create(
+ "cbsecurity_logs",
+ ( table ) => {
+ table.string( "id", 36 ).primaryKey();
+ table.datetime( "logDate" ).withCurrent();
+ table.longText( "securityRule" );
+ table.string( "action", 20 );
+ table.string( "blockType", 20 );
+ table.string( "ip", 100 );
+ table.string( "host" );
+ table.string( "httpMethod", 25 );
+ table.string( "path" );
+ table.string( "queryString" );
+ table.string( "referer" );
+ table.string( "userAgent" );
+ table.string( "userId", 36 );
- // Index
- table.index( [ "logDate", "action", "blockType" ], "idx_cbsecurity" );
- table.index( [ "userId" ], "idx_cbsecurity_userId" );
- table.index( [ "userAgent" ], "idx_cbsecurity_userAgent" );
- table.index( [ "ip" ], "idx_cbsecurity_ip" );
- table.index( [ "host" ], "idx_cbsecurity_host" );
- table.index( [ "httpMethod" ], "idx_cbsecurity_httpMethod" );
- table.index( [ "path" ], "idx_cbsecurity_path" );
- table.index( [ "referer" ], "idx_cbsecurity_referer" );
- } );
+ table.index( [ "logDate", "action", "blockType"], "idx_cbsecurity" );
+ table.index( [ "userId"], "idx_cbsecurity_userId" );
+ table.index( [ "userAgent"], "idx_cbsecurity_userAgent" );
+ table.index( [ "ip"], "idx_cbsecurity_ip" );
+ table.index( [ "host"], "idx_cbsecurity_host" );
+ table.index( [ "httpMethod"], "idx_cbsecurity_httpMethod" );
+ table.index( [ "path"], "idx_cbsecurity_path" );
+ table.index( [ "referer"], "idx_cbsecurity_referer" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_security_rules.cfc b/modules/contentbox/migrations/init/create_security_rules.cfc
index d2300a9479..f1b6612b06 100755
--- a/modules/contentbox/migrations/init/create_security_rules.cfc
+++ b/modules/contentbox/migrations/init/create_security_rules.cfc
@@ -1,44 +1,45 @@
component {
- function up( schema, query ){
- schema.create( "cb_securityRule", ( table ) => {
- // Base Columns
- table.string( "ruleID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_securityRule",
+ ( table ) => {
+ table.string( "ruleID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "whitelist" ).nullable();
- table.string( "securelist" );
- table.string( "match", 50 ).nullable();
- table.string( "roles", 500 ).nullable();
- table.string( "permissions", 500 ).nullable();
- table.string( "redirect", 500 ).nullable();
- table.string( "overrideEvent", 500 ).nullable();
- table.boolean( "useSSL" ).default( false );
- table
- .string( "action", 50 )
- .nullable()
- .default( "redirect" );
- table.string( "module", 500 ).nullable();
- table
- .string( "httpMethods" )
- .nullable()
- .default( "*" );
- table
- .string( "allowedIPs" )
- .nullable()
- .default( "*" );
- table.integer( "order" ).default( 0 );
- table.string( "message" ).nullable();
- table
- .string( "messageType", 50 )
- .nullable()
- .default( "info" );
+ table.string( "whitelist" ).nullable();
+ table.string( "securelist" );
+ table.string( "match", 50 ).nullable();
+ table.string( "roles", 500 ).nullable();
+ table.string( "permissions", 500 ).nullable();
+ table.string( "redirect", 500 ).nullable();
+ table.string( "overrideEvent", 500 ).nullable();
+ table.boolean( "useSSL" ).default( false );
+ table
+ .string( "action", 50 )
+ .nullable()
+ .default( "redirect" );
+ table.string( "module", 500 ).nullable();
+ table
+ .string( "httpMethods" )
+ .nullable()
+ .default( "*" );
+ table
+ .string( "allowedIPs" )
+ .nullable()
+ .default( "*" );
+ table.integer( "order" ).default( 0 );
+ table.string( "message" ).nullable();
+ table
+ .string( "messageType", 50 )
+ .nullable()
+ .default( "info" );
- // Indexes
- table.index( [ "isDeleted" ], "idx_securityrules_deleted" );
- } );
+ table.index( [ "isDeleted"], "idx_securityrules_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_settings.cfc b/modules/contentbox/migrations/init/create_settings.cfc
index a9cfc6cc26..2d98bc9e2d 100755
--- a/modules/contentbox/migrations/init/create_settings.cfc
+++ b/modules/contentbox/migrations/init/create_settings.cfc
@@ -1,28 +1,28 @@
component {
- function up( schema, query ){
- schema.create( "cb_setting", ( table ) => {
- // Base Columns
- table.string( "settingID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_setting",
+ ( table ) => {
+ table.string( "settingID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "name" );
- table.longText( "value" );
- table.boolean( "isCore" ).default( false );
+ table.string( "name" );
+ table.longText( "value" );
+ table.boolean( "isCore" ).default( false );
- // Relationships
- table.string( "FK_siteID", 36 ).nullable();
- table
- .foreignKey( "FK_siteID" )
- .references( "siteID" )
- .onTable( "cb_site" );
+ table.string( "FK_siteID", 36 ).nullable();
+ table
+ .foreignKey( "FK_siteID" )
+ .references( "siteID" )
+ .onTable( "cb_site" );
- // Indexes
- table.index( [ "isCore" ], "idx_core" );
- table.index( [ "isDeleted" ], "idx_settings_deleted" );
- } );
+ table.index( [ "isCore"], "idx_core" );
+ table.index( [ "isDeleted"], "idx_settings_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_sites.cfc b/modules/contentbox/migrations/init/create_sites.cfc
index aca4324c90..4af104acb6 100755
--- a/modules/contentbox/migrations/init/create_sites.cfc
+++ b/modules/contentbox/migrations/init/create_sites.cfc
@@ -1,39 +1,40 @@
component {
- function up( schema, query ){
- schema.create( "cb_site", ( table ) => {
- // Base Columns
- table.string( "siteID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_site",
+ ( table ) => {
+ table.string( "siteID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "name" );
- table.string( "slug" ).unique();
- table.longText( "description" ).nullable();
- table.string( "domainRegex" ).nullable();
- table.string( "keywords" ).nullable();
- table.string( "tagline" ).nullable();
- table.string( "homepage" ).nullable();
- table.boolean( "isBlogEnabled" ).default( true );
- table.boolean( "isSitemapEnabled" ).default( true );
- table.boolean( "poweredByHeader" ).default( true );
- table.boolean( "adminBar" ).default( true );
- table.boolean( "isSSL" ).default( false );
- table.string( "activeTheme" ).nullable();
- table.longText( "notificationEmails" ).nullable();
- table.boolean( "notifyOnEntries" ).default( true );
- table.boolean( "notifyOnPages" ).default( true );
- table.boolean( "notifyOnContentStore" ).default( true );
- table.string( "domain" ).nullable();
- table.boolean( "isActive" ).default( true );
- table.string( "mediaDisk", 50 ).nullable();
- table.text( "domainAliases" ).nullable();
+ table.string( "name" );
+ table.string( "slug" ).unique();
+ table.longText( "description" ).nullable();
+ table.string( "domainRegex" ).nullable();
+ table.string( "keywords" ).nullable();
+ table.string( "tagline" ).nullable();
+ table.string( "homepage" ).nullable();
+ table.boolean( "isBlogEnabled" ).default( true );
+ table.boolean( "isSitemapEnabled" ).default( true );
+ table.boolean( "poweredByHeader" ).default( true );
+ table.boolean( "adminBar" ).default( true );
+ table.boolean( "isSSL" ).default( false );
+ table.string( "activeTheme" ).nullable();
+ table.longText( "notificationEmails" ).nullable();
+ table.boolean( "notifyOnEntries" ).default( true );
+ table.boolean( "notifyOnPages" ).default( true );
+ table.boolean( "notifyOnContentStore" ).default( true );
+ table.string( "domain" ).nullable();
+ table.boolean( "isActive" ).default( true );
+ table.string( "mediaDisk", 50 ).nullable();
+ table.text( "domainAliases" ).nullable();
- // Indexes
- table.index( [ "slug" ], "idx_siteSlug" );
- table.index( [ "isDeleted" ], "idx_sites_deleted" );
- } );
+ table.index( [ "slug"], "idx_siteSlug" );
+ table.index( [ "isDeleted"], "idx_sites_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_stats.cfc b/modules/contentbox/migrations/init/create_stats.cfc
index ab092577aa..b147990ffd 100755
--- a/modules/contentbox/migrations/init/create_stats.cfc
+++ b/modules/contentbox/migrations/init/create_stats.cfc
@@ -1,28 +1,29 @@
component {
- function up( schema, query ){
- schema.create( "cb_stats", function( table ){
- // Base Columns
- table.string( "statsID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_stats",
+ function( table ) {
+ table.string( "statsID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.bigInteger( "hits" ).default( 0 );
+ table.bigInteger( "hits" ).default( 0 );
- // Relationships
- table.string( "FK_contentID", 36 );
- table
- .foreignKey( "FK_contentID" )
- .references( "contentID" )
- .onTable( "cb_content" );
+ table.string( "FK_contentID", 36 );
+ table
+ .foreignKey( "FK_contentID" )
+ .references( "contentID" )
+ .onTable( "cb_content" );
- // Index
- table.index( [ "isDeleted" ], "idx_stats_deleted" );
- } );
+ table.index( [ "isDeleted"], "idx_stats_deleted" );
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_subscribers.cfc b/modules/contentbox/migrations/init/create_subscribers.cfc
index a400845436..918c097ea3 100755
--- a/modules/contentbox/migrations/init/create_subscribers.cfc
+++ b/modules/contentbox/migrations/init/create_subscribers.cfc
@@ -1,20 +1,21 @@
component {
- function up( schema, query ){
- schema.create( "cb_subscribers", ( table ) => {
- // Base Columns
- table.string( "subscriberID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_subscribers",
+ ( table ) => {
+ table.string( "subscriberID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "subscriberEmail" );
- table.string( "subscriberToken" );
+ table.string( "subscriberEmail" );
+ table.string( "subscriberToken" );
- // Indexes
- table.index( [ "subscriberEmail" ], "idx_subscriberEmail" );
- table.index( [ "isDeleted" ], "idx_subscribers_deleted" );
- } );
+ table.index( [ "subscriberEmail"], "idx_subscriberEmail" );
+ table.index( [ "isDeleted"], "idx_subscribers_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_subscriptions.cfc b/modules/contentbox/migrations/init/create_subscriptions.cfc
index c778b81263..f1d1c5d3c3 100755
--- a/modules/contentbox/migrations/init/create_subscriptions.cfc
+++ b/modules/contentbox/migrations/init/create_subscriptions.cfc
@@ -1,26 +1,26 @@
component {
- function up( schema, query ){
- schema.create( "cb_subscriptions", ( table ) => {
- // Base Columns
- table.string( "subscriptionID", 36 ).primaryKey();
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.boolean( "isDeleted" ).default( false );
+ function up( schema, query ) {
+ schema.create(
+ "cb_subscriptions",
+ ( table ) => {
+ table.string( "subscriptionID", 36 ).primaryKey();
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.boolean( "isDeleted" ).default( false );
- table.string( "type" );
- table.string( "subscriptionToken" );
+ table.string( "type" );
+ table.string( "subscriptionToken" );
- // Relationships
- table.string( "FK_subscriberID", 36 );
- table
- .foreignKey( "FK_subscriberID" )
- .references( "subscriberID" )
- .onTable( "cb_subscribers" );
+ table.string( "FK_subscriberID", 36 );
+ table
+ .foreignKey( "FK_subscriberID" )
+ .references( "subscriberID" )
+ .onTable( "cb_subscribers" );
- // Indexes
- table.index( [ "isDeleted" ], "idx_subscriptions_deleted" );
- } );
+ table.index( [ "isDeleted"], "idx_subscriptions_deleted" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/create_users.cfc b/modules/contentbox/migrations/init/create_users.cfc
index 865002d8d6..c025225b0e 100644
--- a/modules/contentbox/migrations/init/create_users.cfc
+++ b/modules/contentbox/migrations/init/create_users.cfc
@@ -1,47 +1,50 @@
component {
- function up( schema, query ){
- schema.create( "user", function( table ){
- table.string( "userId" ).primaryKey();
- table.string( "userType", 50 );
- table.datetime( "createdDate" ).withCurrent();
- table.datetime( "modifiedDate" ).withCurrent();
- table.tinyInteger( "isActive", 1 ).default( 1 );
- table.string( "fname", 100 );
- table.string( "lname", 100 );
- table.string( "title" );
- table.string( "email" ).unique();
- table.string( "password" );
- table.datetime( "lastLogin" ).nullable();
- table.string( "mobilePhone", 100 ).nullable();
- table.string( "homePhone", 100 ).nullable();
- table.date( "dob", 100 ).nullable();
- table.string( "tshirtSize", 100 ).nullable();
- table
- .longText( "preferences" )
- .default( "" )
- .nullable();
- table.string( "facebookURL" ).nullable();
- table.string( "twitterURL" ).nullable();
- table.string( "blogURL" ).nullable();
- table.string( "linkedinURL" ).nullable();
- table.string( "githubURL" ).nullable();
- table.tinyInteger( "isPasswordReset", 1 ).default( 1 );
- table.longText( "biography" ).nullable();
- table.string( "address" ).nullable();
- table.string( "city", 75 ).nullable();
- table.string( "stateOrProvince" ).nullable();
- table.string( "postalCode" ).nullable();
- table.string( "country", 75 );
- table.string( "timeZone", 150 );
- table.string( "FK_roleId" );
- table.string( "FK_clientId" ).nullable();
- table.string( "FK_managerId" ).nullable();
- } );
+ function up( schema, query ) {
+ schema.create(
+ "user",
+ function( table ) {
+ table.string( "userId" ).primaryKey();
+ table.string( "userType", 50 );
+ table.datetime( "createdDate" ).withCurrent();
+ table.datetime( "modifiedDate" ).withCurrent();
+ table.tinyInteger( "isActive", 1 ).default( 1 );
+ table.string( "fname", 100 );
+ table.string( "lname", 100 );
+ table.string( "title" );
+ table.string( "email" ).unique();
+ table.string( "password" );
+ table.datetime( "lastLogin" ).nullable();
+ table.string( "mobilePhone", 100 ).nullable();
+ table.string( "homePhone", 100 ).nullable();
+ table.date( "dob", 100 ).nullable();
+ table.string( "tshirtSize", 100 ).nullable();
+ table
+ .longText( "preferences" )
+ .default( "" )
+ .nullable();
+ table.string( "facebookURL" ).nullable();
+ table.string( "twitterURL" ).nullable();
+ table.string( "blogURL" ).nullable();
+ table.string( "linkedinURL" ).nullable();
+ table.string( "githubURL" ).nullable();
+ table.tinyInteger( "isPasswordReset", 1 ).default( 1 );
+ table.longText( "biography" ).nullable();
+ table.string( "address" ).nullable();
+ table.string( "city", 75 ).nullable();
+ table.string( "stateOrProvince" ).nullable();
+ table.string( "postalCode" ).nullable();
+ table.string( "country", 75 );
+ table.string( "timeZone", 150 );
+ table.string( "FK_roleId" );
+ table.string( "FK_clientId" ).nullable();
+ table.string( "FK_managerId" ).nullable();
+ }
+ );
}
- function down( schema, query ){
+ function down( schema, query ) {
schema.drop( "user" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/seed_permissions.cfc b/modules/contentbox/migrations/init/seed_permissions.cfc
index a277304abe..48fdc81607 100644
--- a/modules/contentbox/migrations/init/seed_permissions.cfc
+++ b/modules/contentbox/migrations/init/seed_permissions.cfc
@@ -1,200 +1,203 @@
component {
- function seed( schema, query ){
+ function seed( schema, query ) {
var perms = [
{
- "permission" : "AUTHOR_ADMIN",
- "description" : "Ability to manage authors, default is view only"
+ "permission" : "AUTHOR_ADMIN",
+ "description": "Ability to manage authors, default is view only"
},
{
- "permission" : "CATEGORIES_ADMIN",
- "description" : "Ability to manage categories, default is view only"
+ "permission" : "CATEGORIES_ADMIN",
+ "description": "Ability to manage categories, default is view only"
},
{
- "permission" : "COMMENTS_ADMIN",
- "description" : "Ability to manage comments, default is view only"
+ "permission" : "COMMENTS_ADMIN",
+ "description": "Ability to manage comments, default is view only"
},
{
- "permission" : "CONTENTBOX_ADMIN",
- "description" : "Access to the enter the ContentBox administrator console"
+ "permission" : "CONTENTBOX_ADMIN",
+ "description": "Access to the enter the ContentBox administrator console"
},
{
- "permission" : "CONTENTSTORE_ADMIN",
- "description" : "Ability to manage the content store, default is view only"
+ "permission" : "CONTENTSTORE_ADMIN",
+ "description": "Ability to manage the content store, default is view only"
},
{
- "permission" : "CONTENTSTORE_EDITOR",
- "description" : "Ability to create, edit and publish content store elements"
+ "permission" : "CONTENTSTORE_EDITOR",
+ "description": "Ability to create, edit and publish content store elements"
},
{
- "permission" : "EDITORS_CACHING",
- "description" : "Ability to view the content caching panel"
+ "permission" : "EDITORS_CACHING",
+ "description": "Ability to view the content caching panel"
},
{
- "permission" : "EDITORS_CATEGORIES",
- "description" : "Ability to view the content categories panel"
+ "permission" : "EDITORS_CATEGORIES",
+ "description": "Ability to view the content categories panel"
},
{
- "permission" : "EDITORS_CUSTOM_FIELDS",
- "description" : "Ability to manage custom fields in any content editors"
+ "permission" : "EDITORS_CUSTOM_FIELDS",
+ "description": "Ability to manage custom fields in any content editors"
},
{
- "permission" : "EDITORS_DISPLAY_OPTIONS",
- "description" : "Ability to view the content display options panel"
+ "permission" : "EDITORS_DISPLAY_OPTIONS",
+ "description": "Ability to view the content display options panel"
},
{
- "permission" : "EDITORS_EDITOR_SELECTOR",
- "description" : "Ability to change the editor to another registered online editor"
+ "permission" : "EDITORS_EDITOR_SELECTOR",
+ "description": "Ability to change the editor to another registered online editor"
},
{
- "permission" : "EDITORS_FEATURED_IMAGE",
- "description" : "Ability to view the featured image panel"
+ "permission" : "EDITORS_FEATURED_IMAGE",
+ "description": "Ability to view the featured image panel"
},
{
- "permission" : "EDITORS_HTML_ATTRIBUTES",
- "description" : "Ability to view the content HTML attributes panel"
+ "permission" : "EDITORS_HTML_ATTRIBUTES",
+ "description": "Ability to view the content HTML attributes panel"
},
{
- "permission" : "EDITORS_LINKED_CONTENT",
- "description" : "Ability to view the linked content panel"
+ "permission" : "EDITORS_LINKED_CONTENT",
+ "description": "Ability to view the linked content panel"
},
{
- "permission" : "EDITORS_MODIFIERS",
- "description" : "Ability to view the content modifiers panel"
+ "permission" : "EDITORS_MODIFIERS",
+ "description": "Ability to view the content modifiers panel"
},
{
- "permission" : "EDITORS_RELATED_CONTENT",
- "description" : "Ability to view the related content panel"
+ "permission" : "EDITORS_RELATED_CONTENT",
+ "description": "Ability to view the related content panel"
},
{
- "permission" : "EMAIL_TEMPLATE_ADMIN",
- "description" : "Ability to admin and preview email templates"
+ "permission" : "EMAIL_TEMPLATE_ADMIN",
+ "description": "Ability to admin and preview email templates"
},
{
- "permission" : "ENTRIES_ADMIN",
- "description" : "Ability to manage blog entries, default is view only"
+ "permission" : "ENTRIES_ADMIN",
+ "description": "Ability to manage blog entries, default is view only"
},
{
- "permission" : "ENTRIES_EDITOR",
- "description" : "Ability to create, edit and publish blog entries"
+ "permission" : "ENTRIES_EDITOR",
+ "description": "Ability to create, edit and publish blog entries"
},
{
- "permission" : "FORGEBOX_ADMIN",
- "description" : "Ability to manage ForgeBox installations and connectivity."
+ "permission" : "FORGEBOX_ADMIN",
+ "description": "Ability to manage ForgeBox installations and connectivity."
},
{
- "permission" : "GLOBAL_SEARCH",
- "description" : "Ability to do global searches in the ContentBox Admin"
+ "permission" : "GLOBAL_SEARCH",
+ "description": "Ability to do global searches in the ContentBox Admin"
},
{
- "permission" : "GLOBALHTML_ADMIN",
- "description" : "Ability to manage the system's global HTML content used on layouts"
+ "permission" : "GLOBALHTML_ADMIN",
+ "description": "Ability to manage the system's global HTML content used on layouts"
},
{
- "permission" : "MEDIAMANAGER_ADMIN",
- "description" : "Ability to manage the system's media manager"
+ "permission" : "MEDIAMANAGER_ADMIN",
+ "description": "Ability to manage the system's media manager"
},
{
- "permission" : "MEDIAMANAGER_LIBRARY_SWITCHER",
- "description" : "Ability to switch media manager libraries for management"
+ "permission" : "MEDIAMANAGER_LIBRARY_SWITCHER",
+ "description": "Ability to switch media manager libraries for management"
},
{
- "permission" : "MENUS_ADMIN",
- "description" : "Ability to manage the menu builder"
+ "permission" : "MENUS_ADMIN",
+ "description": "Ability to manage the menu builder"
},
{
- "permission" : "MODULES_ADMIN",
- "description" : "Ability to manage ContentBox Modules"
+ "permission" : "MODULES_ADMIN",
+ "description": "Ability to manage ContentBox Modules"
},
{
- "permission" : "PAGES_ADMIN",
- "description" : "Ability to manage content pages, default is view only"
+ "permission" : "PAGES_ADMIN",
+ "description": "Ability to manage content pages, default is view only"
},
{
- "permission" : "PAGES_EDITOR",
- "description" : "Ability to create, edit and publish pages"
+ "permission" : "PAGES_EDITOR",
+ "description": "Ability to create, edit and publish pages"
},
{
- "permission" : "PERMISSIONS_ADMIN",
- "description" : "Ability to manage permissions, default is view only"
+ "permission" : "PERMISSIONS_ADMIN",
+ "description": "Ability to manage permissions, default is view only"
},
{
- "permission" : "RELOAD_MODULES",
- "description" : "Ability to reload modules"
+ "permission" : "RELOAD_MODULES",
+ "description": "Ability to reload modules"
},
{
- "permission" : "RELOAD_CACHES",
- "description" : "Ability to reload caches"
+ "permission" : "RELOAD_CACHES",
+ "description": "Ability to reload caches"
},
{
- "permission" : "ROLES_ADMIN",
- "description" : "Ability to manage roles, default is view only"
+ "permission" : "ROLES_ADMIN",
+ "description": "Ability to manage roles, default is view only"
},
{
- "permission" : "SECURITYRULES_ADMIN",
- "description" : "Ability to manage the system's security rules, default is view only"
+ "permission" : "SECURITYRULES_ADMIN",
+ "description": "Ability to manage the system's security rules, default is view only"
},
{
- "permission" : "SITES_ADMIN",
- "description" : "Ability to manage sites"
+ "permission" : "SITES_ADMIN",
+ "description": "Ability to manage sites"
},
{
- "permission" : "SYSTEM_AUTH_LOGS",
- "description" : "Access to the system auth logs"
+ "permission" : "SYSTEM_AUTH_LOGS",
+ "description": "Access to the system auth logs"
},
{
- "permission" : "SYSTEM_RAW_SETTINGS",
- "description" : "Access to the ContentBox raw geek settings panel"
+ "permission" : "SYSTEM_RAW_SETTINGS",
+ "description": "Access to the ContentBox raw geek settings panel"
},
{
- "permission" : "SYSTEM_SAVE_CONFIGURATION",
- "description" : "Ability to update global configuration data"
+ "permission" : "SYSTEM_SAVE_CONFIGURATION",
+ "description": "Ability to update global configuration data"
},
{
- "permission" : "SYSTEM_TAB",
- "description" : "Access to the ContentBox System tools"
+ "permission" : "SYSTEM_TAB",
+ "description": "Access to the ContentBox System tools"
},
{
- "permission" : "SYSTEM_UPDATES",
- "description" : "Ability to view and apply ContentBox updates"
+ "permission" : "SYSTEM_UPDATES",
+ "description": "Ability to view and apply ContentBox updates"
},
{
- "permission" : "THEME_ADMIN",
- "description" : "Ability to manage layouts, default is view only"
+ "permission" : "THEME_ADMIN",
+ "description": "Ability to manage layouts, default is view only"
},
{
- "permission" : "TOOLS_EXPORT",
- "description" : "Ability to export data from ContentBox"
+ "permission" : "TOOLS_EXPORT",
+ "description": "Ability to export data from ContentBox"
},
{
- "permission" : "TOOLS_IMPORT",
- "description" : "Ability to import data into ContentBox"
+ "permission" : "TOOLS_IMPORT",
+ "description": "Ability to import data into ContentBox"
},
{
- "permission" : "VERSIONS_DELETE",
- "description" : "Ability to delete past content versions"
+ "permission" : "VERSIONS_DELETE",
+ "description": "Ability to delete past content versions"
},
{
- "permission" : "VERSIONS_ROLLBACK",
- "description" : "Ability to rollback content versions"
+ "permission" : "VERSIONS_ROLLBACK",
+ "description": "Ability to rollback content versions"
},
{
- "permission" : "WIDGET_ADMIN",
- "description" : "Ability to manage widgets, default is view only"
+ "permission" : "WIDGET_ADMIN",
+ "description": "Ability to manage widgets, default is view only"
}
- ];
+ ]
- perms = perms.map( ( thisPerm ) => {
- thisPerm[ "permissionID" ] = createUUID();
- thisPerm[ "isDeleted" ] = 0;
- thisPerm[ "createdDate" ] = thisPerm[ "modifiedDate" ] = now();
- return thisPerm;
- } );
+ var falseBinding = query.getGrammar().convertToBooleanType( false )
+ perms = perms.map(
+ ( thisPerm ) => {
+ thisPerm[ "permissionID" ] = createUUID()
+ thisPerm[ "isDeleted" ] = falseBinding
+ thisPerm[ "createdDate" ] = thisPerm[ "modifiedDate" ] = now()
+ return thisPerm
+ }
+ )
query
.newQuery()
.from( "cb_permission" )
- .insert( perms );
+ .insert( perms )
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/init/seed_roles.cfc b/modules/contentbox/migrations/init/seed_roles.cfc
index 92b8e4b871..2b1b364188 100644
--- a/modules/contentbox/migrations/init/seed_roles.cfc
+++ b/modules/contentbox/migrations/init/seed_roles.cfc
@@ -1,22 +1,25 @@
component {
- function seed( schema, query ){
+ function seed( schema, query ) {
+ var falseBinding = query.getGrammar().convertToBooleanType( false )
+ var trueBinding = query.getGrammar().convertToBooleanType( true )
+
var admin = {
- "roleID" : createUUID(),
- "isDeleted" : 0,
- "createdDate" : now(),
- "modifiedDate" : now(),
- "role" : "Administrator",
- "description" : "A ContentBox Administrator"
- };
+ "roleID" : createUUID(),
+ "isDeleted" : falseBinding,
+ "createdDate" : now(),
+ "modifiedDate": now(),
+ "role" : "Administrator",
+ "description" : "A ContentBox Administrator"
+ }
var editor = {
- "roleID" : createUUID(),
- "isDeleted" : 0,
- "createdDate" : now(),
- "modifiedDate" : now(),
- "role" : "Editor",
- "description" : "A ContentBox Editor"
- };
+ "roleID" : createUUID(),
+ "isDeleted" : falseBinding,
+ "createdDate" : now(),
+ "modifiedDate": now(),
+ "role" : "Editor",
+ "description" : "A ContentBox Editor"
+ }
// ADMIN ROLE
@@ -30,15 +33,19 @@ component {
.from( "cb_permission" )
.get();
- allPerms.each( ( record ) => {
- query
- .newQuery()
- .from( "cb_rolePermissions" )
- .insert( {
- "FK_permissionID" : record.permissionID,
- "FK_roleID" : admin.roleID
- } );
- } );
+ allPerms.each(
+ ( record ) => {
+ query
+ .newQuery()
+ .from( "cb_rolePermissions" )
+ .insert(
+ {
+ "FK_permissionID": record.permissionID,
+ "FK_roleID" : admin.roleID
+ }
+ );
+ }
+ );
systemOutput( "√ Admin role and permissions created", true );
@@ -77,22 +84,26 @@ component {
"VERSIONS_ROLLBACK"
];
- allPerms
- .filter( ( record ) => {
- return editorPerms.contains( record.permission );
- } )
- .each( ( record ) => {
- query
- .newQuery()
- .from( "cb_rolePermissions" )
- .insert( {
- "FK_permissionID" : record.permissionID,
- "FK_roleID" : editor.roleID
- } );
- } );
+ allPerms.filter(
+ ( record ) => {
+ return editorPerms.contains( record.permission );
+ }
+ ).each(
+ ( record ) => {
+ query
+ .newQuery()
+ .from( "cb_rolePermissions" )
+ .insert(
+ {
+ "FK_permissionID": record.permissionID,
+ "FK_roleID" : editor.roleID
+ }
+ );
+ }
+ );
systemOutput( "√ Editor role created", true );
systemOutput( "√ Roles seeded", true );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/migrations/util/MigrationUtils.cfm b/modules/contentbox/migrations/util/MigrationUtils.cfm
index 0d06855816..16003a345e 100644
--- a/modules/contentbox/migrations/util/MigrationUtils.cfm
+++ b/modules/contentbox/migrations/util/MigrationUtils.cfm
@@ -1,156 +1,189 @@
-/**
- * This utility file is a collection of migration utilities that ContentBox will use
- */
+ /**
+ * This utility file is a collection of migration utilities that ContentBox will use
+ */
-/**
- * Get a new java based UUID
- */
-function getUUID(){
- if( isNull( variables.uuidLib ) ){
- variables.uuidLib = createObject( "java", "java.util.UUID" );
+ /**
+ * Get a new java based UUID
+ */
+ function getUUID() {
+ if ( isNull( variables.uuidLib ) ) {
+ variables.uuidLib = createObject( "java", "java.util.UUID" );
+ }
+ return variables
+ .uuidLib
+ .randomUUID()
+ .toString();
}
- return variables.uuidLib.randomUUID().toString();
-}
-/**
- * Verify if a table has a column or not
- *
- * @targetTable The table to check
- * @targetcolumn The column to check
- */
-boolean function hasColumn( targetTable, targetColumn ){
- // Check for column created
- cfdbinfo(
- name = "local.qSettingColumns",
- type = "columns",
- table = arguments.targetTable
- );
+ /**
+ * Verify if a table has a column or not
+ *
+ * @targetTable The table to check
+ * @targetcolumn The column to check
+ */
+ boolean function hasColumn( targetTable, targetColumn ) {
- if (
- qSettingColumns.filter( ( thisRow ) => {
- // systemOutput( thisRow, true );
- return thisRow.column_name == targetColumn
- } ).recordCount > 0
- ) {
- return true;
- }
- return false;
-}
+ try{
+ // Use information_schema directly so the check is dialect-safe and preserves
+ // identifier case (cfdbinfo lowercases table names which breaks on PostgreSQL).
+ var result = queryExecute(
+ "SELECT 1 FROM information_schema.columns WHERE table_name = :tableName AND column_name = :columnName",
+ {
+ tableName : arguments.targetTable,
+ columnName : arguments.targetColumn
+ }
+ )
+ return result.recordCount > 0
+ } catch ( any e ) {
+ // If not, fall back to the this method.
+ // Check for column created
+ dbinfo name ="local.qSettingColumns" type ="columns" table="#arguments.targetTable#";
-/**
- * Generate a list of indexes from the database
- *
- * @schemaName The name of database
- * @tableName The name of table from database
- * @indexName The index name to search
- * @qb QB instance
- * @selectOptions The Index columns that we need to show
- *
- * @return array with database index information
- * */
-Array function listIndexesFromSchema(
- required string schemaName,
- required string tableName,
- required string indexName,
- required qb,
- string selectOptions = "index_name"
-){
- return qb.select( arguments.selectOptions )
- .distinct()
- .from( "information_schema.statistics" )
- .where( "table_schema", arguments.schemaName )
- .where( "table_name", arguments.tableName )
- .where( "index_name", "like", "%#indexName#%" )
- .get();
-}
+ if (
+ qSettingColumns.filter(
+ ( thisRow ) => {
+ return thisRow.column_name == targetColumn;
+ }
+ )// systemOutput( thisRow, true );
+
+ .recordCount >
+ 0
+ ) {
+ return true
+ }
+ return false
+ }
+ }
-/**
- * Drop indexes fron database
- *
- * @indexes The Array of indexes to delete
- * @schema The schema instance from QB
- * @tableName The name of table from database
- *
- * @return void
- * */
-function dropIndexesFromSchema(
- required array indexes,
- required schema,
- required string tableName
-){
- indexes.each( ( index ) => {
- schema.alter( "#tableName#", function( table ) {
- table.dropConstraint( table.index( [], "#index.index_name#" ) );
- } );
- } );
-}
+ /**
+ * Generate a list of indexes from the database
+ *
+ * @schemaName The name of database
+ * @tableName The name of table from database
+ * @indexName The index name to search
+ * @qb QB instance
+ * @selectOptions The Index columns that we need to show
+ *
+ * @return array with database index information
+ **/
+ array function listIndexesFromSchema(
+ required string schemaName,
+ required string tableName,
+ required string indexName,
+ required qb,
+ string selectOptions = "index_name"
+ ) {
+ return qb
+ .select( arguments.selectOptions )
+ .distinct()
+ .from( "information_schema.statistics" )
+ .where( "table_schema", arguments.schemaName )
+ .where( "table_name", arguments.tableName )
+ .where(
+ "index_name",
+ "like",
+ "%#indexName#%"
+ )
+ .get();
+ }
-/**
- * Add permission for a specific role
- *
- * @query The query instance from QB
- * @roleId The roleId
- * @permission The permission name
- *
- * @return void
- * */
-function addPermissionToRole( query, roleId, permission ){
- var permissionId = arguments.query
- .newQuery()
- .select( "permissionID" )
- .from( "cb_permission" )
- .where( "permission", arguments.permission )
- .first()
- .permissionId;
- arguments.query
- .newQuery()
- .from( "cb_rolePermissions" )
- .insert( {
- "FK_roleID" : arguments.roleId,
- "FK_permissionID" : permissionId
- } );
-}
+ /**
+ * Drop indexes fron database
+ *
+ * @indexes The Array of indexes to delete
+ * @schema The schema instance from QB
+ * @tableName The name of table from database
+ *
+ * @return void
+ **/
+ function dropIndexesFromSchema(
+ required array indexes,
+ required schema,
+ required string tableName
+ ) {
+ indexes.each(
+ ( index ) => {
+ schema.alter(
+ "#tableName#",
+ function( table ) {
+ table.dropConstraint( table.index( [], "#index.index_name#" ) );
+ }
+ );
+ }
+ );
+ }
-/**
- * Remove permission for a specific role
- *
- * @query The query instance from QB
- * @roleId The roleId
- * @permission The permission name
- *
- * @return void
- * */
-function removePermissionFromRole( query, roleId, permission ){
- var permissionId = arguments.query
- .newQuery()
- .select( "permissionID" )
- .from( "cb_permission" )
- .where( "permission", arguments.permission )
- .first()
- .permissionId;
- arguments.query
- .newQuery()
- .from( "cb_rolePermissions" )
- .where( "FK_roleID", arguments.roleId )
- .andWhere( "FK_permissionID", permissionId )
- .delete();
-}
+ /**
+ * Add permission for a specific role
+ *
+ * @query The query instance from QB
+ * @roleId The roleId
+ * @permission The permission name
+ *
+ * @return void
+ **/
+ function addPermissionToRole( query, roleId, permission ) {
+ var permissionId = arguments
+ .query
+ .newQuery()
+ .select( "permissionID" )
+ .from( "cb_permission" )
+ .where( "permission", arguments.permission )
+ .first().permissionId;
+ arguments
+ .query
+ .newQuery()
+ .from( "cb_rolePermissions" )
+ .insert(
+ {
+ "FK_roleID" : arguments.roleId,
+ "FK_permissionID": permissionId
+ }
+ );
+ }
-/**
- * Remove a permission from the system
- *
- * @query QB
- * @permission A slug or a list of slugs or an array of permissions
- */
-function removePermission( query, permission ){
- if( isSimpleValue( arguments.permission ) ){
- arguments.permission = listToArray( arguments.permission )
+ /**
+ * Remove permission for a specific role
+ *
+ * @query The query instance from QB
+ * @roleId The roleId
+ * @permission The permission name
+ *
+ * @return void
+ **/
+ function removePermissionFromRole( query, roleId, permission ) {
+ var permissionId = arguments
+ .query
+ .newQuery()
+ .select( "permissionID" )
+ .from( "cb_permission" )
+ .where( "permission", arguments.permission )
+ .first().permissionId;
+ arguments
+ .query
+ .newQuery()
+ .from( "cb_rolePermissions" )
+ .where( "FK_roleID", arguments.roleId )
+ .andWhere( "FK_permissionID", permissionId )
+ .delete();
}
- arguments.query
+
+ /**
+ * Remove a permission from the system
+ *
+ * @query QB
+ * @permission A slug or a list of slugs or an array of permissions
+ */
+ function removePermission( query, permission ) {
+ if ( isSimpleValue( arguments.permission ) ) {
+ arguments.permission = listToArray( arguments.permission );
+ }
+ arguments
+ .query
.newQuery()
.from( "cb_permissions" )
.whereIn( "permission", arguments.permission )
.delete();
-}
+ }
diff --git a/modules/contentbox/models/BaseEntity.cfc b/modules/contentbox/models/BaseEntity.cfc
index 998fd15f5b..cef0ed1890 100644
--- a/modules/contentbox/models/BaseEntity.cfc
+++ b/modules/contentbox/models/BaseEntity.cfc
@@ -5,39 +5,34 @@
* ---
* This is the base class for all persistent entities
*/
-component
- mappedsuperclass="true"
- accessors ="true"
- extends ="BaseEntityMethods"
-{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+component mappedsuperclass="true" accessors ="true" extends ="BaseEntityMethods" {
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="createdDate"
- column ="createdDate"
- type ="date"
- ormtype ="timestamp"
- notnull ="true"
- update ="false"
+ name="createdDate"
+ column="createdDate"
+ type="date"
+ ormtype="timestamp"
+ notnull="true"
+ update="false"
persistent="true";
property
- name ="modifiedDate"
- column ="modifiedDate"
- type ="date"
- ormtype ="timestamp"
- notnull ="true"
+ name="modifiedDate"
+ column="modifiedDate"
+ type="date"
+ ormtype="timestamp"
+ notnull="true"
persistent=true;
property
- name ="isDeleted"
- column ="isDeleted"
- ormtype ="boolean"
- notnull ="true"
- default ="false"
+ name="isDeleted"
+ column="isDeleted"
+ ormtype="boolean"
+ notnull="true"
+ default="false"
persistent="true";
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/BaseEntityMethods.cfc b/modules/contentbox/models/BaseEntityMethods.cfc
index a724f33759..7d1ab45c3d 100644
--- a/modules/contentbox/models/BaseEntityMethods.cfc
+++ b/modules/contentbox/models/BaseEntityMethods.cfc
@@ -7,72 +7,67 @@
* We created this due to the stupid bug in ACF 9-2016, where the mapped super class is not respected in table inheritance
*/
component {
+ /**********************************************************************
+ * ** GLOBAL DI
+ **********************************************************************/
- /* *********************************************************************
- ** GLOBAL DI
- ********************************************************************* */
+ property name="coldbox" inject="provider:coldbox" persistent="false";
- property
- name ="coldbox"
- inject ="provider:coldbox"
- persistent="false";
-
- property
- name ="cachebox"
- inject ="provider:cachebox"
- persistent="false";
-
- property
- name ="interceptorService"
- inject ="provider:coldbox:interceptorService"
- persistent="false";
+ property name="cachebox" inject="provider:cachebox" persistent="false";
property
- name ="wirebox"
- inject ="wirebox"
+ name="interceptorService"
+ inject="provider:coldbox:interceptorService"
persistent="false";
- /* *********************************************************************
- ** CONCRETE PROPERTIES
- ********************************************************************* */
+ property name="wirebox" inject="wirebox" persistent="false";
+ /**********************************************************************
+ * ** CONCRETE PROPERTIES
+ **********************************************************************/
// PK Pointer
- this.pk = "PLEASE_SELECT_ONE";
+ this.pk = "PLEASE_SELECT_ONE";
// Constraints Default
this.constraints = {};
- /* *********************************************************************
- ** PUBLIC STATIC VARIABLES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC STATIC VARIABLES
+ **********************************************************************/
- this.DATE_FORMAT = "mmm dd, yyyy";
+ this.DATE_FORMAT = "mmm dd, yyyy";
this.DATE_FORMAT_SHORT = "mmm-dd-yyyy";
- this.TIME_FORMAT = "HH:mm:ss z";
+ this.TIME_FORMAT = "HH:mm:ss z";
this.TIME_FORMAT_SHORT = "hh:mm tt";
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
+ function init() {
// Calculate name via md
getEntityName();
- variables.createdDate = now();
+ variables.createdDate = now();
variables.modifiedDate = now();
- variables.isDeleted = false;
+ variables.isDeleted = false;
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 ) ) {
- this.memento.defaultExcludes.append( [ "isDeleted" ], true );
+ this
+ .memento
+ .defaultExcludes
+ .append( [ "isDeleted"], true );
}
this.memento.baseIncluded = true;
}
@@ -83,9 +78,9 @@ component {
/**
* Get the entity name
*/
- function getEntityName(){
+ function getEntityName() {
if ( isNull( variables.entityName ) ) {
- var md = getMetadata( this );
+ var md = getMetadata( this );
variables.entityName = ( md.keyExists( "entityName" ) ? md.entityName : listLast( md.name, "." ) );
}
@@ -98,10 +93,12 @@ component {
* @collection The array to append
* @target The target to append to: defaultIncludes, defaultExcludes, neverInclude, defaults, etc.
*/
- function appendToMemento( required collection, target = "defaultIncludes" ){
- var filtered = arguments.collection.filter( function( item ){
- return !arrayContainsNoCase( this.memento[ target ], arguments.item );
- } );
+ function appendToMemento( required collection, target = "defaultIncludes" ) {
+ var filtered = arguments.collection.filter(
+ function( item ) {
+ return !arrayContainsNoCase( this.memento[ target ], arguments.item );
+ }
+ );
this.memento[ arguments.target ].append( filtered, true );
return this;
}
@@ -117,10 +114,12 @@ component {
required collection,
required profile,
target = "defaultIncludes"
- ){
- var filtered = arguments.collection.filter( function( item ){
- return !arrayContainsNoCase( this.memento.profiles[ profile ][ target ], arguments.item );
- } );
+ ) {
+ var filtered = arguments.collection.filter(
+ function( item ) {
+ return !arrayContainsNoCase( this.memento.profiles[ profile ][ target ], arguments.item );
+ }
+ );
this.memento.profiles[ arguments.profile ][ arguments.target ].append( filtered, true );
return this;
}
@@ -130,14 +129,14 @@ component {
*
* @return The id of the object or empty value if not loaded
*/
- function getId(){
+ function getId() {
return isLoaded() ? variables[ this.pk ] : "";
}
/**
* pre insertion procedures
*/
- void function preInsert(){
+ void function preInsert() {
var now = now();
// prevent override of explicit stamps from imports
if ( isNull( variables.createdDate ) ) {
@@ -151,7 +150,7 @@ component {
/**
* pre update procedures
*/
- void function preUpdate( struct oldData ){
+ void function preUpdate( struct oldData ) {
variables.modifiedDate = now();
}
@@ -161,14 +160,15 @@ component {
* @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy
* @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z
*/
- 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 "";
}
- return dateFormat( variables.createdDate, arguments.dateFormat ) & " " & timeFormat(
- variables.createdDate,
- arguments.timeFormat
- );
+ return dateFormat( variables.createdDate, arguments.dateFormat ) & " " & timeFormat( variables.createdDate,
+ arguments.timeFormat );
}
/**
@@ -177,21 +177,22 @@ component {
* @dateFormat The date format to use, defaulted by ContentBox to mmm dd, yyyy
* @timeFormat The time format to use, defaulted by ContentBox to HH:mm:ss z
*/
- 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 "";
}
- return dateFormat( variables.modifiedDate, arguments.dateFormat ) & " " & timeFormat(
- variables.modifiedDate,
- arguments.timeFormat
- );
+ return dateFormat( variables.modifiedDate, arguments.dateFormat ) & " " & timeFormat( variables.modifiedDate,
+ arguments.timeFormat );
}
/**
* Verify if entity is loaded or not
*/
- boolean function isLoaded(){
- return ( !structKeyExists( variables, this.pk ) OR !len( variables[ this.pk ] ) ? false : true );
+ boolean function isLoaded() {
+ return ( !structKeyExists( variables, this.pk ) || !len( variables[ this.pk ] ) ? false : true );
}
/**
@@ -201,50 +202,44 @@ component {
*
* @throws ContentHelperNotFoundException - When the passed helper is not found
*/
- function includeMixin( required helper ){
+ function includeMixin( required helper ) {
// Init the mixin location and caches reference
- var defaultCache = variables.cachebox.getCache( "default" );
+ var defaultCache = variables.cachebox.getCache( "default" );
var mixinLocationKey = hash( variables.coldbox.getAppHash() & arguments.helper );
var targetLocation = defaultCache.getOrSet(
- // Key
- "contentObjectHelper-#mixinLocationKey#",
- // Producer
- function(){
- var appMapping = variables.coldbox.getSetting( "AppMapping" );
- var UDFFullPath = expandPath( helper );
- var UDFRelativePath = expandPath( "/" & appMapping & "/" & helper );
+ "contentObjectHelper-#mixinLocationKey#",
+ function() {
+ var appMapping = variables.coldbox.getSetting( "AppMapping" );
+ var UDFFullPath = expandPath( helper );
+ var UDFRelativePath = expandPath( "/" & appMapping & "/" & helper );
- // Relative Checks First
- if ( fileExists( UDFRelativePath ) ) {
- targetLocation = "/" & appMapping & "/" & helper;
- }
- // checks if no .cfc or .cfm where sent
- else if ( fileExists( UDFRelativePath & ".cfc" ) ) {
- targetLocation = "/" & appMapping & "/" & helper & ".cfc";
- } else if ( fileExists( UDFRelativePath & ".cfm" ) ) {
- targetLocation = "/" & appMapping & "/" & helper & ".cfm";
- } else if ( fileExists( UDFFullPath ) ) {
- targetLocation = "#helper#";
- } else if ( fileExists( UDFFullPath & ".cfc" ) ) {
- targetLocation = "#helper#.cfc";
- } else if ( fileExists( UDFFullPath & ".cfm" ) ) {
- targetLocation = "#helper#.cfm";
- } else {
- throw(
- message = "Error loading content helper: #helper#",
- detail = "Please make sure you verify the file location.",
- type = "ContentHelperNotFoundException"
- );
- }
- return targetLocation;
- },
- // Timeout: 1 week
- 10080
- );
+ if ( fileExists( UDFRelativePath ) ) {
+ targetLocation = "/" & appMapping & "/" & helper;
+ } else if ( fileExists( UDFRelativePath & ".cfc" ) ) {
+ targetLocation = "/" & appMapping & "/" & helper & ".cfc";
+ } else if ( fileExists( UDFRelativePath & ".cfm" ) ) {
+ targetLocation = "/" & appMapping & "/" & helper & ".cfm";
+ } else if ( fileExists( UDFFullPath ) ) {
+ targetLocation = "#helper#";
+ } else if ( fileExists( UDFFullPath & ".cfc" ) ) {
+ targetLocation = "#helper#.cfc";
+ } else if ( fileExists( UDFFullPath & ".cfm" ) ) {
+ targetLocation = "#helper#.cfm";
+ } else {
+ throw(
+ message = "Error loading content helper: #helper#",
+ detail = "Please make sure you verify the file location.",
+ type = "ContentHelperNotFoundException"
+ );
+ }
+ return targetLocation;
+ },
+ 10080
+ );
// Include the helper
- include targetLocation;
+ include "#targetLocation#";
return this;
}
@@ -256,8 +251,8 @@ component {
*
* @return An array
*/
- private array function arrayWrap( required items ){
+ private array function arrayWrap( required items ) {
return isArray( arguments.items ) ? arguments.items : listToArray( arguments.items );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/comments/Comment.cfc b/modules/contentbox/models/comments/Comment.cfc
index 9f286d7602..46a7a33167 100755
--- a/modules/contentbox/models/comments/Comment.cfc
+++ b/modules/contentbox/models/comments/Comment.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -14,87 +14,75 @@ component
cachename ="cbComment"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="markdown"
- inject ="provider:Processor@cbmarkdown"
+ name="markdown"
+ inject="provider:Processor@cbmarkdown"
persistent="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="commentID"
- column ="commentID"
+ name="commentID"
+ column="commentID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
- property
- name ="content"
- ormtype="text"
- notnull="true";
+ property name="content" ormtype="text" notnull="true";
- property
- name ="author"
- length ="100"
- notnull="true";
+ property name="author" length="100" notnull="true";
- property
- name ="authorIP"
- column ="authorIP"
- length ="100"
- notnull="true";
+ property name="authorIP" column="authorIP" length="100" notnull="true";
property
- name ="authorEmail"
- column ="authorEmail"
- length ="255"
+ name="authorEmail"
+ column="authorEmail"
+ length="255"
notnull="true";
property
- name ="authorURL"
- column ="authorURL"
- length ="255"
+ name="authorURL"
+ column="authorURL"
+ length="255"
notnull="false";
property
- name ="isApproved"
- column ="isApproved"
+ name="isApproved"
+ column="isApproved"
notnull="true"
ormtype="boolean"
default="false"
- index ="idx_contentComment,idx_approved";
+ index="idx_contentComment,idx_approved";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> Content loaded as a proxy
property
- name ="relatedContent"
- notnull ="true"
- cfc ="contentbox.models.content.BaseContent"
+ name="relatedContent"
+ notnull="true"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="many-to-one"
- fkcolumn ="FK_contentID"
- lazy ="true"
- index ="idx_contentComment";
-
- /* *********************************************************************
- ** CONSTRAINTS + PK
- ********************************************************************* */
+ fkcolumn="FK_contentID"
+ lazy="true"
+ index="idx_contentComment";
+ /**********************************************************************
+ * ** CONSTRAINTS + PK
+ **********************************************************************/
this.pk = "commentID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"content",
"displayContent:renderedContent",
"author",
@@ -103,21 +91,21 @@ component
"authorURL",
"isApproved"
],
- defaultExcludes : [ "relatedContent" ]
+ defaultExcludes: [ "relatedContent"]
};
this.constraints = {
- "content" : { required : true },
- "author" : { required : true, size : "1..100" },
- "authorIP" : { required : true, size : "1..100" },
- "authorEmail" : { required : true, size : "1..255", type : "email" },
- "authorURL" : { required : true, size : "1..255", type : "URL" },
- "isApproved" : { required : true, type : "boolean" },
- "relatedContent" : { required : true }
+ "content" : { required: true },
+ "author" : { required: true, size: "1..100" },
+ "authorIP" : { required: true, size: "1..100" },
+ "authorEmail" : { required: true, size: "1..255", type: "email" },
+ "authorURL" : { required: true, size: "1..255", type: "URL" },
+ "isApproved" : { required: true, type: "boolean" },
+ "relatedContent": { required: true }
};
- function init(){
- variables.isApproved = false;
+ function init() {
+ variables.isApproved = false;
variables.createdDate = now();
super.init();
@@ -128,7 +116,7 @@ component
/**
* Build a snapshot of the related content
*/
- struct function getRelatedContentSnapshot(){
+ struct function getRelatedContentSnapshot() {
if ( hasRelatedContent() ) {
return getRelatedContent().getInfoSnapshot();
}
@@ -138,14 +126,20 @@ component
/**
* Render the comment using markdown and encoding it for HTML output
*/
- string function getDisplayContent(){
- return variables.markdown.toHTML( getContent().reReplace( "##{1,6}\s", "", "all" ) );
+ string function getDisplayContent() {
+ return variables.markdown.toHTML(
+ getContent().reReplace(
+ "##{1,6}\s",
+ "",
+ "all"
+ )
+ );
}
/**
* Get parent slug from either the page it belongs or the entry it belongs to.
*/
- function getParentSlug(){
+ function getParentSlug() {
if ( hasRelatedContent() ) {
return getRelatedContent().getSlug();
}
@@ -155,11 +149,11 @@ component
/**
* Get parent title from either the page it belongs or the entry it belongs to.
*/
- function getParentTitle(){
+ function getParentTitle() {
if ( hasRelatedContent() ) {
return getRelatedContent().getTitle();
}
return "";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/comments/CommentService.cfc b/modules/contentbox/models/comments/CommentService.cfc
index e8764fc26b..83e6759577 100755
--- a/modules/contentbox/models/comments/CommentService.cfc
+++ b/modules/contentbox/models/comments/CommentService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,20 +6,25 @@
* Service to handle comment operations.
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="mailService" inject="mailService@cbmailservices";
+
property name="renderer" inject="coldbox:renderer";
+
property name="settingService" inject="id:settingService@contentbox";
+
property name="securityService" inject="id:securityService@contentbox";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="interceptorService" inject="coldbox:interceptorService";
/**
* Constructor
*/
- CommentService function init(){
+ CommentService function init() {
super.init( entityName = "cbComment", useQueryCaching = "true" );
return this;
}
@@ -30,12 +35,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @contentId The content id to filter on
* @isApproved If passed, use it to filter on
*/
- numeric function getTotalCountByContent( string contentId = "", boolean isApproved ){
+ numeric function getTotalCountByContent( string contentId = "", boolean isApproved ) {
return newCriteria()
.isEq( "relatedContent.contentID", arguments.contentId )
- .when( !isNull( arguments.isApproved ), function( c ){
- c.isEq( "isApproved", javacast( "Boolean", isApproved ) );
- } )
+ .when(
+ !isNull( arguments.isApproved ),
+ function( c ) {
+ c.isEq( "isApproved", javacast( "Boolean", isApproved ) );
+ }
+ )
.count();
}
@@ -44,12 +52,13 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @siteID The site to filter on
*/
- numeric function getTotalCount( string siteID = "" ){
- return newCriteria()
- .when( len( arguments.siteID ), function( c ){
- c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
- } )
- .count();
+ numeric function getTotalCount( string siteID = "" ) {
+ return newCriteria().when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
+ }
+ ).count();
}
/**
@@ -57,12 +66,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @siteID The site to filter on
*/
- numeric function getApprovedCount( string siteID = "" ){
+ numeric function getApprovedCount( string siteID = "" ) {
return newCriteria()
.isTrue( "isApproved" )
- .when( len( arguments.siteID ), function( c ){
- c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
- } )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
+ }
+ )
.count();
}
@@ -71,12 +83,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @siteID The site to filter on
*/
- numeric function getUnApprovedCount( string siteID = "" ){
+ numeric function getUnApprovedCount( string siteID = "" ) {
return newCriteria()
.isFalse( "isApproved" )
- .when( len( arguments.siteID ), function( c ){
- c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
- } )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
+ }
+ )
.count();
}
@@ -99,32 +114,44 @@ component extends="cborm.models.VirtualEntityService" singleton {
offset = 0,
string sortOrder = "desc",
string siteID = ""
- ){
- var results = { "count" : 0, "comments" : [] };
- var c = newCriteria()
- // only approved comments
+ ) {
+ var results = { "count": 0, "comments": [] };
+ var c = newCriteria()
.isTrue( "isApproved" )
+ .when(
+ !isNull( arguments.contentID ) && len( arguments.contentID ),
+ function( c ) {
+ c.isEq( "relatedContent.contentID", contentID );
+ }
+ )
+ .when(
+ !isNull( arguments.contentType ) && len( arguments.contentType ),
+ function( c ) {
+ c.createCriteria( "relatedContent" ).isEq( "class", contentType );
+ }
+ )
+ // only approved comments
+
// By Content?
- .when( !isNull( arguments.contentID ) AND len( arguments.contentID ), function( c ){
- c.isEq( "relatedContent.contentID", contentID );
- } )
+
// By Content Type Discriminator: class is a special hibernate deal
- .when( !isNull( arguments.contentType ) AND len( arguments.contentType ), function( c ){
- c.createCriteria( "relatedContent" ).isEq( "class", contentType );
- } )
+
// Site Filter
- .when( len( arguments.siteID ), function( c ){
- c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
- } );
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", siteID );
+ }
+ );
// run criteria query and projections count
- results.count = c.count();
+ results.count = c.count();
results.comments = c.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: "createdDate #arguments.sortOrder#",
- asQuery : false
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = "createdDate #arguments.sortOrder#",
+ asQuery = false
+ );
return results;
}
@@ -134,13 +161,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @expirationDays Required level of staleness in days to delete (0=all unapproved)
*/
- CommentService function deleteUnApproved( numeric expirationDays = 0 ){
+ CommentService function deleteUnApproved( numeric expirationDays = 0 ) {
var hqlQuery = "from cbComment where isApproved = :approved";
- var params = { "approved" : false };
+ var params = { "approved": false };
// if we have an expirationDays setting greater than 0, add it to query for our date filter
if ( arguments.expirationDays ) {
- var expirationDate = dateAdd( "d", -arguments.expirationDays, now() );
+ var expirationDate = dateAdd(
+ "d",
+ -arguments.expirationDays,
+ now()
+ );
hqlQuery &= " and createdDate < :expiration";
params[ "expiration" ] = expirationDate;
}
@@ -158,16 +189,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @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 }
*/
- struct function saveComment( required comment, required loggedInUser ){
+ struct function saveComment( required comment, required loggedInUser ) {
transaction {
// Comment reference
- var inComment = arguments.comment;
+ var inComment = arguments.comment;
// get site settings
- var siteSettings = variables.settingService.getAllSiteSettings(
- siteSlug: inComment.getRelatedContent().getSiteSlug()
- );
+ var siteSettings = variables.settingService.getAllSiteSettings( siteSlug = inComment.getRelatedContent().getSiteSlug() );
// results
- var results = { "moderated" : true, "messages" : [] };
+ var results = { "moderated": true, "messages": [] };
// Log the IP Address
inComment.setAuthorIP( variables.securityService.getRealIP() );
@@ -176,9 +205,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Run moderation rules if not logged in.
if (
- arguments.loggedInUser.isLoggedIn()
- OR
- runModerationRules( comment = inComment, settings = siteSettings )
+ arguments.loggedInUser.isLoggedIn() ||
+ runModerationRules( comment = inComment, settings = siteSettings )
) {
// send for saving, finally phew!
save( inComment );
@@ -213,16 +241,16 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @comment The comment object
*/
- public void function sendSubscriptionNotifications( required any comment ){
- var content = arguments.comment.getRelatedContent();
+ public void function sendSubscriptionNotifications( required any comment ) {
+ var content = arguments.comment.getRelatedContent();
// get subscribers for this content item
- var subscriptions = content.getCommentSubscriptions();
- var settings = variables.settingService.getAllSettings();
+ var subscriptions = content.getCommentSubscriptions();
+ var settings = variables.settingService.getAllSettings();
var commentAuthorEmail = arguments.comment.getAuthorEmail();
// get body tokens; can reuse most for all emails
- var bodyTokens = arguments.comment.getMemento();
- bodyTokens[ "contentURL" ] = CBHelper.linkContent( content );
+ var bodyTokens = arguments.comment.getMemento();
+ bodyTokens[ "contentURL" ] = CBHelper.linkContent( content );
bodyTokens[ "contentTitle" ] = arguments.comment.getParentTitle();
// loop over subscribers
@@ -236,27 +264,27 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Send it baby!
var mail = variables.mailService.newMail(
- to = subscriber.getSubscriberEmail(),
- from = settings.cb_site_outgoingEmail,
- subject = "New comment was added",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = subscriber.getSubscriberEmail(),
+ from = settings.cb_site_outgoingEmail,
+ subject = "New comment was added",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- variables.renderer.layout(
- view = "/contentbox/email_templates/comment_notification",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : commentAuthorEmail }
- )
- );
+ variables.renderer.layout(
+ view = "/contentbox/email_templates/comment_notification",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: commentAuthorEmail }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -264,6 +292,98 @@ component extends="cborm.models.VirtualEntityService" singleton {
}
}
+ /**
+ * comment search returns struct with keys [comments,count]
+ *
+ * @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
+ *
+ * @return struct with { comments, count }
+ */
+ struct function search(
+ search = "",
+ isApproved,
+ contentID,
+ numeric max = 0,
+ numeric offset = 0,
+ sortOrder = "createdDate DESC",
+ string siteID = ""
+ ) {
+ var results = { "count": 0, "comments": [] };
+ var c = newCriteria();
+
+ // isApproved filter
+ if ( !isNull( arguments.isApproved ) && arguments.isApproved NEQ "any" ) {
+ c.isEq( "isApproved", javacast( "boolean", arguments.isApproved ) );
+ }
+
+ // Content Filter
+ if ( !isNull( arguments.contentID ) && arguments.contentID NEQ "all" ) {
+ c.isEq( "relatedContent.contentID", arguments.contentID );
+ }
+
+ // Search Criteria
+ if ( len( arguments.search ) ) {
+ // OR disjunction on author, authorEmail and content.
+ c.$or(
+ c.restrictions.like( "author", "%#arguments.search#%" ),
+ c.restrictions.like( "authorEmail", "%#arguments.search#%" ),
+ c.restrictions.like( "content", "%#arguments.search#%" )
+ );
+ }
+
+ // Site Filter
+ if ( len( arguments.siteID ) ) {
+ c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", arguments.siteID );
+ }
+
+ // run criteria query and projections count
+ results.count = c.count();
+ results.comments = c.list(
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = false
+ );
+
+ return results;
+ }
+
+ /**
+ * Bulk Updates
+ *
+ * @commentID The list or array of ID's to bulk update
+ * @status The status either 'approve' or 'moderate'
+ *
+ * @return CommentService
+ */
+ any function bulkStatus( any commentID, status = "" ) {
+ var approve = false;
+
+ // approve flag
+ if ( arguments.status EQ "approve" ) {
+ approve = true;
+ }
+
+ // Get all by id
+ var comments = getAll( id = arguments.commentID ).map(
+ function( thisComment ) {
+ thisComment.setIsApproved( approve );
+ return thisComment;
+ }
+ );
+
+ // transaction the save of all the comments
+ saveAll( comments );
+
+ return this;
+ }
+
/**
* 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.
@@ -271,32 +391,31 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @comment Comment to moderate check
* @settings The contentbox settings to moderate against
*/
- private boolean function runModerationRules( required comment, required settings ){
+ private boolean function runModerationRules( required comment, required settings ) {
// Comment reference
- var inComment = arguments.comment;
+ var inComment = arguments.comment;
var inSettings = arguments.settings;
- var allowSave = true;
+ var allowSave = true;
// Not moderation, just approve and return
- if ( NOT settings.cb_comments_moderation ) {
+ if ( !settings.cb_comments_moderation ) {
inComment.setIsApproved( true );
return true;
}
-
// Check if user has already an approved comment. If they do, then approve them
// cfformat-ignore-start
- if ( inSettings.cb_comments_moderation_whitelist AND userHasPreviousAcceptedComment( inComment.getAuthorEmail() ) ) {
- inComment.setIsApproved( true );
- return true;
- }
+ if (
+inSettings.cb_comments_moderation_whitelist && userHasPreviousAcceptedComment( inComment.getAuthorEmail() )
+) {
+inComment.setIsApproved( true );
+return true;
+}
// cfformat-ignore-end
// Execute moderation queries
if (
- len( inSettings.cb_comments_moderation_blacklist ) AND anyKeywordMatch(
- inComment,
- inSettings.cb_comments_moderation_blacklist
- )
+ len( inSettings.cb_comments_moderation_blacklist ) &&
+ anyKeywordMatch( inComment, inSettings.cb_comments_moderation_blacklist )
) {
inComment.setIsApproved( false );
allowSave = true;
@@ -304,10 +423,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Execute blocking queries
if (
- len( inSettings.cb_comments_moderation_blockedlist ) AND anyKeywordMatch(
- inComment,
- inSettings.cb_comments_moderation_blockedlist
- )
+ len( inSettings.cb_comments_moderation_blockedlist ) &&
+ anyKeywordMatch( inComment, inSettings.cb_comments_moderation_blockedlist )
) {
inComment.setIsApproved( false );
allowSave = false;
@@ -315,9 +432,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
// announce it.
var iData = {
- comment : arguments.comment,
- settings : arguments.settings,
- allowSave : allowSave
+ comment : arguments.comment,
+ settings : arguments.settings,
+ allowSave: allowSave
};
interceptorService.announce( "cbui_onCommentModerationRules", iData );
@@ -328,17 +445,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Regex matching of a list of entries against a comment and matching keyword list
*/
- private boolean function anyKeywordMatch( comment, matchList ){
+ private boolean function anyKeywordMatch( comment, matchList ) {
var inComment = arguments.comment;
- var del = chr( 13 ) & chr( 10 );
- var inList = listToArray( arguments.matchList, del );
+ var del = chr( 13 ) & chr( 10 );
+ var inList = listToArray( arguments.matchList, del );
- for ( var x = 1; x lte arrayLen( inList ); x++ ) {
+ for ( var x = 1; x LTE arrayLen( inList ); x++ ) {
// Verify each keword via regex
if (
- reFindNoCase( inList[ x ], inComment.getContent() ) OR
- reFindNoCase( inList[ x ], inComment.getAuthor() ) OR
- reFindNoCase( inList[ x ], inComment.getAuthorIP() )
+ reFindNoCase( inList[ x ], inComment.getContent() ) ||
+ reFindNoCase( inList[ x ], inComment.getAuthor() ) ||
+ reFindNoCase( inList[ x ], inComment.getAuthorIP() )
) {
return true;
}
@@ -352,8 +469,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @email The email address to check.
*/
- private boolean function userHasPreviousAcceptedComment( required email ){
- var args = { "authorEmail" : arguments.email, "isApproved" : true };
+ private boolean function userHasPreviousAcceptedComment( required email ) {
+ var args = { "authorEmail": arguments.email, "isApproved": true };
return ( countWhere( argumentCollection = args ) GT 0 );
}
@@ -363,14 +480,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @comment Comment to moderate check
* @siteSettings The contentbox site settings to moderate against
*/
- private void function sendNotificationEmails( required comment, required siteSettings ){
+ private void function sendNotificationEmails( required comment, required siteSettings ) {
// Comment reference
var inComment = arguments.comment;
- var settings = variables.settingService.getAllSettings();
- var site = inComment.getRelatedContent().getSite();
+ var settings = variables.settingService.getAllSettings();
+ var site = inComment.getRelatedContent().getSite();
var outEmails = settings.cb_site_email;
- var subject = "";
- var template = "";
+ var subject = "";
+ var template = "";
// Verify if we have active notifications, else just quit notification process
if ( !arguments.siteSettings.cb_comments_notify ) {
@@ -384,143 +501,53 @@ component extends="cborm.models.VirtualEntityService" singleton {
}
// get mail payload
- var bodyTokens = inComment.getMemento();
- bodyTokens[ "whoisURL" ] = settings.cb_comments_whoisURL;
+ 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[ "contentURL" ] = CBHelper.linkContent(
- content = inComment.getRelatedContent(),
- 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() );
bodyTokens[ "contentTitle" ] = inComment.getParentTitle();
// Moderation Email? Comment is moderated?
- if ( inComment.getIsApproved() eq false AND arguments.siteSettings.cb_comments_moderation_notify ) {
- subject = "New comment needs moderation on post: #bodyTokens.contentTitle#";
+ if ( inComment.getIsApproved() EQ false && arguments.siteSettings.cb_comments_moderation_notify ) {
+ subject = "New comment needs moderation on post: #bodyTokens.contentTitle#";
template = "comment_moderation";
} else {
// Else, new comment notification
- subject = "New comment on post: #bodyTokens.contentTitle#";
+ subject = "New comment on post: #bodyTokens.contentTitle#";
template = "comment_new";
}
// Send it baby!
var mail = variables.mailservice.newMail(
- to = outEmails,
- from = settings.cb_site_outgoingEmail,
- subject = subject,
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = outEmails,
+ from = settings.cb_site_outgoingEmail,
+ subject = subject,
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/#template#",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : inComment.getAuthorEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/#template#",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: inComment.getAuthorEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
}
- /**
- * comment search returns struct with keys [comments,count]
- *
- * @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
- *
- * @return struct with { comments, count }
- */
- struct function search(
- search = "",
- isApproved,
- contentID,
- numeric max = 0,
- numeric offset = 0,
- sortOrder = "createdDate DESC",
- string siteID = ""
- ){
- var results = { "count" : 0, "comments" : [] };
- var c = newCriteria();
-
- // isApproved filter
- if ( !isNull( arguments.isApproved ) AND arguments.isApproved NEQ "any" ) {
- c.isEq( "isApproved", javacast( "boolean", arguments.isApproved ) );
- }
-
- // Content Filter
- if ( !isNull( arguments.contentID ) AND arguments.contentID NEQ "all" ) {
- c.isEq( "relatedContent.contentID", arguments.contentID );
- }
-
- // Search Criteria
- if ( len( arguments.search ) ) {
- // OR disjunction on author, authorEmail and content.
- c.$or(
- c.restrictions.like( "author", "%#arguments.search#%" ),
- c.restrictions.like( "authorEmail", "%#arguments.search#%" ),
- c.restrictions.like( "content", "%#arguments.search#%" )
- );
- }
-
- // Site Filter
- if ( len( arguments.siteID ) ) {
- c.joinTo( "relatedContent", "relatedContent" ).isEq( "relatedContent.site.siteID", arguments.siteID );
- }
-
- // run criteria query and projections count
- results.count = c.count();
- results.comments = c.list(
- offset = arguments.offset,
- max = arguments.max,
- sortOrder = arguments.sortOrder,
- asQuery = false
- );
-
- return results;
- }
-
- /**
- * Bulk Updates
- *
- * @commentID The list or array of ID's to bulk update
- * @status The status either 'approve' or 'moderate'
- *
- * @return CommentService
- */
- any function bulkStatus( any commentID, status = "" ){
- var approve = false;
-
- // approve flag
- if ( arguments.status eq "approve" ) {
- approve = true;
- }
-
- // Get all by id
- var comments = getAll( id = arguments.commentID ).map( function( thisComment ){
- thisComment.setIsApproved( approve );
- return thisComment;
- } );
-
- // transaction the save of all the comments
- saveAll( comments );
-
- return this;
- }
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/BaseContent.cfc b/modules/contentbox/models/content/BaseContent.cfc
index 63564f7cc3..bbbb2075d2 100644
--- a/modules/contentbox/models/content/BaseContent.cfc
+++ b/modules/contentbox/models/content/BaseContent.cfc
@@ -15,7 +15,6 @@ component
cacheuse ="read-write"
discriminatorColumn="contentType"
{
-
/**
* --------------------------------------------------------------------------
* DI
@@ -24,48 +23,55 @@ component
*/
property
- name ="categoryService"
- inject ="provider:categoryService@contentbox"
+ name="categoryService"
+ inject="provider:categoryService@contentbox"
persistent="false";
property
- name ="contentService"
- inject ="provider:contentService@contentbox"
+ name="contentService"
+ inject="provider:contentService@contentbox"
persistent="false";
property
- name ="contentVersionService"
- inject ="provider:contentVersionService@contentbox"
+ name="contentVersionService"
+ inject="provider:contentVersionService@contentbox"
persistent="false";
property
- name ="contentTemplateService"
- inject ="provider:ContentTemplateService@contentbox"
+ name="contentTemplateService"
+ inject="provider:ContentTemplateService@contentbox"
persistent="false";
property
- name ="customFieldService"
- inject ="provider:customFieldService@contentbox"
+ name="commentService"
+ inject="provider:commentService@contentbox"
persistent="false";
property
- name ="i18n"
- inject ="provider:i18n@cbi18n"
+ name="customFieldService"
+ inject="provider:customFieldService@contentbox"
+ persistent="false";
+
+ property name="i18n" inject="provider:i18n@cbi18n" persistent="false";
+
+ property
+ name="JSONPrettyPrint"
+ inject="provider:JSONPrettyPrint@JSONPrettyPrint"
persistent="false";
property
- name ="JSONPrettyPrint"
- inject ="provider:JSONPrettyPrint@JSONPrettyPrint"
+ name="settingService"
+ inject="provider:settingService@contentbox"
persistent="false";
property
- name ="settingService"
- inject ="provider:settingService@contentbox"
+ name="mediaService"
+ inject="provider:MediaService@contentbox"
persistent="false";
property
- name ="mediaService"
- inject ="provider:MediaService@contentbox"
+ name="statsService"
+ inject="provider:statsService@contentbox"
persistent="false";
/**
@@ -74,10 +80,7 @@ component
* --------------------------------------------------------------------------
*/
- property
- name ="renderedContent"
- persistent="false"
- default ="";
+ property name="renderedContent" persistent="false" default="";
/**
* --------------------------------------------------------------------------
@@ -88,23 +91,23 @@ component
*/
property
- name ="createdDate"
- column ="createdDate"
- type ="date"
+ name="createdDate"
+ column="createdDate"
+ type="date"
ormtype="timestamp"
notnull="true"
- update ="false";
+ update="false";
property
- name ="modifiedDate"
- column ="modifiedDate"
- type ="date"
+ name="modifiedDate"
+ column="modifiedDate"
+ type="date"
ormtype="timestamp"
notnull="true";
property
- name ="isDeleted"
- column ="isDeleted"
+ name="isDeleted"
+ column="isDeleted"
ormtype="boolean"
notnull="true"
default="false";
@@ -116,141 +119,141 @@ component
*/
property
- name ="contentID"
- column ="contentID"
+ name="contentID"
+ column="contentID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="contentType"
- column ="contentType"
- setter ="false"
- update ="false"
- insert ="false"
- index ="idx_discriminator,idx_published"
+ name="contentType"
+ column="contentType"
+ setter="false"
+ update="false"
+ insert="false"
+ index="idx_discriminator,idx_published"
default="";
property
- name ="title"
- column ="title"
+ name="title"
+ column="title"
notnull="true"
- length ="500"
+ length="500"
default=""
- index ="idx_search";
+ index="idx_search";
property
- name ="slug"
- column ="slug"
+ name="slug"
+ column="slug"
notnull="true"
- length ="500"
+ length="500"
default=""
- index ="idx_slug,idx_publishedSlug";
+ index="idx_slug,idx_publishedSlug";
property
- name ="publishedDate"
- column ="publishedDate"
+ name="publishedDate"
+ column="publishedDate"
notnull="false"
ormtype="timestamp"
- index ="idx_publishedDate";
+ index="idx_publishedDate";
property
- name ="expireDate"
- column ="expireDate"
+ name="expireDate"
+ column="expireDate"
notnull="false"
ormtype="timestamp"
- index ="idx_expireDate";
+ index="idx_expireDate";
property
- name ="isPublished"
- column ="isPublished"
+ name="isPublished"
+ column="isPublished"
notnull="true"
ormtype="boolean"
default="true"
- index ="idx_published,idx_search,idx_publishedSlug";
+ index="idx_published,idx_search,idx_publishedSlug";
property
- name ="allowComments"
- column ="allowComments"
+ name="allowComments"
+ column="allowComments"
notnull="true"
ormtype="boolean"
default="true";
property
- name ="passwordProtection"
- column ="passwordProtection"
+ name="passwordProtection"
+ column="passwordProtection"
notnull="false"
- length ="100"
+ length="100"
default="";
property
- name ="HTMLKeywords"
- column ="HTMLKeywords"
+ name="HTMLKeywords"
+ column="HTMLKeywords"
notnull="false"
- length ="160"
+ length="160"
default="";
property
- name ="HTMLDescription"
- column ="HTMLDescription"
+ name="HTMLDescription"
+ column="HTMLDescription"
notnull="false"
- length ="160"
+ length="160"
default="";
property
- name ="HTMLTitle"
- column ="HTMLTitle"
+ name="HTMLTitle"
+ column="HTMLTitle"
notnull="false"
- length ="255"
+ length="255"
default="";
property
- name ="cache"
- column ="cache"
+ name="cache"
+ column="cache"
notnull="true"
ormtype="boolean"
default="true"
- index ="idx_cache";
+ index="idx_cache";
property
- name ="cacheTimeout"
- column ="cacheTimeout"
+ name="cacheTimeout"
+ column="cacheTimeout"
notnull="false"
ormtype="integer"
default="0"
- index ="idx_cachetimeout";
+ index="idx_cachetimeout";
property
- name ="cacheLastAccessTimeout"
- column ="cacheLastAccessTimeout"
+ name="cacheLastAccessTimeout"
+ column="cacheLastAccessTimeout"
notnull="false"
ormtype="integer"
default="0"
- index ="idx_cachelastaccesstimeout";
+ index="idx_cachelastaccesstimeout";
property
- name ="markup"
- column ="markup"
+ name="markup"
+ column="markup"
notnull="true"
- length ="100"
+ length="100"
default="HTML";
property
- name ="showInSearch"
- column ="showInSearch"
+ name="showInSearch"
+ column="showInSearch"
notnull="true"
ormtype="boolean"
default="true"
- index ="idx_showInSearch";
+ index="idx_showInSearch";
property
- name ="featuredImage"
- column ="featuredImage"
+ name="featuredImage"
+ column="featuredImage"
notnull="false"
default=""
- length ="500";
+ length="500";
/**
* --------------------------------------------------------------------------
@@ -260,162 +263,156 @@ component
// M20 -> creator loaded as a proxy and fetched immediately
property
- name ="creator"
- notnull ="true"
- cfc ="contentbox.models.security.Author"
+ name="creator"
+ notnull="true"
+ cfc="contentbox.models.security.Author"
fieldtype="many-to-one"
- fkcolumn ="FK_authorID"
- lazy ="true";
+ fkcolumn="FK_authorID"
+ lazy="true";
// M20 -> site loaded as a proxy and fetched immediately
property
- name ="site"
- notnull ="true"
- cfc ="contentbox.models.system.Site"
+ name="site"
+ notnull="true"
+ cfc="contentbox.models.system.Site"
fieldtype="many-to-one"
- fkcolumn ="FK_siteID"
- fetch ="join";
+ fkcolumn="FK_siteID"
+ lazy="true";
// O2M -> Comments
property
- name ="comments"
+ name="comments"
singularName="comment"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- batchsize ="25"
- orderby ="createdDate"
- cfc ="contentbox.models.comments.Comment"
- fkcolumn ="FK_contentID"
- inverse ="true"
- cascade ="all-delete-orphan";
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ batchsize="25"
+ orderby="createdDate"
+ cfc="contentbox.models.comments.Comment"
+ fkcolumn="FK_contentID"
+ inverse="true"
+ cascade="all-delete-orphan";
// O2M -> CustomFields
property
- name ="customFields"
+ name="customFields"
singularName="customField"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="extra"
- batchsize ="25"
- cfc ="contentbox.models.content.CustomField"
- fkcolumn ="FK_contentID"
- inverse ="true"
- cascade ="all-delete-orphan";
+ fieldtype="one-to-many"
+ type="array"
+ lazy="extra"
+ batchsize="25"
+ cfc="contentbox.models.content.CustomField"
+ fkcolumn="FK_contentID"
+ inverse="true"
+ cascade="all-delete-orphan";
// O2M -> ContentVersions
property
- name ="contentVersions"
+ name="contentVersions"
singularName="contentVersion"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="extra"
- batchsize ="25"
- cfc ="contentbox.models.content.ContentVersion"
- orderby ="version desc"
- fkcolumn ="FK_contentID"
- inverse ="true"
- cascade ="all-delete-orphan";
+ fieldtype="one-to-many"
+ type="array"
+ lazy="extra"
+ batchsize="25"
+ cfc="contentbox.models.content.ContentVersion"
+ orderby="version desc"
+ fkcolumn="FK_contentID"
+ inverse="true"
+ cascade="all-delete-orphan";
property name="activeContentVersions" persistent="false";
// M20 -> Parent Page loaded as a proxy
property
- name ="parent"
- cfc ="contentbox.models.content.BaseContent"
+ name="parent"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="many-to-one"
- fkcolumn ="FK_parentID"
- lazy ="true";
+ fkcolumn="FK_parentID"
+ lazy="true";
// O2M -> Sub Content Inverse
property
- name ="children"
+ name="children"
singularName="child"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="extra"
- batchsize ="25"
- orderby ="createdDate"
- cfc ="contentbox.models.content.BaseContent"
- fkcolumn ="FK_parentID"
- inverse ="true"
- cascade ="all-delete-orphan";
+ fieldtype="one-to-many"
+ type="array"
+ lazy="extra"
+ batchsize="25"
+ orderby="createdDate"
+ cfc="contentbox.models.content.BaseContent"
+ fkcolumn="FK_parentID"
+ inverse="true"
+ cascade="all-delete-orphan";
// O2M -> Comment Subscribers
property
- name ="commentSubscriptions"
+ name="commentSubscriptions"
singularName="commentSubscription"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- batchsize ="25"
- cfc ="contentbox.models.subscriptions.CommentSubscription"
- fkcolumn ="FK_contentID"
- inverse ="true"
- cascade ="all-delete-orphan";
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ batchsize="25"
+ cfc="contentbox.models.subscriptions.CommentSubscription"
+ fkcolumn="FK_contentID"
+ inverse="true"
+ cascade="all-delete-orphan";
// M2M -> Categories
property
- name ="categories"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- orderby ="category"
- cascade ="save-update"
- cfc ="contentbox.models.content.Category"
- fkcolumn ="FK_contentID"
- linktable ="cb_contentCategories"
+ name="categories"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ batchsize="25"
+ orderby="category"
+ cascade="save-update"
+ cfc="contentbox.models.content.Category"
+ fkcolumn="FK_contentID"
+ linktable="cb_contentCategories"
inversejoincolumn="FK_categoryID";
// M2M -> Related Content - Content related from this content to other content
property
- name ="relatedContent"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- orderby ="title"
- cascade ="save-update"
- cfc ="contentbox.models.content.BaseContent"
- fkcolumn ="FK_contentID"
- linktable ="cb_relatedContent"
+ name="relatedContent"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ batchsize="25"
+ orderby="title"
+ cascade="save-update"
+ cfc="contentbox.models.content.BaseContent"
+ fkcolumn="FK_contentID"
+ linktable="cb_relatedContent"
inversejoincolumn="FK_relatedContentID";
// M2M -> Linked Content - Content related to this content from other content
property
- name ="linkedContent"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- cascade ="save-update"
- inverse ="true"
- orderby ="title"
- cfc ="contentbox.models.content.BaseContent"
- fkcolumn ="FK_relatedContentID"
- linktable ="cb_relatedContent"
+ name="linkedContent"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ batchsize="25"
+ cascade="save-update"
+ inverse="true"
+ orderby="title"
+ cfc="contentbox.models.content.BaseContent"
+ fkcolumn="FK_relatedContentID"
+ linktable="cb_relatedContent"
inversejoincolumn="FK_contentID";
- // O2O -> Content Stats
- property
- name ="stats"
- notnull ="true"
- cfc ="contentbox.models.content.Stats"
- fieldtype="one-to-one"
- mappedBy ="relatedContent"
- cascade ="all-delete-orphan";
-
property
- name ="contentTemplate"
+ name="contentTemplate"
fieldtype="many-to-one"
- cfc ="contentbox.models.content.ContentTemplate"
- fkcolumn ="FK_contentTemplateID"
- lazy ="true";
+ cfc="contentbox.models.content.ContentTemplate"
+ fkcolumn="FK_contentTemplateID"
+ lazy="true";
property
- name ="childContentTemplate"
+ name="childContentTemplate"
fieldtype="many-to-one"
- cfc ="contentbox.models.content.ContentTemplate"
- fkcolumn ="FK_childContentTemplateID"
- lazy ="true";
+ cfc="contentbox.models.content.ContentTemplate"
+ fkcolumn="FK_childContentTemplateID"
+ lazy="true";
/**
* --------------------------------------------------------------------------
@@ -424,27 +421,9 @@ component
*/
property
- name ="numberOfHits"
- formula="select cbStats.hits
- from cb_stats cbStats
- where cbStats.FK_contentID=contentID"
- default="0";
-
- property
- name ="numberOfChildren"
- formula="select count(*) from cb_content content where content.FK_parentID=contentID"
- default="0";
-
- property
- name ="numberOfComments"
+ name="numberOfComments"
formula="select count(*) from cb_comment comment where comment.FK_contentID=contentID"
default="0";
-
- property
- name ="numberOfVersions"
- formula="select count(*) from cb_contentVersion versions where versions.FK_contentID=contentID"
- default="0";
-
/**
* --------------------------------------------------------------------------
* MEMENTIFIER + CONSTRAINTS
@@ -454,7 +433,7 @@ component
this.pk = "contentID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"allowComments",
"cache",
"cacheLastAccessTimeout",
@@ -489,20 +468,13 @@ component
"siteID",
"title"
],
- defaultExcludes : [
- "comments",
- "commentSubscriptions",
- "contentVersions",
- "contentTemplate",
- "site",
- "stats"
- ],
- neverInclude : [ "passwordProtection" ],
- mappers : {},
- defaults : { "stats" : {}, "contentTemplate" : {} },
- profiles : {
- response : {
- defaultIncludes : [
+ defaultExcludes: [ "comments", "commentSubscriptions", "contentVersions", "contentTemplate", "site"],
+ neverInclude : [ "passwordProtection"],
+ mappers : {},
+ defaults : { "contentTemplate": {} },
+ profiles : {
+ response: {
+ defaultIncludes: [
"categoriesArray:categories",
"contentID",
"contentType",
@@ -525,10 +497,10 @@ component
"renderedExcerpt",
"childrenSnapshot:children"
],
- defaultExcludes : []
+ defaultExcludes: []
},
- export : {
- defaultIncludes : [
+ export: {
+ defaultIncludes: [
"allowComments",
"cache",
"cacheLastAccessTimeout",
@@ -562,10 +534,9 @@ component
"contentTemplate",
"customFields",
"linkedContentSnapshot:linkedContent",
- "relatedContentSnapshot:relatedContent",
- "stats"
+ "relatedContentSnapshot:relatedContent"
],
- defaultExcludes : [
+ defaultExcludes: [
"commentSubscriptions.relatedContentSnapshot:relatedContent",
"children.parentSnapshot:parent",
"linkedContent",
@@ -579,82 +550,90 @@ component
};
this.constraints = {
- "cacheLastAccessTimeout" : { required : false, type : "numeric" },
- "cacheTimeout" : { required : false, type : "numeric" },
- "expireDate" : { required : false, type : "date" },
- "featuredImage" : { required : false, size : "1..255" },
- "HTMLDescription" : { required : false, size : "1..160" },
- "HTMLKeywords" : { required : false, size : "1..160" },
- "markup" : { required : true, size : "1..100" },
- "passwordProtection" : { required : false, size : "1..100" },
- "publishedDate" : { required : false, type : "date" },
- "site" : { required : true },
- "slug" : {
- required : true,
- size : "1..200",
- udfMessage : "The 'slug' is not unique",
- udf : function( value, target ){
- return arguments.target
+ "cacheLastAccessTimeout": { required: false, type: "numeric" },
+ "cacheTimeout" : { required: false, type: "numeric" },
+ "expireDate" : { required: false, type: "date" },
+ "featuredImage" : { required: false, size: "1..255" },
+ "HTMLDescription" : { required: false, size: "1..160" },
+ "HTMLKeywords" : { required: false, size: "1..160" },
+ "markup" : { required: true, size: "1..100" },
+ "passwordProtection" : { required: false, size: "1..100" },
+ "publishedDate" : { required: false, type: "date" },
+ "site" : { required: true },
+ "slug" : {
+ required : true,
+ size : "1..200",
+ udfMessage: "The 'slug' is not unique",
+ udf : function( value, target ) {
+ return arguments
+ .target
.getContentService()
.isSlugUnique(
- contentType: arguments.target.getContentType(),
- slug : arguments.value,
- contentID : arguments.target.isLoaded() ? arguments.target.getContentID() : "",
- siteID : arguments.target.hasSite() ? arguments.target.getSite().getSiteID() : ""
+ contentType = arguments.target.getContentType(),
+ slug = arguments.value,
+ contentID = arguments.target.isLoaded() ? arguments.target.getContentID() : "",
+ siteID = arguments.target.hasSite()
+ ? arguments
+ .target
+ .getSite()
+ .getSiteID()
+ : ""
);
}
},
- "title" : { required : true, size : "1..200" }
+ "title": { required: true, size: "1..200" }
};
/**
* Base constructor
*/
- function init(){
+ function init() {
super.init();
- variables.isPublished = true;
- variables.publishedDate = now();
- variables.allowComments = true;
- variables.cache = true;
- variables.cacheTimeout = 0;
+ variables.isPublished = true;
+ variables.publishedDate = now();
+ variables.allowComments = true;
+ variables.cache = true;
+ variables.cacheTimeout = 0;
variables.cacheLastAccessTimeout = 0;
- variables.markup = "HTML";
- variables.contentType = "";
- variables.showInSearch = true;
- variables.renderedContent = "";
- variables.children = [];
+ variables.markup = "HTML";
+ variables.contentType = "";
+ variables.showInSearch = true;
+ variables.renderedContent = "";
+ variables.children = [];
return this;
}
/**
* Prepare the instance for usage
*/
- function onDIComplete(){
+ function onDIComplete() {
// Load up content helpers
- variables.wirebox
- .getInstance( dsl: "coldbox:moduleSettings:contentbox" )
+ variables
+ .wirebox
+ .getInstance( dsl = "coldbox:moduleSettings:contentbox" )
.contentHelpers
- .each( function( thisHelper ){
- includeMixin( arguments.thisHelper );
- } );
+ .each(
+ function( thisHelper ) {
+ includeMixin( arguments.thisHelper );
+ }
+ );
}
-
/**
* Utility method to get a snapshot of this content object
*/
- struct function getInfoSnapshot(){
+ struct function getInfoSnapshot() {
if ( isLoaded() ) {
return {
- "contentID" : getContentID(),
- "title" : getTitle(),
- "slug" : getSlug(),
- "isPublished" : getIsPublished(),
- "publishedDate" : getPublishedDate(),
- "createdDate" : getCreatedDate(),
- "modifiedDate" : getModifiedDate(),
- "expireDate" : getExpireDate(),
- "contentType" : getContentType()
+ "contentID" : getContentID(),
+ "title" : getTitle(),
+ "slug" : getSlug(),
+ "isPublished" : getIsPublished(),
+ "publishedDate": getPublishedDate(),
+ "createdDate" : getCreatedDate(),
+ "modifiedDate" : getModifiedDate(),
+ "expireDate" : getExpireDate(),
+ "contentType" : getContentType()
};
}
return {};
@@ -663,21 +642,21 @@ component
/**
* Build a parent snapshot
*/
- struct function getParentSnapshot(){
+ struct function getParentSnapshot() {
return ( hasParent() ? getParent().getInfoSnapshot() : {} );
}
/**
* Build a creator snapshot
*/
- struct function getCreatorSnapshot(){
+ struct function getCreatorSnapshot() {
return ( hasCreator() ? getCreator().getInfoSnapshot() : {} );
}
/**
* Build a last editor snapshot
*/
- struct function getLastEditorSnapshot(){
+ struct function getLastEditorSnapshot() {
var activeContent = getActiveContent();
return ( activeContent.hasAuthor() ? activeContent.getAuthor().getInfoSnapshot() : {} );
}
@@ -685,95 +664,108 @@ component
/**
* Build a site snapshot
*/
- struct function getSiteSnapshot(){
+ struct function getSiteSnapshot() {
return ( hasSite() ? getSite().getInfoSnapshot() : {} );
}
/**
- * Get the number of hits
+ * Get the number of hits from the stats service
*/
- numeric function getNumberOfHits(){
- return ( isNull( variables.numberOfHits ) ? 0 : variables.numberOfHits );
+ numeric function getNumberOfHits() {
+ if ( !isLoaded() ) {
+ return 0;
+ }
+ return variables.statsService.getTotalHitsByContent( getContentID() );
}
/**
- * Get the number of children
+ * Get the number of children from the children relationship
*/
- numeric function getNumberOfChildren(){
- return ( isNull( variables.numberOfChildren ) ? 0 : variables.numberOfChildren );
+ numeric function getNumberOfChildren() {
+ if ( !isLoaded() || !hasChild() ) {
+ return 0;
+ }
+ return arrayLen( variables.children );
}
/**
* Get the total number of comments this content object has
*/
- numeric function getNumberOfComments(){
+ numeric function getNumberOfComments() {
return ( isNull( variables.numberOfComments ) ? 0 : variables.numberOfComments );
}
/**
* Get the total number of approved comments this content object has
*/
- numeric function getNumberOfApprovedComments(){
+ numeric function getNumberOfApprovedComments() {
if ( !isLoaded() ) {
return 0;
}
- return variables.comments
- .filter( function( comment ){
- return comment.getIsApproved();
- } )
- .len();
+ return variables
+ .commentService
+ .newCriteria()
+ .isEq( "relatedContent.contentID", getContentID() )
+ .isEq( "isApproved", javacast( "boolean", true ) )
+ .count();
}
/**
- * Get the total number of versions this content object has
+ * Get the total number of versions this content object has from the contentVersions relationship
*/
- numeric function getNumberOfVersions(){
- return ( isNull( variables.numberOfVersions ) ? 0 : variables.numberOfVersions );
+ numeric function getNumberOfVersions() {
+ if ( !isLoaded() || !hasContentVersion() ) {
+ return 0;
+ }
+ return arrayLen( variables.contentVersions );
}
/**
* Get the total number of active versions this content object has
*/
- numeric function getNumberOfActiveVersions(){
+ numeric function getNumberOfActiveVersions() {
return ( isLoaded() ? variables.contentVersionService.getNumberOfVersions( getContentId(), true ) : 0 );
}
-
/**
* Getter overload to return either the assigned template or the global template for the site
*
* @note The hierarchy for templates is local, parent assigned, and then any globals
*/
- any function getContentTemplate(){
+ any function getContentTemplate() {
return !isNull( variables.contentTemplate )
- ? variables.contentTemplate
- : (
- !isNull( getParent() ) && !isNull( getParent().getChildContentTemplate() )
- ? getParent().getChildContentTemplate()
- : getContentTemplateService()
- .newCriteria()
- .isEq( "contentType", getContentType() )
- .isEq( "site", getSite() )
- .isEq( "isGlobal", javacast( "boolean", true ) )
- .get()
- );
+ ? variables.contentTemplate
+ : (
+ !isNull( getParent() ) && !isNull( getParent().getChildContentTemplate() )
+ ? getParent().getChildContentTemplate()
+ : getContentTemplateService()
+ .newCriteria()
+ .isEq( "contentType", getContentType() )
+ .isEq( "site", getSite() )
+ .isEq( "isGlobal", javacast( "boolean", true ) )
+ .get()
+ );
}
/**
* Returns the URL of the featured image
*/
- function getFeaturedImageURL(){
+ function getFeaturedImageURL() {
var featured = getFeaturedImage();
if ( isNull( featured ) || !len( featured ) ) {
return "";
}
- var mediaRoot = mediaService.getCoreMediaRoot();
+ var mediaRoot = mediaService.getCoreMediaRoot();
var expandedMediaRoot = expandPath( mediaRoot );
// We have three scenarios in how the featured image entries are stored.
// The first is that the image was stored with a fully expanded path
if ( findNoCase( expandedMediaRoot, featured ) ) {
return replaceNoCase(
- replaceNoCase( featured, expandedMediaRoot, "/__media" ),
+ replaceNoCase(
+ featured,
+ expandedMediaRoot,
+ "/__media"
+ ),
"\",
"/",
"All"
@@ -783,16 +775,18 @@ component
if ( findNoCase( mediaRoot, featured ) ) {
// Replace and change any windows delimiters that might be in the path
return replaceNoCase(
- replaceNoCase( featured, mediaRoot, "/__media" ),
+ replaceNoCase(
+ featured,
+ mediaRoot,
+ "/__media"
+ ),
"\",
"/",
"All"
);
}
// The last is that it is modern cbfs disk paths
- return find( ":", featured )
- ? "/__media/" & featured
- : featured;
+ return find( ":", featured ) ? "/__media/" & featured : featured;
}
/**
@@ -810,12 +804,23 @@ component
*/
BaseContent function addNewContentVersion(
required content,
- changelog = "",
+ changelog = "",
required author,
- boolean isPreview = false
- ){
+ boolean isPreview = false,
+ array contentVersions = []
+ ) {
// 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#"
+ {
+ // Defensive guard for BoxLang populate edge cases where relationship values can become simple values.
+ if ( !isArray( variables.contentVersions ) ) {
+ variables.contentVersions = [];
+ }
+
// Do we already have an active version?
if ( hasActiveContent() ) {
// cap checks if not in preview mode
@@ -823,18 +828,19 @@ component
maxContentVersionChecks();
}
// deactive the curent version, we do it after in case the content versions check kick off a transaction
- getContentVersions()
- .filter( ( version ) => version.getIsActive() )
- .each( ( version ) => version.setIsActive( false ) );
+ getContentVersions().filter( ( version ) => version.getIsActive() ).each( ( version
+ ) => version.setIsActive( false ) );
}
// get a new version object with our incoming content + relationships
- var oNewVersion = variables.contentVersionService.new( {
- content : arguments.content,
- changelog : arguments.changelog,
- author : arguments.author,
- relatedContent : this
- } );
+ var oNewVersion = variables.contentVersionService.new(
+ {
+ content : arguments.content,
+ changelog : arguments.changelog,
+ author : arguments.author,
+ relatedContent: this
+ }
+ );
// Get the latest content version, to increase the new version number, collection is ordered by 'version' descending
if ( hasContentVersion() ) {
@@ -843,7 +849,7 @@ component
// Activate the new version
oNewVersion.setIsActive( true );
- variables.activeContent = oNewVersion;
+ variables.activeContent = oNewVersion;
variables.renderedContent = "";
// Add it to the content versions array so it can be saved as part of this content object
addContentVersion( oNewVersion );
@@ -859,11 +865,14 @@ component
/**
* Build the array of linked content snapshots
*/
- array function getLinkedContentSnapshot(){
+ array function getLinkedContentSnapshot() {
if ( hasLinkedContent() ) {
- return arrayMap( variables.linkedContent, function( thisItem ){
- return arguments.thisItem.getInfoSnapshot();
- } );
+ return arrayMap(
+ variables.linkedContent,
+ function( thisItem ) {
+ return arguments.thisItem.getInfoSnapshot();
+ }
+ );
}
return [];
}
@@ -871,11 +880,14 @@ component
/**
* Build the array of children snapshots
*/
- array function getChildrenSnapshot(){
+ array function getChildrenSnapshot() {
if ( hasChild() ) {
- return arrayMap( variables.children, function( thisItem ){
- return arguments.thisItem.getInfoSnapshot();
- } );
+ return arrayMap(
+ variables.children,
+ function( thisItem ) {
+ return arguments.thisItem.getInfoSnapshot();
+ }
+ );
}
return [];
}
@@ -883,11 +895,14 @@ component
/**
* Build the array of related content snapshots
*/
- array function getRelatedContentSnapshot(){
+ array function getRelatedContentSnapshot() {
if ( hasRelatedContent() ) {
- return arrayMap( variables.relatedContent, function( thisItem ){
- return arguments.thisItem.getInfoSnapshot();
- } );
+ return arrayMap(
+ variables.relatedContent,
+ function( thisItem ) {
+ return arguments.thisItem.getInfoSnapshot();
+ }
+ );
}
return [];
}
@@ -895,11 +910,14 @@ component
/**
* Returns a list of active related content for this piece of content
*/
- string function getRelatedContentIDs(){
+ string function getRelatedContentIDs() {
if ( hasRelatedContent() ) {
- return arrayMap( variables.relatedContent, function( thisItem ){
- return arguments.thisItem.getContentID();
- } ).toList();
+ return arrayMap(
+ variables.relatedContent,
+ function( thisItem ) {
+ return arguments.thisItem.getContentID();
+ }
+ ).toList();
}
return "";
}
@@ -909,7 +927,7 @@ component
*
* @relatedContent The related content to set
*/
- BaseContent function setRelatedContent( required array relatedContent ){
+ BaseContent function setRelatedContent( required array relatedContent ) {
if ( hasRelatedContent() ) {
variables.relatedContent.clear();
variables.relatedContent.addAll( arguments.relatedContent );
@@ -924,7 +942,7 @@ component
*
* @relatedContent The list or array of relatedContent ids
*/
- BaseContent function inflateRelatedContent( required any relatedContent ){
+ BaseContent function inflateRelatedContent( required any relatedContent ) {
var allContent = [];
// convert to array
if ( isSimpleValue( arguments.relatedContent ) ) {
@@ -932,7 +950,7 @@ component
}
// iterate over array
for ( var x = 1; x <= arrayLen( arguments.relatedContent ); x++ ) {
- var id = trim( arguments.relatedContent[ x ] );
+ var id = trim( arguments.relatedContent[ x ] );
// get content from id
var extantContent = contentService.get( id );
// if found, add to array
@@ -948,21 +966,21 @@ component
/**
* Determines if the content object can have comments or not
*/
- boolean function commentsAllowed(){
+ boolean function commentsAllowed() {
return !isContentStore();
}
/**
* Determines if the content object is a content store type
*/
- boolean function isContentStore(){
+ boolean function isContentStore() {
return getContentType() == "contentStore";
}
/**
* Override the setComments
*/
- BaseContent function setComments( required array comments ){
+ BaseContent function setComments( required array comments ) {
if ( hasComment() ) {
variables.comments.clear();
variables.comments.addAll( arguments.comments );
@@ -975,7 +993,7 @@ component
/**
* Override the setter
*/
- BaseContent function setCustomFields( required array customFields ){
+ BaseContent function setCustomFields( required array customFields ) {
if ( hasCustomField() ) {
variables.customFields.clear();
variables.customFields.addAll( arguments.customFields );
@@ -988,7 +1006,7 @@ component
/**
* Get custom fields as a structure representation
*/
- struct function getCustomFieldsAsStruct(){
+ struct function getCustomFieldsAsStruct() {
var results = {};
// if no fields, just return empty
@@ -1010,7 +1028,7 @@ component
* @key The custom field key to get
* @defaultValue The default value if the key is not found.
*/
- any function getCustomField( required key, defaultValue ){
+ any function getCustomField( required key, defaultValue ) {
var fields = getCustomFieldsAsStruct();
if ( structKeyExists( fields, arguments.key ) ) {
return fields[ arguments.key ];
@@ -1028,7 +1046,12 @@ component
/**
* Override the setContentVersions
*/
- BaseContent function setContentVersions( required array contentVersions ){
+ BaseContent function setContentVersions( required array contentVersions ) {
+
+ if ( !isArray( arguments.contentVersions ) ) {
+ arguments.contentVersions = [];
+ }
+
if ( hasContentVersion() ) {
variables.contentVersions.clear();
variables.contentVersions.addAll( arguments.contentVersions );
@@ -1041,7 +1064,7 @@ component
/**
* Only adds it if not found in content object
*/
- BaseContent function addCategories( required category ){
+ BaseContent function addCategories( required category ) {
if ( !hasCategories( arguments.category ) ) {
arrayAppend( variables.categories, arguments.category );
}
@@ -1051,7 +1074,7 @@ component
/**
* Remove only if it's found in the content object
*/
- BaseContent function removeCategories( required category ){
+ BaseContent function removeCategories( required category ) {
if ( hasCategories( arguments.category ) ) {
arrayDelete( variables.categories, arguments.category );
}
@@ -1061,7 +1084,7 @@ component
/*
* I remove all category associations
*/
- BaseContent function removeAllCategories(){
+ BaseContent function removeAllCategories() {
if ( hasCategories() ) {
variables.categories.clear();
} else {
@@ -1073,7 +1096,7 @@ component
/*
* I remove all custom fields
*/
- BaseContent function removeAllCustomFields(){
+ BaseContent function removeAllCustomFields() {
if ( hasCustomField() ) {
variables.customFields.clear();
} else {
@@ -1085,7 +1108,7 @@ component
/*
* I remove all linked content associations
*/
- BaseContent function removeAllLinkedContent(){
+ BaseContent function removeAllLinkedContent() {
if ( hasLinkedContent() ) {
for ( var item in variables.linkedContent ) {
item.removeRelatedContent( this );
@@ -1097,7 +1120,7 @@ component
/**
* Override the setChildren
*/
- BaseContent function setChildren( required array children ){
+ BaseContent function setChildren( required array children ) {
if ( hasChild() ) {
variables.children.clear();
variables.children.addAll( arguments.children );
@@ -1107,40 +1130,10 @@ component
return this;
}
- /**
- * Verify and rotate maximum content versions
- */
- private function maxContentVersionChecks(){
- if ( !len( variables.settingService.getSetting( "cb_versions_max_history" ) ) ) {
- return;
- }
-
- // How many versions do we have?
- var versionCounts = contentVersionService
- .newCriteria()
- .isEq( "relatedContent.contentID", getContentID() )
- .count();
-
- // Have we passed the limit?
- if ( ( versionCounts + 1 ) GT variables.settingService.getSetting( "cb_versions_max_history" ) ) {
- var oldestVersion = contentVersionService
- .newCriteria()
- .isEq( "relatedContent.contentID", getContentID() )
- .isEq( "isActive", javacast( "boolean", false ) )
- .withProjections( id = "true" )
- .list(
- sortOrder = "createdDate DESC",
- offset = variables.settingService.getSetting( "cb_versions_max_history" ) - 2
- );
- // delete by primary key IDs found
- contentVersionService.deleteByID( arrayToList( oldestVersion ) );
- }
- }
-
/**
* Retrieves the latest content string from the latest version un-translated
*/
- string function getContent(){
+ string function getContent() {
return getActiveContent( true );
}
@@ -1149,7 +1142,7 @@ component
*
* @asString Default false. When provided as true, a projection list query to retrieve only the string content will be executed
*/
- any function getActiveContent( asString = false ){
+ any function getActiveContent( asString = false ) {
// If we don't have any versions, send back a new one
if ( variables.keyExists( "activeContent" ) && !isSimpleValue( variables.activeContent ) ) {
return arguments.asString ? variables.activeContent.getContent() : variables.activeContent;
@@ -1167,12 +1160,21 @@ component
.first();
return activeContentStruct[ "content" ];
} else {
- var activeVersions = getContentVersions().filter( ( version ) => version.getIsActive() );
- return activeVersions.len() ? activeVersions.first() : variables.contentVersionService.new();
+ var activeVersion = variables
+ .contentVersionService
+ .newCriteria()
+ .isEq( "relatedContent.contentID", getContentID() )
+ .isEq( "isActive", javacast( "boolean", true ) )
+ .order( "version", "desc" )
+ .list( max = 1 );
+ return arrayLen( activeVersion ) ? activeVersion[ 1 ] : variables.contentVersionService.new();
}
}
- function hasActiveContentVersion(){
+ /**
+ * Verify if this content object has any content versions or not
+ */
+ boolean function hasActiveContentVersion() {
return ( isLoaded() && hasContentVersion() && getActiveContent().getIsActive() );
}
@@ -1181,7 +1183,7 @@ component
*
* @content The content to set as the active version
*/
- BaseContent function setActiveContent( required content ){
+ BaseContent function setActiveContent( required content ) {
variables.activeContent = arguments.content;
return this;
}
@@ -1189,14 +1191,14 @@ component
/**
* Verify if this content object has an active version with content
*/
- boolean function hasActiveContent(){
+ boolean function hasActiveContent() {
return isLoaded() && hasActiveContentVersion();
}
/**
* Shorthand Creator name
*/
- string function getCreatorName(){
+ string function getCreatorName() {
if ( hasCreator() ) {
return getCreator().getFullName();
}
@@ -1206,7 +1208,7 @@ component
/**
* Shorthand Creator email
*/
- string function getCreatorEmail(){
+ string function getCreatorEmail() {
if ( hasCreator() ) {
return getCreator().getEmail();
}
@@ -1216,21 +1218,21 @@ component
/**
* Shorthand Author name from latest version
*/
- string function getAuthorName(){
+ string function getAuthorName() {
return getActiveContent().getAuthorName();
}
/**
* Shorthand Author email from latest version
*/
- string function getAuthorEmail(){
+ string function getAuthorEmail() {
return getActiveContent().getAuthorEmail();
}
/**
* Shorthand Author from latest version or null if any yet
*/
- any function getAuthor(){
+ any function getAuthor() {
return getActiveContent().getAuthor();
}
@@ -1241,7 +1243,7 @@ component
*
* @return The parent ID or empty value if none attached
*/
- function getParentID(){
+ function getParentID() {
return ( hasParent() ? getParent().getContentID() : "" );
}
@@ -1250,47 +1252,45 @@ component
*
* @return The parent name or empty value if none attached
*/
- function getParentName(){
+ function getParentName() {
return ( hasParent() ? getParent().getTitle() : "" );
}
/**
* 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(){
+ boolean function isExpired() {
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;
+ isContentPublished() && !isNull( variables.expireDate ) && len( variables.expireDate ) &&
+ dateCompare( variables.expireDate, now() ) LTE 0
+ )
+ ? true
+ : false;
}
/**
* Bit that denotes if the content has been published or not
*/
- boolean function isContentPublished(){
+ boolean function isContentPublished() {
return (
- getIsPublished() AND
- !isNull( variables.publishedDate ) AND
- dateCompare( variables.publishedDate, now() ) lte 0
- ) ? true : false;
+ getIsPublished() && !isNull( variables.publishedDate ) &&
+ 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
- dateCompare( variables.publishedDate, now() ) eq 1
- ) ? true : false;
+ boolean function isPublishedInFuture() {
+ return ( getIsPublished() && dateCompare( variables.publishedDate, now() ) EQ 1 ) ? true : false;
}
/**
* Is entity loaded
*/
- boolean function isLoaded(){
+ boolean function isLoaded() {
return ( len( getContentID() ) ? true : false );
}
@@ -1315,26 +1315,26 @@ component
required boolean publish,
required any originalSlugRoot,
required any newSlugRoot
- ){
+ ) {
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.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.contentTemplate = arguments.original.getContentTemplate();
- variables.childContentTemplate = arguments.original.getChildContentTemplate();
- variables.comments = [];
- variables.children = [];
+ variables.showInSearch = arguments.original.getShowInSearch();
+ variables.featuredImage = arguments.original.getFeaturedImage();
+ variables.featuredImageURL = arguments.original.getFeaturedImageURL();
+ variables.contentTemplate = arguments.original.getContentTemplate();
+ variables.childContentTemplate = arguments.original.getChildContentTemplate();
+ variables.comments = [];
+ variables.children = [];
// Are we publishing?
if ( arguments.publish ) {
@@ -1342,9 +1342,12 @@ component
}
// get latest content versioning
- var latestContent = arguments.original.getActiveContent().getContent();
+ var latestContent = arguments
+ .original
+ .getActiveContent()
+ .getContent();
// Original slug updates on all content
- latestContent = reReplaceNoCase(
+ latestContent = reReplaceNoCase(
latestContent,
"page\:\[#arguments.originalSlugRoot#\/",
"page:[#arguments.newSlugRoot#/",
@@ -1353,65 +1356,78 @@ component
// reset versioning, and start with a new one
addNewContentVersion(
- content : latestContent,
- changelog: "Content Cloned!",
- author : arguments.author
+ content = latestContent,
+ changelog = "Content Cloned!",
+ author = arguments.author
);
// safe clone custom fields
- variables.customFields = arguments.original
+ variables.customFields = arguments
+ .original
.getCustomFields()
- .map( function( thisField ){
- return variables.customFieldService
- .new( {
- key : arguments.thisField.getKey(),
- value : arguments.thisField.getValue()
- } )
- .setRelatedContent( this );
- } );
+ .map(
+ function( thisField ) {
+ return variables
+ .customFieldService
+ .new(
+ {
+ key : arguments.thisField.getKey(),
+ value: arguments.thisField.getValue()
+ }
+ )
+ .setRelatedContent( this );
+ }
+ );
// clone related content
- arguments.original
+ arguments
+ .original
.getRelatedContent()
- .each( function( thisRelatedContent ){
- addRelatedContent( arguments.thisRelatedContent );
- } );
+ .each(
+ function( thisRelatedContent ) {
+ addRelatedContent( arguments.thisRelatedContent );
+ }
+ );
// clone categories
- arguments.original
+ arguments
+ .original
.getCategories()
- .each( function( thisCategory ){
- addCategories( variables.categoryService.getOrCreate( arguments.thisCategory, getSite() ) );
- } );
+ .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
+ 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 = arguments.thisChild.getSlug(),
- newSlugRoot = newChild.getSlug()
- );
- } );
+ .each(
+ function( thisChild ) {
+ var newChild = originalService.new(
+ {
+ creator: author,
+ title : arguments.thisChild.getTitle(),
+ slug : listLast( arguments.thisChild.getSlug(), "/" ),
+ site : getSite()
+ }
+ ).setParent( this );
+
+ newChild.clone(
+ author = author,
+ original = arguments.thisChild,
+ originalService = originalService,
+ publish = publish,
+ originalSlugRoot = arguments.thisChild.getSlug(),
+ newSlugRoot = newChild.getSlug()
+ );
+ }
+ );
} else {
arguments.originalService.save( this );
}
@@ -1428,7 +1444,7 @@ component
*
* @return The published date time as {hour}:{minute}.
*/
- string function getPublishedDateTime(){
+ string function getPublishedDateTime() {
if ( isNull( variables.publishedDate ) || !len( variables.publishedDate ) ) {
return "";
}
@@ -1441,7 +1457,7 @@ component
*
* @return The expire date time as {hour}:{minute}.
*/
- string function getExpireDateTime(){
+ string function getExpireDateTime() {
if ( isNull( variables.expireDate ) || !len( variables.expireDate ) ) {
return "";
}
@@ -1460,17 +1476,15 @@ component
dateFormat = this.DATE_FORMAT,
timeFormat = this.TIME_FORMAT,
boolean showTime = true
- ){
+ ) {
if ( isNull( variables.publishedDate ) || !len( variables.publishedDate ) ) {
return "";
}
if ( !arguments.showTime ) {
return dateFormat( variables.publishedDate, arguments.dateFormat );
}
- return dateFormat( variables.publishedDate, arguments.dateFormat ) & " " & timeFormat(
- variables.publishedDate,
- arguments.timeFormat
- );
+ return dateFormat( variables.publishedDate, arguments.dateFormat ) & " " & timeFormat( variables.publishedDate,
+ arguments.timeFormat );
}
/**
@@ -1485,30 +1499,28 @@ component
dateFormat = this.DATE_FORMAT,
timeFormat = this.TIME_FORMAT,
boolean showTime = true
- ){
+ ) {
if ( isNull( variables.expireDate ) || !len( variables.expireDate ) ) {
return "";
}
if ( !arguments.showTime ) {
return dateFormat( variables.expireDate, arguments.dateFormat );
}
- return dateFormat( variables.expireDate, arguments.dateFormat ) & " " & timeFormat(
- variables.expireDate,
- arguments.timeFormat
- );
+ return dateFormat( variables.expireDate, arguments.dateFormat ) & " " & timeFormat( variables.expireDate,
+ arguments.timeFormat );
}
/**
* isPassword Protected
*/
- boolean function isPasswordProtected(){
+ boolean function isPasswordProtected() {
return len( getPasswordProtection() );
}
/**
* add published timestamp to property
*/
- any function addPublishedTime( required hour, required minute ){
+ any function addPublishedTime( required hour, required minute ) {
if ( !isDate( getPublishedDate() ) ) {
return this;
}
@@ -1522,7 +1534,7 @@ component
*
* @timeString The joined time string (e.g., 12:00)
*/
- any function addJoinedPublishedTime( required string timeString ){
+ any function addJoinedPublishedTime( required string timeString ) {
var splitTime = listToArray( arguments.timeString, ":" );
if ( arrayLen( splitTime ) == 2 ) {
return addPublishedTime( splitTime[ 1 ], splitTime[ 2 ] );
@@ -1534,7 +1546,7 @@ component
/**
* add expired timestamp to property
*/
- any function addExpiredTime( required hour, required minute ){
+ any function addExpiredTime( required hour, required minute ) {
if ( !isDate( getExpireDate() ) ) {
return this;
}
@@ -1556,7 +1568,7 @@ component
*
* @timeString The joined time string (e.g., 12:00)
*/
- any function addJoinedExpiredTime( required string timeString ){
+ any function addJoinedExpiredTime( required string timeString ) {
var splitTime = listToArray( arguments.timeString, ":" );
if ( arrayLen( splitTime ) == 2 ) {
return addExpiredTime( splitTime[ 1 ], splitTime[ 2 ] );
@@ -1568,7 +1580,7 @@ component
/**
* Build content cache keys according to sent content object
*/
- string function buildContentCacheKey(){
+ string function buildContentCacheKey() {
var inputHash = hash( cgi.HTTP_HOST & cgi.query_string );
return "cb-content-#getContentType()#-#getContentID()#-#i18n.getfwLocale()#-#inputHash#";
}
@@ -1576,20 +1588,20 @@ component
/**
* This builds a partial cache key so we can clean from the cache many permutations of the content object
*/
- string function buildContentCacheCleanupKey(){
+ string function buildContentCacheCleanupKey() {
return "cb-content-#getContentType()#-#getContentID()#";
}
/**
* Verify we can do content caching on this content object using global and local rules
*/
- boolean function canCacheContent(){
+ boolean function canCacheContent() {
var settings = variables.settingService.getAllSettings();
// check global caching first
if (
- ( getContentType() eq "page" AND settings.cb_content_caching ) OR
- ( getContentType() eq "entry" AND settings.cb_entry_caching )
+ ( getContentType() EQ "page" && settings.cb_content_caching ) ||
+ ( getContentType() EQ "entry" && settings.cb_entry_caching )
) {
// check override in local content bit
return ( getCache() ? true : false );
@@ -1600,14 +1612,14 @@ component
/**
* Shortcut to get the rendered content
*/
- any function getRenderedContent(){
+ any function getRenderedContent() {
return this.renderContent();
}
/**
* Shortcut to get the rendered excerpt
*/
- any function getRenderedExcerpt(){
+ any function getRenderedExcerpt() {
if ( !isNull( variables.excerpt ) ) {
return this.renderExcerpt();
}
@@ -1617,25 +1629,25 @@ component
/**
* Render content out using translations, caching, etc.
*/
- any function renderContent(){
+ any function renderContent() {
var settings = variables.settingService.getAllSettings();
// caching enabled?
if ( canCacheContent() ) {
// Build Cache Key
- var cacheKey = buildContentCacheKey();
+ var cacheKey = buildContentCacheKey();
// Get appropriate cache provider
- var cache = cacheBox.getCache( settings.cb_content_cacheName );
+ var cache = cacheBox.getCache( settings.cb_content_cacheName );
// Try to get content?
var cachedContent = cache.get( cacheKey );
// Verify it exists, if it does, return it
- if ( !isNull( cachedContent ) AND len( cachedContent ) ) {
+ if ( !isNull( cachedContent ) && len( cachedContent ) ) {
return cachedContent;
}
}
// Check if we need to translate
- if ( NOT len( variables.renderedContent ) ) {
+ if ( !len( variables.renderedContent ) ) {
// save content
variables.renderedContent = renderContentSilent();
}
@@ -1644,11 +1656,15 @@ component
if ( canCacheContent() ) {
// Store content in cache, of local timeouts are 0 then use global timeouts.
cache.set(
- cacheKey,
- variables.renderedContent,
- ( getCacheTimeout() eq 0 ? settings.cb_content_cachingTimeout : getCacheTimeout() ),
- ( getCacheLastAccessTimeout() eq 0 ? settings.cb_content_cachingTimeoutIdle : getCacheLastAccessTimeout() )
- );
+ cacheKey,
+ variables.renderedContent,
+ ( getCacheTimeout() EQ 0 ? settings.cb_content_cachingTimeout : getCacheTimeout() ),
+ (
+ getCacheLastAccessTimeout() EQ 0
+ ? settings.cb_content_cachingTimeoutIdle
+ : getCacheLastAccessTimeout()
+ )
+ );
}
// renturn translated content
@@ -1660,11 +1676,14 @@ component
*
* @content The content markup to translate, by default it uses the active content version's content
*/
- any function renderContentSilent( any content = getContent() ) profile{
+ any function renderContentSilent( any content = getContent() ) profile {
// 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();
}
@@ -1672,16 +1691,19 @@ component
/**
* Inflate custom fields from the incoming count and memento structure
*/
- any function inflateCustomFields( required numeric fieldCount, required struct memento ){
+ any function inflateCustomFields(
+ required numeric fieldCount,
+ required struct memento
+ ) {
// remove original custom fields
getCustomFields().clear();
// inflate custom fields start at 0 as it is incoming javascript counting of arrays
- for ( var x = 0; x lt arguments.fieldCount; x++ ) {
+ for ( var x = 0; x LT arguments.fieldCount; x++ ) {
// get custom field from incoming data
var args = {
- key : arguments.memento[ "CustomFieldKeys_#x#" ],
- value : arguments.memento[ "CustomFieldValues_#x#" ]
+ key : arguments.memento[ "CustomFieldKeys_#x#" ],
+ value: arguments.memento[ "CustomFieldValues_#x#" ]
};
// only add if key has value
if ( len( trim( args.key ) ) ) {
@@ -1697,13 +1719,16 @@ component
/**
* Get an array of category slugs for this content object
*/
- array function getCategoriesArray(){
- if ( NOT hasCategories() ) {
+ array function getCategoriesArray() {
+ if ( !hasCategories() ) {
return [];
}
- return arrayMap( variables.categories, function( item ){
- return arguments.item.getCategory();
- } );
+ return arrayMap(
+ variables.categories,
+ function( item ) {
+ return arguments.item.getCategory();
+ }
+ );
}
/**
@@ -1711,28 +1736,28 @@ component
*
* @return The category list or `Uncategorized` if it doesn't have any
*/
- string function getCategoriesList(){
+ string function getCategoriesList() {
return getCategoriesArray().toList();
}
/**
* Shortcut to get the site name
*/
- function getSiteName(){
+ function getSiteName() {
return getSite().getName();
}
/**
* Shortcut to get the site slug
*/
- function getSiteSlug(){
+ function getSiteSlug() {
return getSite().getSlug();
}
/**
* Shortcut to get the site id
*/
- function getSiteID(){
+ function getSiteID() {
if ( hasSite() ) {
return getSite().getsiteID();
}
@@ -1744,7 +1769,7 @@ component
*
* @site The site id or site object to verify
*/
- boolean function isSameSite( required site ){
+ boolean function isSameSite( required site ) {
// If no site attached, break.
if ( !hasSite() ) {
return false;
@@ -1764,12 +1789,12 @@ component
*
* @parent The parent object or null
*/
- BaseContent function setParent( parent ){
+ BaseContent function setParent( parent ) {
// Nulllify?
if ( isNull( arguments.parent ) ) {
variables.parent = javacast( "null", "" );
// remove the hierarchical information from our slug as we are promoting to the root
- variables.slug = listLast( variables.slug, "/" );
+ variables.slug = listLast( variables.slug, "/" );
return this;
} else {
// Welcome home papa!
@@ -1789,7 +1814,7 @@ component
/**
* Apply any assigned content templates to this instance
*/
- BaseContent function applyContentTemplate(){
+ BaseContent function applyContentTemplate() {
var template = getContentTemplate();
if ( !isNull( template ) ) {
var definition = template.getDefintion();
@@ -1799,36 +1824,43 @@ component
invoke(
this,
"populate",
- { "memento" : { "#key#" : definition[ key ].value } }
+ { "memento": { "#key#": definition[ key ].value } }
);
} else if ( isArray( currentVal ) ) {
switch ( key ) {
case "customFields": {
var existingFields = getCustomFieldsAsStruct().keyArray();
- definition[ key ].each( function( item ){
- if ( !existingFields.contains( item.name ) ) {
- var thisField = customFieldService.new(
- properties = { "key" : item.name, "value" : item.defaultValue ?: "" }
- );
- thisField.setRelatedContent( this );
- addCustomField( thisField );
- }
- } );
+ definition[ key ].each(
+ function( item ) {
+ if ( !existingFields.contains( item.name ) ) {
+ var thisField = customFieldService.new(
+ properties = {
+ "key" : item.name,
+ "value": item.defaultValue ?: ""
+ }
+ );
+ thisField.setRelatedContent( this );
+ addCustomField( thisField );
+ }
+ }
+ );
break;
}
case "categories": {
if ( hasCategories() ) {
- var existingCategories = getCategories().map( function( cat ){
- return cat.getCategoryID();
- } );
+ var existingCategories = getCategories().map(
+ function( cat ) {
+ return cat.getCategoryID();
+ }
+ );
definition[ key ].value.append( existingCategories, true );
}
invoke(
this,
"populate",
{
- "memento" : {
- "#key#" : listToArray(
+ "memento": {
+ "#key#": listToArray(
listRemoveDuplicates( arrayToList( definition[ key ].value ) )
)
}
@@ -1839,15 +1871,49 @@ component
invoke(
this,
"populate",
- { "memento" : { "#key#" : definition[ key ].value } }
+ { "memento": { "#key#": definition[ key ].value } }
);
}
}
} else if ( !len( currentVal ) ) {
- invoke( this, "set" & key, [ definition[ key ].value ] );
+ invoke(
+ this,
+ "set" & key,
+ [ definition[ key ].value]
+ );
}
}
}
}
-}
+ /**
+ * Verify and rotate maximum content versions
+ */
+ private function maxContentVersionChecks() {
+ if ( !len( variables.settingService.getSetting( "cb_versions_max_history" ) ) ) {
+ return;
+ }
+
+ // How many versions do we have?
+ var versionCounts = contentVersionService
+ .newCriteria()
+ .isEq( "relatedContent.contentID", getContentID() )
+ .count();
+
+ // Have we passed the limit?
+ if ( ( versionCounts + 1 ) GT variables.settingService.getSetting( "cb_versions_max_history" ) ) {
+ var oldestVersion = contentVersionService
+ .newCriteria()
+ .isEq( "relatedContent.contentID", getContentID() )
+ .isEq( "isActive", javacast( "boolean", false ) )
+ .withProjections( id = "true" )
+ .list(
+ sortOrder = "createdDate DESC",
+ offset = variables.settingService.getSetting( "cb_versions_max_history" ) - 2
+ );
+ // delete by primary key IDs found
+ contentVersionService.deleteByID( arrayToList( oldestVersion ) );
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/Category.cfc b/modules/contentbox/models/content/Category.cfc
index 51d449366b..2b3c9f03ad 100755
--- a/modules/contentbox/models/content/Category.cfc
+++ b/modules/contentbox/models/content/Category.cfc
@@ -13,120 +13,91 @@ component
cachename ="cbCategory"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="categoryService"
- inject ="provider:categoryService@contentbox"
+ name="categoryService"
+ inject="provider:categoryService@contentbox"
persistent="false";
property
- name ="pageService"
- inject ="provider:pageService@contentbox"
+ name="pageService"
+ inject="provider:pageService@contentbox"
persistent="false";
property
- name ="entryService"
- inject ="provider:entryService@contentbox"
+ name="entryService"
+ inject="provider:entryService@contentbox"
persistent="false";
property
- name ="contentStoreService"
- inject ="provider:contentStoreService@contentbox"
+ name="contentStoreService"
+ inject="provider:contentStoreService@contentbox"
persistent="false";
property
- name ="settingService"
- inject ="provider:settingService@contentbox"
+ name="settingService"
+ inject="provider:settingService@contentbox"
persistent="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="categoryID"
- column ="categoryID"
+ name="categoryID"
+ column="categoryID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="category"
- column ="category"
+ name="category"
+ column="category"
notnull="true"
- length ="200"
- index ="idx_categoryName";
+ length="200"
+ index="idx_categoryName";
property
- name ="slug"
- column ="slug"
+ name="slug"
+ column="slug"
notnull="true"
- length ="200"
- index ="idx_categorySlug";
+ length="200"
+ index="idx_categorySlug";
property
- name ="isPublic"
- column ="isPublic"
+ name="isPublic"
+ column="isPublic"
ormtype="boolean"
notnull="false"
default="true"
- index ="idx_isPublic";
+ index="idx_isPublic";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> site loaded as a proxy and fetched immediately
property
- name ="site"
- notnull ="true"
- cfc ="contentbox.models.system.Site"
+ name="site"
+ notnull="true"
+ cfc="contentbox.models.system.Site"
fieldtype="many-to-one"
- fkcolumn ="FK_siteID"
- lazy ="true";
-
- /* *********************************************************************
- ** CALCULATED FIELDS
- ********************************************************************* */
-
- property
- name ="numberOfContentStore"
- formula="select count(*)
- from cb_contentCategories as contentCategories, cb_contentStore as contentStore, cb_content as content
- where contentCategories.FK_categoryID=categoryID
- and contentCategories.FK_contentID = contentStore.contentID
- and contentStore.contentID = content.contentID";
-
- property
- name ="numberOfEntries"
- formula="select count(*)
- from cb_contentCategories as contentCategories, cb_entry as entry, cb_content as content
- where contentCategories.FK_categoryID=categoryID
- and contentCategories.FK_contentID = entry.contentID
- and entry.contentID = content.contentID";
-
- property
- name ="numberOfPages"
- formula="select count(*)
- from cb_contentCategories as contentCategories, cb_page as page, cb_content as content
- where contentCategories.FK_categoryID=categoryID
- and contentCategories.FK_contentID = page.contentID
- and page.contentID = content.contentID";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + MEMENTO
- ********************************************************************* */
+ fkcolumn="FK_siteID"
+ batchsize="25"
+ lazy="true";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + MEMENTO
+ **********************************************************************/
this.pk = "categoryID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"category",
"isPublic",
"numberOfContentStore",
@@ -135,42 +106,51 @@ component
"slug",
"siteSnapshot:site"
],
- defaultExcludes : [ "site" ]
+ defaultExcludes: [ "site"]
};
this.constraints = {
- "category" : { required : true, size : "1..200" },
- "isPublic" : { required : true, type : "boolean" },
- "slug" : {
- required : true,
- size : "1..200",
- udfMessage : "The 'slug' is not unique",
- udf : function( value, target ){
- return arguments.target
+ "category": { required: true, size: "1..200" },
+ "isPublic": { required: true, type: "boolean" },
+ "slug" : {
+ required : true,
+ size : "1..200",
+ udfMessage: "The 'slug' is not unique",
+ udf : function( value, target ) {
+ return arguments
+ .target
.getCategoryService()
.isSlugUnique(
- slug : arguments.value,
- categoryID: arguments.target.isLoaded() ? arguments.target.getCategoryID() : "",
- siteID : arguments.target.hasSite() ? arguments.target.getSite().getSiteID() : ""
+ slug = arguments.value,
+ categoryID = arguments.target.isLoaded() ? arguments.target.getCategoryID() : "",
+ siteID = arguments.target.hasSite()
+ ? arguments
+ .target
+ .getSite()
+ .getSiteID()
+ : ""
);
}
}
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
- variables.category = "";
- variables.slug = "";
- variables.numberOfPublishedPages = "";
- variables.numberOfPublishedEntries = "";
+ function init() {
+ variables.category = "";
+ variables.slug = "";
+ variables.numberOfEntries = "";
+ variables.numberOfPages = "";
+ variables.numberOfContentStore = "";
+ variables.numberOfPublishedPages = "";
+ variables.numberOfPublishedEntries = "";
variables.numberOfPublishedContentStore = "";
- variables.isPublic = true;
+ variables.isPublic = true;
super.init();
@@ -180,10 +160,10 @@ component
/**
* Helper to get the count of published pages for this category.
*/
- numeric function getNumberOfPublishedPages(){
+ numeric function getNumberOfPublishedPages() {
// Caching per load basis
if ( !len( variables.numberOfPublishedPages ) ) {
- variables.numberOfPublishedPages = getNumberOfPublishedContent( variables.pageService );
+ variables.numberOfPublishedPages = getNumberOfPublishedContent( variables.pageService, "pages" );
}
return variables.numberOfPublishedPages;
}
@@ -191,10 +171,11 @@ component
/**
* Helper to get the count of published content store for this category.
*/
- numeric function getNumberOfPublishedContentStore(){
+ numeric function getNumberOfPublishedContentStore() {
// Caching per load basis
if ( !len( variables.numberOfPublishedContentStore ) ) {
- variables.numberOfPublishedContentStore = getNumberOfPublishedContent( variables.contentStoreService );
+ variables.numberOfPublishedContentStore = getNumberOfPublishedContent( variables.contentStoreService,
+ "contentstore" );
}
return variables.numberOfPublishedContentStore;
}
@@ -202,10 +183,10 @@ component
/**
* Helper to get the count of published entries for this category.
*/
- numeric function getNumberOfPublishedEntries(){
+ numeric function getNumberOfPublishedEntries() {
// Caching per load basis
if ( !len( variables.numberOfPublishedEntries ) ) {
- variables.numberOfPublishedEntries = getNumberOfPublishedContent( variables.entryService );
+ variables.numberOfPublishedEntries = getNumberOfPublishedContent( variables.entryService, "entries" );
}
return variables.numberOfPublishedEntries;
}
@@ -213,45 +194,102 @@ component
/**
* Build a site snapshot
*/
- struct function getSiteSnapshot(){
+ struct function getSiteSnapshot() {
return ( hasSite() ? getSite().getInfoSnapshot() : {} );
}
/**
* Shortcut to get the site id
*/
- function getSiteID(){
+ function getSiteID() {
if ( hasSite() ) {
return getSite().getsiteID();
}
return "";
}
+ /**
+ * Get the total number of entries (regardless of published state) for this category.
+ */
+ numeric function getNumberOfEntries() {
+ if ( !len( variables.numberOfEntries ) ) {
+ variables.numberOfEntries = getNumberOfTotalContent( variables.entryService, "entries" );
+ }
+ return variables.numberOfEntries;
+ }
+
+ /**
+ * Get the total number of pages (regardless of published state) for this category.
+ */
+ numeric function getNumberOfPages() {
+ if ( !len( variables.numberOfPages ) ) {
+ variables.numberOfPages = getNumberOfTotalContent( variables.pageService, "pages" );
+ }
+ return variables.numberOfPages;
+ }
+
+ /**
+ * Get the total number of content store items (regardless of published state) for this category.
+ */
+ numeric function getNumberOfContentStore() {
+ if ( !len( variables.numberOfContentStore ) ) {
+ variables.numberOfContentStore = getNumberOfTotalContent( variables.contentStoreService, "contentstore" );
+ }
+ return variables.numberOfContentStore;
+ }
+
/********************************** PRIVATE **********************************/
/**
- * Get the number of published content by category and service type
+ * Get the count of all (total) content for this category by service type.
+ * Results are cached in CacheBox per category slug and content type.
+ *
+ * @service The target content service to use.
+ * @contentType A discriminator string baked into the cache key (e.g. "entries", "pages", "contentstore").
+ */
+ private numeric function getNumberOfTotalContent( required service, required string contentType ) {
+ return variables
+ .cacheBox
+ .getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
+ .getOrSet(
+ "cb-content-category-total-counts-#getSlug()#-#arguments.contentType#",
+ function() {
+ return service
+ .newCriteria()
+ .createAlias( "categories", "categories" )
+ .isEq( "categories.categoryID", getCategoryID() ?: "" )
+ .count( "contentID" );
+ }
+ );
+ }
+
+ /**
+ * Get the number of published content by category and service type.
+ * Results are cached in CacheBox per category slug and content type.
*
- * @service The target service to use.
+ * @service The target content service to use.
+ * @contentType A discriminator string baked into the cache key (e.g. "entries", "pages", "contentstore").
*/
- private numeric function getNumberOfPublishedContent( required service ){
- return variables.cacheBox
+ private numeric function getNumberOfPublishedContent( required service, required string contentType ) {
+ return variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
- .getOrSet( "cb-content-category-counts-#getSlug()#", function(){
- return service
- .newCriteria()
- .createAlias( "categories", "categories" )
- .isEq( "categories.categoryID", getCategoryID() )
- .isTrue( "isPublished" )
- .isLE( "publishedDate", now() )
- .isEq( "passwordProtection", "" )
- .$or(
- service.getRestrictions().isNull( "expireDate" ),
- service.getRestrictions().isGT( "expireDate", now() )
- )
- .cache( true )
- .count( "contentID" );
- } );
+ .getOrSet(
+ "cb-content-category-counts-#getSlug()#-#arguments.contentType#",
+ function() {
+ return service
+ .newCriteria()
+ .createAlias( "categories", "categories" )
+ .isEq( "categories.categoryID", getCategoryID() )
+ .isTrue( "isPublished" )
+ .isLE( "publishedDate", now() )
+ .isEq( "passwordProtection", "" )
+ .$or( service.getRestrictions().isNull( "expireDate" ),
+ service.getRestrictions().isGT( "expireDate", now() ) )
+ .cache( true )
+ .count( "contentID" );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/CategoryService.cfc b/modules/contentbox/models/content/CategoryService.cfc
index 0dc10fcdee..3ab49282be 100755
--- a/modules/contentbox/models/content/CategoryService.cfc
+++ b/modules/contentbox/models/content/CategoryService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,16 +6,17 @@
* Category service for contentbox
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// Dependencies
property name="htmlHelper" inject="HTMLHelper@coldbox";
+
property name="contentService" inject="contentService@contentbox";
+
property name="dateUtil" inject="DateUtil@contentbox";
/**
* Constructor
*/
- CategoryService function init(){
+ CategoryService function init() {
// init it
super.init( entityName = "cbCategory", useQueryCaching = true );
@@ -35,35 +36,46 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @return struct of { count, categories }
*/
struct function search(
- search = "",
- siteID = "",
+ search = "",
+ siteID = "",
boolean isPublic,
max = 0,
offset = 0,
sortOrder = "category asc"
- ){
- var results = { "count" : 0, "categories" : [] };
- var c = newCriteria()
+ ) {
+ var results = { "count": 0, "categories": [] };
+ var c = newCriteria()
+ .when(
+ len( arguments.search ),
+ function( c ) {
+ c.like( "category", "%#search#%" );
+ }
+ )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
// Search Criteria
- .when( len( arguments.search ), function( c ){
- c.like( "category", "%#search#%" );
- } )
+
// Site Filter
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
+
// IsPublic Filter
- .when( !isNull( arguments.isPublic ), function( c ){
- c.isEq( "isPublic", javacast( "Boolean", isPublic ) );
- } );
+ .when(
+ !isNull( arguments.isPublic ),
+ function( c ) {
+ c.isEq( "isPublic", javacast( "Boolean", isPublic ) );
+ }
+ );
// run criteria query and projections count
- results.count = c.count( "categoryID" );
+ results.count = c.count( "categoryID" );
results.categories = c.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: arguments.sortOrder
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder
+ );
return results;
}
@@ -78,7 +90,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return The target site category
*/
- Category function getOrCreate( required category, required site ){
+ Category function getOrCreate( required category, required site ) {
// Verify the incoming category exists in the target site or not
var oTargetCategory = newCriteria()
.isEq( "slug", arguments.category.getSlug() )
@@ -89,11 +101,13 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Return or Create
if ( isNull( oTargetCategory ) ) {
oTargetCategory = save(
- new ( {
- category : arguments.category.getCategory(),
- slug : arguments.category.getSlug(),
- site : arguments.site
- } )
+ new(
+ {
+ category: arguments.category.getCategory(),
+ slug : arguments.category.getSlug(),
+ site : arguments.site
+ }
+ )
);
}
@@ -110,7 +124,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return The target site category object
*/
- Category function getOrCreateBySlug( required string category, required site ){
+ Category function getOrCreateBySlug( required string category, required site ) {
// Verify the incoming category exists in the target site or not
if ( arguments.site.isLoaded() ) {
var oTargetCategory = newCriteria()
@@ -122,11 +136,13 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Return or Create
if ( isNull( oTargetCategory ) ) {
var oTargetCategory = save(
- new ( {
- category : arguments.category,
- slug : arguments.category,
- site : arguments.site
- } )
+ new(
+ {
+ category: arguments.category,
+ slug : arguments.category,
+ site : arguments.site
+ }
+ )
);
}
@@ -138,12 +154,13 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @siteID The site to filter on
*/
- numeric function getTotalCategoryCount( string siteID = "" ){
- return newCriteria()
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .count();
+ numeric function getTotalCategoryCount( string siteID = "" ) {
+ return newCriteria().when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ ).count();
}
/**
@@ -155,7 +172,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws UniqueCategoryException
*/
- function save( required category ){
+ function save( required category ) {
return super.save( arguments.category );
}
@@ -172,16 +189,25 @@ component extends="cborm.models.VirtualEntityService" singleton {
required any slug,
any categoryID = "",
string siteID = ""
- ){
+ ) {
return newCriteria()
- .isEq( "slug", arguments.slug )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( len( arguments.categoryID ), function( c ){
- c.ne( "categoryID", categoryID );
- } )
- .count() > 0 ? false : true;
+ .isEq( "slug", arguments.slug )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ len( arguments.categoryID ),
+ function( c ) {
+ c.ne( "categoryID", categoryID );
+ }
+ )
+ .count() >
+ 0
+ ? false
+ : true;
}
/**
@@ -195,28 +221,37 @@ component extends="cborm.models.VirtualEntityService" singleton {
required categories,
required site,
boolean isPublic = true
- ){
+ ) {
// convert to array
if ( isSimpleValue( arguments.categories ) ) {
arguments.categories = listToArray( arguments.categories );
}
- var allCats = arguments.categories
+ var allCats = arguments
+ .categories
+ .filter(
+ function( thisCategory ) {
+ return newCriteria()
+ .isEq( "category", arguments.thisCategory )
+ .isEq( "site.siteID", site.getsiteID() )
+ .count() ==
+ 0;
+ }
+ )
// Only create categories that do not exist already
- .filter( function( thisCategory ){
- return newCriteria()
- .isEq( "category", arguments.thisCategory )
- .isEq( "site.siteID", site.getsiteID() )
- .count() == 0;
- } )
- .map( function( thisCategory ){
- return new ( {
- "category" : thisCategory,
- "slug" : variables.htmlHelper.slugify( thisCategory ),
- "site" : site,
- "isPublic" : isPublic
- } );
- } );
+
+ .map(
+ function( thisCategory ) {
+ return new(
+ {
+ "category": thisCategory,
+ "slug" : variables.htmlHelper.slugify( thisCategory ),
+ "site" : site,
+ "isPublic": isPublic
+ }
+ );
+ }
+ );
// Save all cats
if ( arrayLen( allCats ) ) {
@@ -233,7 +268,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return array of categories
*/
- array function inflateCategories( struct memento ){
+ array function inflateCategories( struct memento ) {
var categories = [];
// iterate all memento keys
for ( var key in arguments.memento ) {
@@ -255,7 +290,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @category The category object to remove from the system
*/
- boolean function delete( required category ){
+ boolean function delete( required category ) {
transaction {
// Remove content relationships
var aRelatedContent = removeAllRelatedContent( arguments.category );
@@ -277,7 +312,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
* Remove all content associations from a category and returns all the content objects it was removed from
* @category.hint The category object
*/
- array function removeAllRelatedContent( required category ){
+ array function removeAllRelatedContent( required category ) {
var aRelatedContent = contentService
.newCriteria()
.createAlias( "categories", "c" )
@@ -297,10 +332,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @site The site to export from
*/
- array function getAllForExport( required site ){
- return findAllWhere( { site : arguments.site } ).map( function( thisItem ){
- return thisItem.getMemento( profile: "export" );
- } );
+ array function getAllForExport( required site ) {
+ return findAllWhere( { site: arguments.site } ).map(
+ function( thisItem ) {
+ return thisItem.getMemento( profile = "export" );
+ }
+ );
}
/**
@@ -309,16 +346,22 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @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 ){
+ array function getAllNames( string siteID = "", boolean isPublic ) {
return newCriteria()
- .withProjections( property: "category" )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( !isNull( arguments.isPublic ), function( c ){
- c.isEq( "isPublic", javacast( "Boolean", isPublic ) );
- } )
- .list( sortOrder: "category" );
+ .withProjections( property = "category" )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ !isNull( arguments.isPublic ),
+ function( c ) {
+ c.isEq( "isPublic", javacast( "Boolean", isPublic ) );
+ }
+ )
+ .list( sortOrder = "category" );
}
/**
@@ -327,16 +370,22 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @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 ){
+ array function getAllSlugs( string siteID = "", boolean isPublic ) {
return newCriteria()
- .withProjections( property: "slug" )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( !isNull( arguments.isPublic ), function( c ){
- c.isEq( "isPublic", javacast( "Boolean", isPublic ) );
- } )
- .list( sortOrder: "slug" );
+ .withProjections( property = "slug" )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ !isNull( arguments.isPublic ),
+ function( c ) {
+ c.isEq( "isPublic", javacast( "Boolean", isPublic ) );
+ }
+ )
+ .list( sortOrder = "slug" );
}
/**
@@ -349,14 +398,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -382,29 +434,29 @@ component extends="cborm.models.VirtualEntityService" singleton {
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allCategories = [];
- var siteService = getWireBox().getInstance( "siteService@contentbox" );
+ var siteService = getWireBox().getInstance( "siteService@contentbox" );
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
// iterate and import
for ( var thisCategory in arguments.importData ) {
// Get new or persisted
- var oCategory = this.findBySlug( slug: thisCategory.slug );
- oCategory = ( isNull( oCategory ) ? new () : oCategory );
+ var oCategory = this.findBySlug( slug = thisCategory.slug );
+ oCategory = ( isNull( oCategory ) ? new() : oCategory );
// populate content from data
getBeanPopulator().populateFromStruct(
- target : oCategory,
- memento : thisCategory,
- exclude : "categoryID",
- composeRelationships: false
- );
+ target = oCategory,
+ memento = thisCategory,
+ exclude = "categoryID",
+ composeRelationships = false
+ );
// Link the site
oCategory.setSite( siteService.getBySlugOrFail( thisCategory.site.slug ) );
@@ -413,7 +465,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
if ( !oCategory.isLoaded() ) {
arguments.importLog.append( "New category imported: #thisCategory.slug# " );
arrayAppend( allCategories, oCategory );
- } else if ( oCategory.isLoaded() and arguments.override ) {
+ } else if ( oCategory.isLoaded() && arguments.override ) {
arguments.importLog.append( "Persisted category overriden: #thisCategory.slug# " );
arrayAppend( allCategories, oCategory );
} else {
@@ -428,8 +480,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.importLog.append( "Saved all imported and overriden categories!" );
} else {
arguments.importLog.append(
- "No categories imported as none where found or able to be overriden from the import file."
- );
+ "No categories imported as none where found or able to be overriden from the import file."
+ );
}
}
// end of transaction
@@ -437,4 +489,4 @@ component extends="cborm.models.VirtualEntityService" singleton {
return arguments.importLog.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentService.cfc b/modules/contentbox/models/content/ContentService.cfc
index dfbcd7c3f4..f2b793322d 100755
--- a/modules/contentbox/models/content/ContentService.cfc
+++ b/modules/contentbox/models/content/ContentService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,25 +6,43 @@
* A generic content service for content objects
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="settingService" inject="id:settingService@contentbox";
+
property name="cacheBox" inject="cachebox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="customFieldService" inject="customFieldService@contentbox";
+
property name="categoryService" inject="categoryService@contentbox";
+
property name="commentService" inject="commentService@contentbox";
+
property name="contentVersionService" inject="contentVersionService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
+
property name="contentStoreService" inject="contentStoreService@contentbox";
+
property name="pageService" inject="pageService@contentbox";
+
property name="entryService" inject="entryService@contentbox";
+
property name="systemUtil" inject="SystemUtil@contentbox";
+
property name="statsService" inject="statsService@contentbox";
+
property name="dateUtil" inject="DateUtil@contentbox";
- property name="commentSubscriptionService" inject="CommentSubscriptionService@contentbox";
+
+ property
+ name="commentSubscriptionService"
+ inject="CommentSubscriptionService@contentbox";
+
property name="subscriberService" inject="subscriberService@contentbox";
+
property name="relocationService" inject="RelocationService@contentbox";
+
property name="asyncManager" inject="coldbox:asyncManager";
/**
@@ -32,7 +50,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @entityName The content entity name to bind this service to.
*/
- ContentService function init( entityName = "cbContent" ){
+ ContentService function init( entityName = "cbContent" ) {
// init it
super.init( entityName = arguments.entityName, useQueryCaching = true );
@@ -45,14 +63,18 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @siteID The site to filter on
* @categoryId The category Id to filter on
*/
- numeric function getTotalContentCount( siteID = "", categoryId = "" ){
- var c = newCriteria()
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( len( arguments.categoryId ), function( c ){
- c.joinTo( "categories", "cats" ).isEq( "cats.categoryID", categoryId );
- } );
+ numeric function getTotalContentCount( siteID = "", categoryId = "" ) {
+ var c = newCriteria().when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ ).when(
+ len( arguments.categoryId ),
+ function( c ) {
+ c.joinTo( "categories", "cats" ).isEq( "cats.categoryID", categoryId );
+ }
+ );
return c.count();
}
@@ -61,8 +83,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @async Run it asynchronously or not, defaults to false
*/
- ContentService function clearAllCaches( boolean async = false ){
- variables.cacheBox
+ ContentService function clearAllCaches( boolean async = false ) {
+ variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
.clearByKeySnippet( keySnippet = "cb-content", async = arguments.async );
return this;
@@ -73,8 +96,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @async Run it asynchronously or not, defaults to false
*/
- ContentService function clearAllCategoryCountCaches( boolean async = false ){
- variables.cacheBox
+ ContentService function clearAllCategoryCountCaches( boolean async = false ) {
+ variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
.clearByKeySnippet( keySnippet = "cb-content-category-counts", async = arguments.async );
return this;
@@ -85,8 +109,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @async Run it asynchronously or not, defaults to false
*/
- ContentService function clearAllSitemapCaches( boolean async = false ){
- variables.cacheBox
+ ContentService function clearAllSitemapCaches( boolean async = false ) {
+ variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
.clearByKeySnippet( keySnippet = "cb-content-sitemap", async = arguments.async );
return this;
@@ -97,8 +122,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @async Run it asynchronously or not, defaults to false
*/
- ContentService function clearAllPageWrapperCaches( boolean async = false ){
- variables.cacheBox
+ ContentService function clearAllPageWrapperCaches( boolean async = false ) {
+ variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
.clearByKeySnippet( keySnippet = "cb-content-wrapper", async = arguments.async );
return this;
@@ -110,8 +136,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @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 ){
- variables.cacheBox
+ ContentService function clearPageWrapperCaches( required any slug, boolean async = false ) {
+ variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
.clearByKeySnippet(
keySnippet = "cb-content-wrapper-[^-]*-#arguments.slug#",
@@ -127,8 +154,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @slug The slug to clear
* @async Run it asynchronously or not, defaults to false
*/
- ContentService function clearPageWrapper( required any slug, boolean async = false ){
- variables.cacheBox
+ ContentService function clearPageWrapper( required any slug, boolean async = false ) {
+ variables
+ .cacheBox
.getCache( variables.settingService.getSetting( "cb_content_cacheName" ) )
.clear( "cb-content-wrapper-#cgi.HTTP_HOST#-#arguments.slug#/" );
return this;
@@ -163,20 +191,24 @@ component extends="cborm.models.VirtualEntityService" singleton {
string contentTypes = "",
any excludeIDs = "",
boolean showInSearch,
- string siteID = "",
+ string siteID = "",
string propertyList
- ){
- var results = { "count" : 0, "content" : [] };
- var c = newCriteria();
+ ) {
+ var results = { "count": 0, "content": [] };
+ var c = newCriteria();
// only published contentwithClause
if ( isBoolean( arguments.isPublished ) ) {
// Published bit
- c.isEq( "isPublished", javacast( "Boolean", arguments.isPublished ) );
+ c.isEq(
+ "isPublished",
+ javacast( "Boolean", arguments.isPublished )
+ );
// Published eq true evaluate other params
if ( arguments.isPublished ) {
- c.isLt( "publishedDate", now() )
+ c
+ .isLt( "publishedDate", now() )
.$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) )
.isEq( "passwordProtection", "" );
}
@@ -184,7 +216,10 @@ component extends="cborm.models.VirtualEntityService" singleton {
// only search shownInSearch bits
if ( structKeyExists( arguments, "showInSearch" ) ) {
- c.isEq( "showInSearch", javacast( "Boolean", arguments.showInSearch ) );
+ c.isEq(
+ "showInSearch",
+ javacast( "Boolean", arguments.showInSearch )
+ );
}
// Search Criteria
@@ -192,11 +227,10 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Do we search title and active content or just title?
if ( arguments.searchActiveContent ) {
c.createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- )
- .$or(
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ ).$or(
c.restrictions.like( "title", "%#arguments.searchTerm#%" ),
c.restrictions.like( "ac.content", "%#arguments.searchTerm#%" )
);
@@ -233,11 +267,11 @@ component extends="cborm.models.VirtualEntityService" singleton {
c.resultTransformer( c.DISTINCT_ROOT_ENTITY );
}
results.content = c.list(
- offset = arguments.offset,
- max = arguments.max,
- sortOrder = arguments.sortOrder,
- asQuery = arguments.asQuery
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = arguments.asQuery
+ );
return results;
}
@@ -250,13 +284,16 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return The id of the content object or empty string if not found
*/
- function getIdBySlug( required any slug, string siteID = "" ){
+ function getIdBySlug( required any slug, string siteID = "" ) {
var results = newCriteria()
.isEq( "slug", arguments.slug )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .withProjections( property: "contentID" )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .withProjections( property = "contentID" )
.get();
// verify results
@@ -270,18 +307,20 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws EntityNotFound
*/
- function getByIdOrSlugOrFail( required id ){
- var c = newCriteria();
- var oEntity = c
- .$or(
- // note: id is a shortcut in Hibernate for the Primary Key
+ function getByIdOrSlugOrFail( required id ) {
+ var c = newCriteria();
+ var oEntity = c.$or(
c.restrictions.isEq( "id", arguments.id ),
c.restrictions.isEq( "slug", arguments.id )
- )
+ )// note: id is a shortcut in Hibernate for the Primary Key
+
.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;
@@ -301,21 +340,28 @@ component extends="cborm.models.VirtualEntityService" singleton {
required any slug,
required boolean showUnpublished = false,
string siteID = ""
- ){
+ ) {
var oContent = newCriteria()
.isEq( "slug", arguments.slug )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( !showUnpublished, function( c ){
- c.isTrue( "isPublished" )
- .isLT( "publishedDate", now() )
- .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) );
- } )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ !showUnpublished,
+ function( c ) {
+ c
+ .isTrue( "isPublished" )
+ .isLT( "publishedDate", now() )
+ .$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) );
+ }
+ )
.get();
// return accordingly
- return isNull( oContent ) ? new () : oContent;
+ return isNull( oContent ) ? new() : oContent;
}
/**
@@ -333,19 +379,31 @@ component extends="cborm.models.VirtualEntityService" singleton {
any contentID = "",
string siteID = "",
string contentType = ""
- ){
+ ) {
return newCriteria()
- .isEq( "slug", arguments.slug )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( len( arguments.contentId ), function( c ){
- c.ne( "contentID", contentId );
- } )
- .when( len( arguments.contentType ), function( c ){
- c.isEq( "contentType", contentType );
- } )
- .count() > 0 ? false : true;
+ .isEq( "slug", arguments.slug )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ len( arguments.contentId ),
+ function( c ) {
+ c.ne( "contentID", contentId );
+ }
+ )
+ .when(
+ len( arguments.contentType ),
+ function( c ) {
+ c.isEq( "contentType", contentType );
+ }
+ )
+ .count() >
+ 0
+ ? false
+ : true;
}
/**
@@ -353,17 +411,23 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @content the Content object to delete
*/
- ContentService function delete( required any content ){
+ ContentService function delete( required any content ) {
transaction {
// Check for dis-associations
if ( arguments.content.hasParent() ) {
- arguments.content.getParent().removeChild( arguments.content );
+ arguments
+ .content
+ .getParent()
+ .removeChild( arguments.content );
}
if ( arguments.content.hasCategories() ) {
arguments.content.removeAllCategories();
}
if ( arguments.content.hasRelatedContent() ) {
- arguments.content.getRelatedContent().clear();
+ arguments
+ .content
+ .getRelatedContent()
+ .clear();
}
if ( arguments.content.hasLinkedContent() ) {
arguments.content.removeAllLinkedContent();
@@ -407,22 +471,22 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @return struct as { count, content }
*/
function findPublishedContent(
- numeric max = 0,
- numeric offset = 0,
- any searchTerm = "",
- any category = "",
- boolean asQuery = false,
- string sortOrder = "publishedDate DESC",
+ numeric max = 0,
+ numeric offset = 0,
+ any searchTerm = "",
+ any category = "",
+ boolean asQuery = false,
+ string sortOrder = "publishedDate DESC",
any parent,
string slugPrefix = "",
string siteID = "",
string properties,
- string authorID = "",
+ string authorID = "",
any criteria,
string slugSearch = ""
- ){
- var results = { "count" : 0, "content" : [] };
- var c = ( isNull( arguments.criteria ) ? newCriteria() : arguments.criteria );
+ ) {
+ var results = { "count": 0, "content": [] };
+ var c = ( isNull( arguments.criteria ) ? newCriteria() : arguments.criteria );
// Do we evaluate parent roots or not?
var nullParentFields = [
@@ -432,79 +496,112 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.slugPrefix,
arguments.slugSearch
];
- var hasSearchContext = nullParentFields.reduce( function( results, thisItem ){
- if ( len( arguments.thisItem ) ) {
- return true;
- }
- return results;
- }, false );
+ var hasSearchContext = nullParentFields.reduce(
+ function( results, thisItem ) {
+ if ( len( arguments.thisItem ) ) {
+ return true;
+ }
+ return results;
+ },
+ false
+ );
// only published pages
- c.isTrue( "isPublished" )
+ c
+ .isTrue( "isPublished" )
.isLT( "publishedDate", 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 ) );
- } )
- // Search Criteria
- .when( len( arguments.searchTerm ), function( c ){
- // like disjunctions
- arguments.c
- .joinTo(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- )
- .$or(
- arguments.c.restrictions.like( "title", "%#searchTerm#%" ),
- arguments.c.restrictions.like( "slug", "%#searchTerm#%" ),
- arguments.c.restrictions.like( "ac.content", "%#searchTerm#%" )
- );
- } )
- // Slug Search Criteria
- .when( len( arguments.slugSearch ), function( c ){
- arguments.c.ilike( "slug", "%#slugSearch#%" );
- } )
- // Site Filter
- .when( len( arguments.siteID ), function( c ){
- arguments.c.isEq( "site.siteID", siteID );
- } )
- // Creator Filter
- .when( len( arguments.authorID ), function( c ){
- arguments.c.isEq( "creator.authorID", authorID );
- } )
- // Slug Prefix hierarchy search
- .when( len( arguments.slugPrefix ), function( c ){
- arguments.c.ilike( "slug", "#slugPrefix#/%" );
- } )
- // Parent Included Filter
- .when( !isNull( arguments.parent ) && len( arguments.parent ), function( c ){
- arguments.c.isEq( "parent.contentID", parent );
- } )
- // Parent Root when parent = ''
- .when( !isNull( arguments.parent ) && !len( arguments.parent ) && !hasSearchContext, function( c ){
- // change sort by parent
- arguments.c.isNull( "parent" );
- sortOrder = "order asc";
- } )
- ;
+ .when(
+ len( arguments.category ),
+ function( c ) {
+ arguments
+ .c
+ .joinTo( "categories", "cats" )
+ .isIn( "cats.slug", listToArray( category ) );
+ }
+ )
+ .when(
+ len( arguments.searchTerm ),
+ function( c ) {
+ arguments
+ .c
+ .joinTo(
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ )
+ .$or(
+ arguments
+ .c
+ .restrictions
+ .like( "title", "%#searchTerm#%" ),
+ arguments
+ .c
+ .restrictions
+ .like( "slug", "%#searchTerm#%" ),
+ arguments
+ .c
+ .restrictions
+ .like( "ac.content", "%#searchTerm#%" )
+ );
+ }
+ )
+ .when(
+ len( arguments.slugSearch ),
+ function( c ) {
+ arguments.c.ilike( "slug", "%#slugSearch#%" );
+ }
+ )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ arguments.c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ len( arguments.authorID ),
+ function( c ) {
+ arguments.c.isEq( "creator.authorID", authorID );
+ }
+ )
+ .when(
+ len( arguments.slugPrefix ),
+ function( c ) {
+ arguments.c.ilike( "slug", "#slugPrefix#/%" );
+ }
+ )
+ .when(
+ !isNull( arguments.parent ) && len( arguments.parent ),
+ function( c ) {
+ arguments.c.isEq( "parent.contentID", parent );
+ }
+ )
+ .when(
+ !isNull( arguments.parent ) && !len( arguments.parent ) && !hasSearchContext,
+ function( c ) {
+ arguments.c.isNull( "parent" );
+ sortOrder = "order asc";
+ }
+ );
// run criteria query and projections count
- results.count = c.count( "contentID" );
- results.content = c
- // Do we want array of simple projections?
- .when( !isNull( arguments.properties ), function( c ){
- arguments.c.withProjections( property: properties ).asStruct();
- } )
+ results.count = c.count( "contentID" );
+ results.content = c.when(
+ !isNull( arguments.properties ),
+ function( c ) {
+ arguments
+ .c
+ .withProjections( property = properties )
+ .asStruct();
+ }
+ )// Do we want array of simple projections?
+
.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: arguments.sortOrder,
- asQuery : arguments.asQuery
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = arguments.asQuery
);
return results;
@@ -516,17 +613,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @contentID The list or array of ID's to bulk update
* @status The status either 'publish' or 'draft'
*/
- any function bulkPublishStatus( required any contentID, required any status ){
+ any function bulkPublishStatus( required any contentID, required any status ) {
var publish = false;
// publish flag
- if ( arguments.status eq "publish" ) {
+ if ( arguments.status EQ "publish" ) {
publish = true;
}
// Get all by id
var contentObjects = getAll( id = arguments.contentID );
- for ( var x = 1; x lte arrayLen( contentObjects ); x++ ) {
+ for ( var x = 1; x LTE arrayLen( contentObjects ); x++ ) {
contentObjects[ x ].setpublishedDate( now() );
contentObjects[ x ].setisPublished( publish );
}
@@ -550,15 +647,16 @@ component extends="cborm.models.VirtualEntityService" singleton {
numeric max = 0,
numeric offset = 0,
string siteID = ""
- ){
+ ) {
var c = newCriteria().createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- );
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ );
// only future published pages
- c.isTrue( "isPublished" )
+ c
+ .isTrue( "isPublished" )
.isLT( "publishedDate", now() )
.isLT( "expireDate", now() );
@@ -573,11 +671,11 @@ component extends="cborm.models.VirtualEntityService" singleton {
}
return c.list(
- max = arguments.max,
- offset = arguments.offset,
- sortOrder = "expireDate desc",
- asQuery = false
- );
+ max = arguments.max,
+ offset = arguments.offset,
+ sortOrder = "expireDate desc",
+ asQuery = false
+ );
}
/**
@@ -593,12 +691,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
numeric max = 0,
numeric offset = 0,
string siteID = ""
- ){
+ ) {
var c = newCriteria().createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- );
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ );
// Only non-expired future publishing pages
c.isTrue( "isPublished" ).isGT( "publishedDate", now() );
@@ -614,11 +712,11 @@ component extends="cborm.models.VirtualEntityService" singleton {
}
return c.list(
- max = arguments.max,
- offset = arguments.offset,
- sortOrder = "publishedDate desc",
- asQuery = false
- );
+ max = arguments.max,
+ offset = arguments.offset,
+ sortOrder = "publishedDate desc",
+ asQuery = false
+ );
}
/**
@@ -634,27 +732,39 @@ component extends="cborm.models.VirtualEntityService" singleton {
boolean isPublished,
numeric max = 25,
string siteID = ""
- ){
+ ) {
// Get only active content joins
return newCriteria()
.createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ )
+ .when(
+ !isNull( arguments.isPublished ),
+ function( c ) {
+ c.isEq( "isPublished", javacast( "boolean", isPublished ) );
+ }
+ )
+ .when(
+ !isNull( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ !isNull( arguments.author ),
+ function( c ) {
+ c.isEq( "ac.author", author );
+ }
)
// isPublished filter
- .when( !isNull( arguments.isPublished ), function( c ){
- c.isEq( "isPublished", javacast( "boolean", isPublished ) );
- } )
+
// Site Filter
- .when( !isNull( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
+
// author filter
- .when( !isNull( arguments.author ), function( c ){
- c.isEq( "ac.author", author );
- } )
- .list( max: arguments.max, sortOrder: "ac.createdDate desc" );
+
+ .list( max = arguments.max, sortOrder = "ac.createdDate desc" );
}
/**
@@ -662,14 +772,27 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @max The maximum to retrieve, defaults to 5 entries
* @siteID The site to filter on
+ *
+ * @return An array of structures with contentId, label and hits keys
*/
- array function getTopVisitedContent( numeric max = 5, string siteID = "" ){
- return newCriteria()
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .joinTo( "stats", "stats" )
- .list( max = arguments.max, sortOrder = "stats.hits desc" );
+ array function getTopVisitedContent( numeric max = 5, string siteID = "" ) {
+ return variables.statsService
+ .newCriteria()
+ .when(
+ len( arguments.siteID ),
+ ( c ) => {
+ c
+ .joinTo( "relatedContent", "relatedContent" )
+ .isEq( "relatedContent.site.siteID", siteID );
+ }
+ )
+ .list( max = arguments.max, sortOrder = "hits desc" )
+ .map( ( stat ) => { return {
+ "contentId" : stat.getRelatedContent().getContentID(),
+ "label" : stat.getRelatedContent().getTitle(),
+ "hits" : stat.getHits(),
+ "content" : stat.getRelatedContent()
+ } } )
}
/**
@@ -678,23 +801,22 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @max The maximum to retrieve, defaults to 5 entries
* @siteID The site to filter on
*/
- array function getTopCommentedContent( numeric max = 5, string siteID = "" ){
+ array function getTopCommentedContent( numeric max = 5, string siteID = "" ) {
return executeQuery(
- query: "
+ query = "
SELECT new map( content as content, count( comments.commentID ) AS commentCount )
FROM cbContent content JOIN content.comments comments
WHERE content.site.siteID = :siteID
GROUP BY content
ORDER BY count( comments.commentID ) DESC
",
- params : { siteID : arguments.siteID },
- max : arguments.max,
- ignoreCase: true
- )
- // We just need the content objects, not the comments count
- .map( function( item ){
- return item[ "content" ];
- } );
+ params = { siteID: arguments.siteID },
+ max = arguments.max,
+ ignoreCase = true
+ )// We just need the content objects, not the comments count
+ .map( function( item ) {
+ return item[ "content" ];
+ } );
}
/**
@@ -702,13 +824,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @inData The data to use for exporting, usually concrete implementtions can override this.
*/
- array function getAllForExport( any inData ){
+ array function getAllForExport( any inData ) {
if ( isNull( arguments.inData ) ) {
arguments.inData = newCriteria().isNull( "parent" ).list();
}
- return arguments.inData.map( function( thisItem ){
- return arguments.thisItem.getMemento( profile: "export" );
- } );
+ return arguments.inData.map(
+ function( thisItem ) {
+ return arguments.thisItem.getMemento( profile = "export" );
+ }
+ );
}
/**
@@ -721,14 +845,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -754,9 +881,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
boolean override = false,
required importLog,
site
- ){
+ ) {
// Setup logging function
- var logThis = function( message ){
+ var logThis = function( message ) {
variables.logger.info( arguments.message );
importLog.append( arguments.message & " " );
};
@@ -765,7 +892,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -773,7 +900,9 @@ 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 );
}
@@ -783,17 +912,19 @@ component extends="cborm.models.VirtualEntityService" singleton {
// Import it
importFromStruct(
- contentData: thisContent,
- importLog : arguments.importLog,
- site : arguments.site,
- override : arguments.override
+ contentData = thisContent,
+ importLog = arguments.importLog,
+ site = arguments.site,
+ override = arguments.override
);
}
// end import loop
// 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
@@ -819,10 +950,10 @@ component extends="cborm.models.VirtualEntityService" singleton {
any parent,
struct newContent = {},
required site,
- boolean override = false
- ){
+ boolean override = false
+ ) {
// Setup logging function
- var logThis = function( message ){
+ var logThis = function( message ) {
variables.logger.info( arguments.message );
importLog.append( arguments.message & " " );
};
@@ -830,7 +961,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
var thisContent = arguments.contentData;
// Get content by slug, if not found then it returns a new entity so we can persist it.
- var oContent = findWhere( { "slug" : thisContent.slug, "site" : arguments.site } );
+ var oContent = findWhere( { "slug": thisContent.slug, "site": arguments.site } );
if ( isNull( oContent ) ) {
logThis(
"! Content (#thisContent.contentType#:#thisContent.slug#) not found in site, proceeding to import as new content."
@@ -875,12 +1006,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
"stats"
];
getBeanPopulator().populateFromStruct(
- target = oContent,
- memento = thisContent,
- exclude = arrayToList( excludedFields ),
- composeRelationships = false,
- nullEmptyInclude = "publishedDate,expireDate"
- );
+ target = oContent,
+ memento = thisContent,
+ exclude = arrayToList( excludedFields ),
+ composeRelationships = false,
+ nullEmptyInclude = "publishedDate,expireDate"
+ );
// determine author else ignore import
var oAuthor = variables.authorService.findByEmail( thisContent.creator.email );
@@ -893,20 +1024,24 @@ component extends="cborm.models.VirtualEntityService" singleton {
// AUTHOR CREATOR
oContent.setCreator( oAuthor );
- logThis( "+ Content author linked for: (#thisContent.contentType#:#thisContent.slug#)" );
+ logThis(
+ "+ Content author linked for: (#thisContent.contentType#:#thisContent.slug#)"
+ );
// PARENT
- if ( !isNull( arguments.parent ) and isObject( arguments.parent ) ) {
+ if ( !isNull( arguments.parent ) && isObject( arguments.parent ) ) {
oContent.setParent( arguments.parent );
arguments.parent.addChild( oContent );
logThis(
"+ Content parent (#arguments.parent.getSlug()#) passed and linked for: (#thisContent.contentType#:#thisContent.slug#)"
);
} else if ( structCount( thisContent.parent ) ) {
- var oParent = findWhere( {
- "slug" : thisContent.parent.slug,
- "site" : arguments.site
- } );
+ var oParent = findWhere(
+ {
+ "slug": thisContent.parent.slug,
+ "site": arguments.site
+ }
+ );
// assign if persisted
if ( !isNull( oParent ) ) {
oContent.setParent( oParent );
@@ -923,16 +1058,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
// CATEGORIES
if ( arrayLen( thisContent.categories ) ) {
oContent.setCategories(
- thisContent.categories.map( function( thisCategory ){
- var oSiteCategory = site.getCategory( arguments.thisCategory );
- return (
- !isNull( oSiteCategory ) ? oSiteCategory : variables.categoryService.getOrCreateBySlug(
- arguments.thisCategory,
- site
+ thisContent.categories.map(
+ function( thisCategory ) {
+ var oSiteCategory = site.getCategory( arguments.thisCategory );
+ return (
+ !isNull( oSiteCategory )
+ ? oSiteCategory
+ : variables.categoryService.getOrCreateBySlug( arguments.thisCategory, site )
+ );
+ }
)
- );
- } )
- );
+ );
logThis(
"+ Categories (#thisContent.categories.toString()#) imported for : (#thisContent.contentType#:#thisContent.slug#)"
);
@@ -953,26 +1089,42 @@ component extends="cborm.models.VirtualEntityService" singleton {
// explicitly convert value to string...
// ACF doesn't handle string values well when they look like numbers :)
oContent.addCustomField(
- customFieldService.new( {
- key : thisCF.key,
- value : toString( thisCF.value ),
- relatedContent : oContent
- } )
+ customFieldService.new(
+ {
+ key : thisCF.key,
+ value : toString( thisCF.value ),
+ relatedContent: oContent
+ }
+ )
+ );
+ logThis(
+ "+ Custom field (#thisCF.key#) imported for : (#thisContent.contentType#:#thisContent.slug#)"
);
- logThis( "+ Custom field (#thisCF.key#) imported for : (#thisContent.contentType#:#thisContent.slug#)" );
}
}
// STATS
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#)" );
+ var oStat = variables
+ .statsService
+ .newCriteria()
+ .isEq( "relatedContent.contentID", oContent.getContentID() )
+ .get();
+ if ( !isNull( oStat ) ) {
+ oStat.setHits( thisContent.stats.hits );
+ variables.statsService.save( oStat );
+ logThis(
+ "+ Content stats found and updated for : (#thisContent.contentType#:#thisContent.slug#)"
+ );
} else {
- logThis( "+ Content stats imported for : (#thisContent.contentType#:#thisContent.slug#)" );
- variables.statsService.save(
- variables.statsService.new( { hits : thisContent.stats.hits, relatedContent : oContent } )
+ logThis(
+ "+ Content stats imported for : (#thisContent.contentType#:#thisContent.slug#)"
);
+ variables.statsService.save(
+ variables.statsService.new(
+ { hits: thisContent.stats.hits, relatedContent: oContent }
+ )
+ );
}
}
@@ -1018,13 +1170,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
logThis(
"+ Related content (#thisRelatedContent.slug#) already imported, linking to : (#thisContent.contentType#:#thisContent.slug#)"
);
- }
- // otherwise, we need to get it
- else {
- var oRelatedContent = getServiceByType( thisRelatedContent.contentType ).findWhere( {
- "slug" : thisRelatedContent.slug,
- "site" : arguments.site
- } );
+ } else {
+ // otherwise, we need to get it
+ var oRelatedContent = getServiceByType( thisRelatedContent.contentType ).findWhere(
+ {
+ "slug": thisRelatedContent.slug,
+ "site": arguments.site
+ }
+ );
if ( !isNull( oRelatedContent ) ) {
arrayAppend( allRelatedContent, oRelatedContent );
logThis(
@@ -1046,18 +1199,20 @@ component extends="cborm.models.VirtualEntityService" singleton {
"+ Content comments (#arrayLen( thisContent.comments )#) found, about to start import for : (#thisContent.contentType#:#thisContent.slug#)"
);
oContent.setComments(
- thisContent.comments.map( function( thisComment ){
- return getBeanPopulator()
- .populateFromStruct(
- target = variables.commentService.new(),
- memento = thisComment,
- exclude = "commentID",
- composeRelationships = false
+ thisContent.comments.map(
+ function( thisComment ) {
+ return getBeanPopulator().populateFromStruct(
+ target = variables.commentService.new(),
+ memento = thisComment,
+ exclude = "commentID",
+ composeRelationships = false
+ ).setRelatedContent( oContent );
+ }
)
- .setRelatedContent( oContent );
- } )
+ );
+ logThis(
+ "+ Content comments imported to: (#thisContent.contentType#:#thisContent.slug#)"
);
- logThis( "+ Content comments imported to: (#thisContent.contentType#:#thisContent.slug#)" );
}
// SUBSCRIPTIONS
@@ -1069,20 +1224,22 @@ component extends="cborm.models.VirtualEntityService" singleton {
// recurse on them and inflate hiearchy
for ( var thisSubscription in thisContent.commentSubscriptions ) {
// Subscription
- var oSubscription = variables.commentSubscriptionService.new( {
- relatedContent : oContent,
- subscriptionToken : thisSubscription.subscriptionToken,
- type : thisSubscription.type
- } );
+ var oSubscription = variables.commentSubscriptionService.new(
+ {
+ relatedContent : oContent,
+ subscriptionToken: thisSubscription.subscriptionToken,
+ type : thisSubscription.type
+ }
+ );
// Subscriber
- var oSubscriber = variables.subscriberService.findBySubscriberEmail(
- thisSubscription.subscriber.subscriberEmail
- );
+ var oSubscriber = variables.subscriberService.findBySubscriberEmail( thisSubscription.subscriber.subscriberEmail );
if ( isNull( oSubscriber ) ) {
- oSubscriber = variables.subscriberService.new( {
- subscriberEmail : thisSubscription.subscriber.subscriberEmail,
- subscriberToken : thisSubscription.subscriber.subscriberToken
- } );
+ oSubscriber = variables.subscriberService.new(
+ {
+ subscriberEmail: thisSubscription.subscriber.subscriberEmail,
+ subscriberToken: thisSubscription.subscriber.subscriberToken
+ }
+ );
}
oSubscriber.addSubscription( oSubscription );
oSubscription.setSubscriber( oSubscriber );
@@ -1095,7 +1252,9 @@ 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
@@ -1104,20 +1263,24 @@ component extends="cborm.models.VirtualEntityService" singleton {
"+ Content versions (#arrayLen( thisContent.contentversions )#) found, about to start import for : (#thisContent.contentType#:#thisContent.slug#)"
);
oContent.setContentVersions(
- thisContent.contentVersions.map( function( thisVersion ){
- logThis(
- "+ Importing content version (#thisVersion.version#) to : (#thisContent.contentType#:#thisContent.slug#)"
- );
- var oVersion = getBeanPopulator().populateFromStruct(
- target = variables.contentVersionService.new(),
- memento = thisVersion,
- exclude = "contentVersionID,author",
- composeRelationships = false
- );
- var oEditor = variables.authorService.findByEmail( thisVersion.author.email );
- return oVersion.setAuthor( isNull( oEditor ) ? oAuthor : oEditor ).setRelatedContent( oContent );
- } )
- );
+ thisContent.contentVersions.map(
+ function( thisVersion ) {
+ logThis(
+ "+ Importing content version (#thisVersion.version#) to : (#thisContent.contentType#:#thisContent.slug#)"
+ );
+ var oVersion = getBeanPopulator().populateFromStruct(
+ target = variables.contentVersionService.new(),
+ memento = thisVersion,
+ exclude = "contentVersionID,author",
+ composeRelationships = false
+ );
+ var oEditor = variables.authorService.findByEmail( thisVersion.author.email );
+ return oVersion.setAuthor(
+ isNull( oEditor ) ? oAuthor : oEditor
+ ).setRelatedContent( oContent );
+ }
+ )
+ );
}
return oContent;
@@ -1129,7 +1292,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @content A content object or id to update the hits on
* @async Async or not
*/
- ContentService function updateHits( required content, boolean async = true ){
+ ContentService function updateHits( required content, boolean async = true ) {
// Inflate it if it's just an ID
if ( isSimpleValue( arguments.content ) ) {
arguments.content = get( arguments.content );
@@ -1142,7 +1305,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Returns an array of slugs of all the content objects in the system.
*/
- array function getAllFlatSlugs(){
+ array function getAllFlatSlugs() {
var c = newCriteria();
return c.withProjections( property = "slug" ).list( sortOrder = "slug asc" );
@@ -1159,25 +1322,25 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @return Array of content data {contentID, title, slug, createdDate, modifiedDate}
*/
array function getAllFlatContent(
- sortOrder = "title asc",
+ sortOrder = "title asc",
boolean isPublished,
boolean showInSearch,
string siteID = "",
string contentType = ""
- ){
+ ) {
var c = newCriteria();
// only published content
- if (
- structKeyExists( arguments, "isPublished" )
- &&
- isBoolean( arguments.isPublished )
- ) {
+ if ( structKeyExists( arguments, "isPublished" ) && isBoolean( arguments.isPublished ) ) {
// Published bit
- c.isEq( "isPublished", javacast( "Boolean", arguments.isPublished ) );
+ c.isEq(
+ "isPublished",
+ javacast( "Boolean", arguments.isPublished )
+ );
// Published eq true evaluate other params
if ( arguments.isPublished ) {
- c.isLt( "publishedDate", now() )
+ c
+ .isLt( "publishedDate", now() )
.$or( c.restrictions.isNull( "expireDate" ), c.restrictions.isGT( "expireDate", now() ) )
.isEq( "passwordProtection", "" );
}
@@ -1193,17 +1356,18 @@ component extends="cborm.models.VirtualEntityService" singleton {
}
// Show in Search
- if (
- structKeyExists( arguments, "showInSearch" )
- &&
- isBoolean( arguments.showInSearch )
- ) {
+ if ( structKeyExists( arguments, "showInSearch" ) && isBoolean( arguments.showInSearch ) ) {
// showInSearch bit
- c.isEq( "showInSearch", javacast( "Boolean", arguments.showInSearch ) );
+ c.isEq(
+ "showInSearch",
+ javacast( "Boolean", arguments.showInSearch )
+ );
}
return c
- .withProjections( property = "contentID,title,slug,createdDate,modifiedDate" )
+ .withProjections(
+ property = "contentID,title,slug,createdDate,modifiedDate"
+ )
.asStruct()
.list( sortOrder = arguments.sortOrder );
}
@@ -1214,7 +1378,10 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @contentItem the target to relocate to
* @originalSlug the URI from which to redirect
*/
- function addRelocation( required BaseContent contentItem, required string originalSlug ){
+ function addRelocation(
+ required BaseContent contentItem,
+ required string originalSlug
+ ) {
variables.relocationService.createContentRelocation( argumentCollection = arguments );
return this;
}
@@ -1227,7 +1394,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @type The content type to detect
*/
- private function getServiceByType( required type ){
+ private function getServiceByType( required type ) {
switch ( arguments.type ) {
case "Page":
return variables.pageService;
@@ -1241,13 +1408,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
}
return this;
}
+
/**
* Get a unique slug hash
*
* @slug The slug to unique it
*/
- private function getUniqueSlugHash( required string slug ){
+ private function getUniqueSlugHash( required string slug ) {
return "#arguments.slug#-#lCase( left( hash( now() ), 5 ) )#";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentStore.cfc b/modules/contentbox/models/content/ContentStore.cfc
index ab41c611e8..2b98f6244f 100755
--- a/modules/contentbox/models/content/ContentStore.cfc
+++ b/modules/contentbox/models/content/ContentStore.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -16,45 +16,43 @@ component
joinColumn ="contentID"
discriminatorValue="ContentStore"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
/**
* The internal description of the contentstore item
*/
property
- name ="description"
- column ="description"
+ name="description"
+ column="description"
notnull="false"
- length ="500"
+ length="500"
default="";
/**
* The ordering numeric sequence
*/
property
- name ="order"
- column ="order"
- notnull ="false"
- ormtype ="integer"
- default ="0"
+ name="order"
+ column="order"
+ notnull="false"
+ ormtype="integer"
+ default="0"
dbdefault="0";
+ /**********************************************************************
+ * ** CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "description" ] = { required : false, size : "1..500" };
- this.constraints[ "order" ] = { required : false, type : "numeric" };
+ this.constraints[ "description" ] = { required: false, size: "1..500" };
+ this.constraints[ "order" ] = { required: false, type: "numeric" };
- /* *********************************************************************
- ** CONSTRUCTOR
- ********************************************************************* */
+ /**********************************************************************
+ * ** CONSTRUCTOR
+ **********************************************************************/
- function init(){
- var props = [ "description", "order" ];
+ function init() {
+ var props = [ "description", "order"];
appendToMemento( props, "defaultIncludes" );
appendToMemento( [], "defaultExcludes" );
appendToMementoProfile( props, "export" );
@@ -62,21 +60,21 @@ component
super.init();
- variables.categories = [];
- variables.customFields = [];
+ variables.categories = [];
+ variables.customFields = [];
variables.renderedContent = "";
- variables.allowComments = false;
- variables.description = "";
- variables.createdDate = now();
- variables.contentType = "ContentStore";
- variables.order = 0;
+ variables.allowComments = false;
+ variables.description = "";
+ variables.createdDate = now();
+ variables.contentType = "ContentStore";
+ variables.order = 0;
return this;
}
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Wipe primary key, and descendant keys, and prepare for cloning of entire hierarchies
@@ -95,7 +93,7 @@ component
required boolean publish,
required any originalSlugRoot,
required any newSlugRoot
- ){
+ ) {
// original cloning!
setDescription( arguments.original.getDescription() );
setOrder( arguments.original.getOrder() + 1 );
@@ -103,4 +101,4 @@ component
return super.clone( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentStoreService.cfc b/modules/contentbox/models/content/ContentStoreService.cfc
index e68ea18a7c..660fb22ca7 100755
--- a/modules/contentbox/models/content/ContentStoreService.cfc
+++ b/modules/contentbox/models/content/ContentStoreService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,14 +6,13 @@
* Manages content store items
*/
component extends="ContentService" singleton {
-
// DI
property name="contentService" inject="id:ContentService@contentbox";
/**
* Constructor
*/
- ContentStoreService function init(){
+ ContentStoreService function init() {
// init it
super.init( entityName = "cbContentStore", useQueryCaching = true );
@@ -29,22 +28,22 @@ component extends="ContentService" singleton {
*
* @return ContentStoreService
*/
- function save( required any content, string originalSlug = "" ){
+ function save( required any content, string originalSlug = "" ) {
transaction {
// save entry
super.save( arguments.content );
// 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 ( structKeyExists( arguments, "originalSlug" ) && len( arguments.originalSlug ) ) {
var entriesInNeed = newCriteria().like( "slug", "#arguments.originalSlug#/%" ).list();
for ( var thisContent in entriesInNeed ) {
thisContent.setSlug(
- replaceNoCase(
- thisContent.getSlug(),
- arguments.originalSlug,
- arguments.content.getSlug()
- )
- );
+ replaceNoCase(
+ thisContent.getSlug(),
+ arguments.originalSlug,
+ arguments.content.getSlug()
+ )
+ );
super.save( thisContent );
}
}
@@ -74,10 +73,10 @@ component extends="ContentService" singleton {
* @return struct = { content, count }
*/
struct function search(
- string search = "",
- string isPublished = "any",
- string author = "all",
- string creator = "all",
+ string search = "",
+ string isPublished = "any",
+ string author = "all",
+ string creator = "all",
string parent,
string category = "all",
numeric max = 0,
@@ -88,22 +87,21 @@ component extends="ContentService" singleton {
string slugPrefix = "",
string siteID = "",
string propertyList
- ){
- var results = { "count" : 0, "content" : [] };
+ ) {
+ var results = { "count": 0, "content": [] };
// criteria queries
- var c = newCriteria();
+ var c = newCriteria();
// stub out activeContent alias based on potential conditions...
// this way, we don't have to worry about accidentally creating it twice, or not creating it at all
if (
- ( arguments.author NEQ "all" ) ||
- ( len( arguments.search ) ) ||
- ( findNoCase( "modifiedDate", arguments.sortOrder ) )
+ ( arguments.author NEQ "all" ) || ( len( arguments.search ) ) ||
+ ( findNoCase( "modifiedDate", arguments.sortOrder ) )
) {
c.createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- );
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ );
}
// only search shownInSearch bits
@@ -113,7 +111,10 @@ component extends="ContentService" singleton {
// isPublished filter
if ( arguments.isPublished NEQ "any" ) {
- c.isEq( "isPublished", javacast( "boolean", arguments.isPublished ) );
+ c.isEq(
+ "isPublished",
+ javacast( "boolean", arguments.isPublished )
+ );
}
// Author Filter
@@ -137,23 +138,23 @@ component extends="ContentService" singleton {
if ( arguments.searchActiveContent ) {
// like disjunctions
c.$or(
- c.restrictions.like( "title", "%#arguments.search#%" ),
- c.restrictions.like( "slug", "%#arguments.search#%" ),
- c.restrictions.like( "description", "%#arguments.search#%" ),
- c.restrictions.like( "ac.content", "%#arguments.search#%" )
- );
+ c.restrictions.like( "title", "%#arguments.search#%" ),
+ c.restrictions.like( "slug", "%#arguments.search#%" ),
+ c.restrictions.like( "description", "%#arguments.search#%" ),
+ c.restrictions.like( "ac.content", "%#arguments.search#%" )
+ );
} else {
c.$or(
- c.restrictions.like( "title", "%#arguments.search#%" ),
- c.restrictions.like( "slug", "%#arguments.search#%" ),
- c.restrictions.like( "description", "%#arguments.search#%" )
- );
+ c.restrictions.like( "title", "%#arguments.search#%" ),
+ c.restrictions.like( "slug", "%#arguments.search#%" ),
+ c.restrictions.like( "description", "%#arguments.search#%" )
+ );
}
}
// parent filter
if ( !isNull( arguments.parent ) ) {
- if ( isSimpleValue( arguments.parent ) and len( arguments.parent ) ) {
+ if ( isSimpleValue( arguments.parent ) && len( arguments.parent ) ) {
c.isEq( "parent.contentID", arguments.parent );
} else if ( isObject( arguments.parent ) ) {
c.isEq( "parent", arguments.parent );
@@ -170,13 +171,12 @@ component extends="ContentService" singleton {
// Category Filter
if ( arguments.category NEQ "all" ) {
// Uncategorized?
- if ( arguments.category eq "none" ) {
+ if ( arguments.category EQ "none" ) {
c.isEmpty( "categories" );
- }
- // With categories
- else {
+ } else {
+ // With categories
// search the association
- c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category ] );
+ c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category] );
}
}
@@ -188,9 +188,8 @@ component extends="ContentService" singleton {
"modifiedDate",
"ac.createdDate"
);
- }
- // default to title sorting
- else if ( !len( arguments.sortOrder ) ) {
+ } else if ( !len( arguments.sortOrder ) ) {
+ // default to title sorting
sortOrder = "title asc";
}
@@ -203,11 +202,11 @@ component extends="ContentService" singleton {
c.resultTransformer( c.DISTINCT_ROOT_ENTITY );
}
results.content = c.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: arguments.sortOrder,
- asQuery : false
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = false
+ );
return results;
}
@@ -216,13 +215,11 @@ component extends="ContentService" singleton {
*
* @site The site to get the export from
*/
- array function getAllForExport( required site ){
- return super.getAllForExport(
- newCriteria()
- .isNull( "parent" )
- .isEq( "site", arguments.site )
- .list()
- );
+ array function getAllForExport( required site ) {
+ return super.getAllForExport( newCriteria()
+ .isNull( "parent" )
+ .isEq( "site", arguments.site )
+ .list() );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentTemplate.cfc b/modules/contentbox/models/content/ContentTemplate.cfc
index af8ff886e7..2500d8852c 100644
--- a/modules/contentbox/models/content/ContentTemplate.cfc
+++ b/modules/contentbox/models/content/ContentTemplate.cfc
@@ -13,11 +13,11 @@ component
cachename ="cbContentTemplate"
cacheuse ="read-write"
{
-
property
- name ="contentTemplateService"
- inject ="provider:ContentTemplateService@contentbox"
+ name="contentTemplateService"
+ inject="provider:ContentTemplateService@contentbox"
persistent="false";
+
/**
* --------------------------------------------------------------------------
* STUPID PROPERTIES DUE TO ACF BUG
@@ -26,30 +26,30 @@ component
* has never been fixed. Until it does, keep these.
*/
property
- name ="createdDate"
- column ="createdDate"
- type ="date"
+ name="createdDate"
+ column="createdDate"
+ type="date"
ormtype="timestamp"
notnull="true"
- update ="false";
+ update="false";
property
- name ="modifiedDate"
- column ="modifiedDate"
- type ="date"
+ name="modifiedDate"
+ column="modifiedDate"
+ type="date"
ormtype="timestamp"
notnull="true";
property
- name ="isDeleted"
- column ="isDeleted"
+ name="isDeleted"
+ column="isDeleted"
ormtype="boolean"
notnull="true"
default="false";
property
- name ="isGlobal"
- column ="isGlobal"
+ name="isGlobal"
+ column="isGlobal"
ormtype="boolean"
notnull="true"
default="false";
@@ -61,66 +61,65 @@ component
*/
property
- name ="templateID"
- column ="templateID"
+ name="templateID"
+ column="templateID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
// The content type to restrict this template to. If left blank, all content types are eligible
property
- name ="contentType"
- column ="contentType"
- length ="50"
+ name="contentType"
+ column="contentType"
+ length="50"
default=""
- index ="idx_templateContentType";
+ index="idx_templateContentType";
property
- name ="name"
- column ="name"
+ name="name"
+ column="name"
notnull="true"
- length ="225"
+ length="225"
default="";
property
- name ="description"
- column ="description"
+ name="description"
+ column="description"
notnull="false"
- length ="1000";
+ length="1000";
property
- name ="definition"
- column ="definition"
+ name="definition"
+ column="definition"
notnull="true"
ormtype="text"
default="{}";
// M20 -> creator loaded as a proxy and fetched immediately
property
- name ="creator"
- notnull ="true"
- cfc ="contentbox.models.security.Author"
+ name="creator"
+ notnull="true"
+ cfc="contentbox.models.security.Author"
fieldtype="many-to-one"
- fkcolumn ="FK_authorID"
- insert =true
- update =false;
+ fkcolumn="FK_authorID"
+ insert=true
+ update=false;
// M20 -> site loaded as a proxy and fetched immediately
property
- name ="site"
- notnull ="true"
- cfc ="contentbox.models.system.Site"
+ name="site"
+ notnull="true"
+ cfc="contentbox.models.system.Site"
fieldtype="many-to-one"
- fkcolumn ="FK_siteID"
- lazy ="true"
- insert =true
- update =false;
-
+ fkcolumn="FK_siteID"
+ lazy="true"
+ insert=true
+ update=false;
property
- name ="assignedContentItems"
+ name="assignedContentItems"
ormtype="integer"
default=0
formula="select count(*) from cb_content cbc2 WHERE cbc2.FK_contentTemplateID=templateID or cbc2.FK_childContentTemplateID=templateID";
@@ -128,144 +127,143 @@ component
// The non-persistent schema of the JSON definition
property name="schema" persistent="false";
-
- function init(){
- variables.createdDate = now();
+ function init() {
+ variables.createdDate = now();
variables.modifiedDate = now();
- variables.schema = {
- "title" : { "label" : "Title", "type" : "string", "sortOrder" : 1 },
- "content" : { "label" : "Content", "type" : "text", "sortOrder" : 2 },
- "markup" : { "label" : "Markup", "type" : "markdown", "sortOrder" : 3 },
- "description" : {
- "label" : "Description",
- "type" : "text",
- "excludeTypes" : [ "Page", "Entry" ],
- "sortOrder" : 4
+ variables.schema = {
+ "title" : { "label": "Title", "type": "string", "sortOrder": 1 },
+ "content" : { "label": "Content", "type": "text", "sortOrder": 2 },
+ "markup" : { "label": "Markup", "type": "markdown", "sortOrder": 3 },
+ "description": {
+ "label" : "Description",
+ "type" : "text",
+ "excludeTypes": [ "Page", "Entry"],
+ "sortOrder" : 4
},
- "excerpt" : {
- "label" : "Excerpt",
- "type" : "text",
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 5
+ "excerpt": {
+ "label" : "Excerpt",
+ "type" : "text",
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 5
},
- "featuredImage" : {
- "label" : "Featured Image",
- "type" : "file",
- "sortOrder" : 6
+ "featuredImage": {
+ "label" : "Featured Image",
+ "type" : "file",
+ "sortOrder": 6
},
// SEO
- "HTMLTitle" : {
- "label" : "HTML Title",
- "type" : "string",
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 7
+ "HTMLTitle": {
+ "label" : "HTML Title",
+ "type" : "string",
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 7
},
- "HTMLKeywords" : {
- "label" : "HTML Keywords",
- "type" : "string",
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 8
+ "HTMLKeywords": {
+ "label" : "HTML Keywords",
+ "type" : "string",
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 8
},
- "HTMLDescription" : {
- "label" : "HTML Description",
- "type" : "text",
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 9
+ "HTMLDescription": {
+ "label" : "HTML Description",
+ "type" : "text",
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 9
},
// Modifiers
- "parent" : {
- "label" : "Content Parent",
- "type" : "typeahead",
- "search" : "/cbapi/v1/sites/:siteId/pages",
- "options" : "filteredParents",
- "optionId" : "contentID",
- "optionLabel" : "title",
- "excludeTypes" : [ "Entry" ],
- "sortOrder" : 10
+ "parent": {
+ "label" : "Content Parent",
+ "type" : "typeahead",
+ "search" : "/cbapi/v1/sites/:siteId/pages",
+ "options" : "filteredParents",
+ "optionId" : "contentID",
+ "optionLabel" : "title",
+ "excludeTypes": [ "Entry"],
+ "sortOrder" : 10
},
// Collections
- "customFields" : {
- "label" : "Custom Fields",
- "type" : "array",
- "schema" : {
- "name" : {
- "label" : "Field Name",
- "required" : true,
- "type" : "string"
+ "customFields": {
+ "label" : "Custom Fields",
+ "type" : "array",
+ "schema": {
+ "name": {
+ "label" : "Field Name",
+ "required": true,
+ "type" : "string"
},
- "defaultValue" : { "label" : "Default Value", "type" : "string" }
+ "defaultValue": { "label": "Default Value", "type": "string" }
},
- "presentation" : "input",
- "sortOrder" : 11
+ "presentation": "input",
+ "sortOrder" : 11
},
- "categories" : {
- "label" : "Assigned Categories",
- "type" : "select",
- "options" : "availableCategories",
- "multiple" : true,
- "sortOrder" : 12
+ "categories": {
+ "label" : "Assigned Categories",
+ "type" : "select",
+ "options" : "availableCategories",
+ "multiple" : true,
+ "sortOrder": 12
},
- "childContentTemplate" : {
- "label" : "Child Template",
- "type" : "select",
- "options" : "availableTemplates",
- "excludeTypes" : [ "Entry" ],
- "sortOrder" : 13
+ "childContentTemplate": {
+ "label" : "Child Template",
+ "type" : "select",
+ "options" : "availableTemplates",
+ "excludeTypes": [ "Entry"],
+ "sortOrder" : 13
},
// Layout options
- "layout" : {
- "label" : "Layout",
- "type" : "select",
- "options" : "availableLayouts",
- "excludeTypes" : [ "ContentStore", "Entry" ],
- "sortOrder" : 14
+ "layout": {
+ "label" : "Layout",
+ "type" : "select",
+ "options" : "availableLayouts",
+ "excludeTypes": [ "ContentStore", "Entry"],
+ "sortOrder" : 14
},
// Caching
- "cache" : {
- "label" : "Cache Enabled",
- "type" : "boolean",
- "default" : true,
- "sortOrder" : 15
+ "cache": {
+ "label" : "Cache Enabled",
+ "type" : "boolean",
+ "default" : true,
+ "sortOrder": 15
},
- "cacheTimeout" : {
- "label" : "Cache Timeout",
- "type" : "integer",
- "default" : 0,
- "sortOrder" : 16
+ "cacheTimeout": {
+ "label" : "Cache Timeout",
+ "type" : "integer",
+ "default" : 0,
+ "sortOrder": 16
},
- "cacheLastAccessTimeout" : {
- "label" : "Cache Last Access Timeout",
- "type" : "integer",
- "default" : 0,
- "sortOrder" : 17
+ "cacheLastAccessTimeout": {
+ "label" : "Cache Last Access Timeout",
+ "type" : "integer",
+ "default" : 0,
+ "sortOrder": 17
},
- "passwordProtection" : {
- "label" : "Access Password",
- "type" : "string",
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 18
+ "passwordProtection": {
+ "label" : "Access Password",
+ "type" : "string",
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 18
},
- "allowComments" : {
- "label" : "Comments Enabled",
- "type" : "boolean",
- "default" : true,
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 19
+ "allowComments": {
+ "label" : "Comments Enabled",
+ "type" : "boolean",
+ "default" : true,
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 19
},
// Display Options
- "showInMenu" : {
- "label" : "Show In Menu",
- "type" : "boolean",
- "default" : true,
- "excludeTypes" : [ "ContentStore", "Entry" ],
- "sortOrder" : 20
+ "showInMenu": {
+ "label" : "Show In Menu",
+ "type" : "boolean",
+ "default" : true,
+ "excludeTypes": [ "ContentStore", "Entry"],
+ "sortOrder" : 20
},
- "showInSearch" : {
- "label" : "Show In Search",
- "type" : "boolean",
- "default" : true,
- "excludeTypes" : [ "ContentStore" ],
- "sortOrder" : 21
+ "showInSearch": {
+ "label" : "Show In Search",
+ "type" : "boolean",
+ "default" : true,
+ "excludeTypes": [ "ContentStore"],
+ "sortOrder" : 21
}
};
@@ -273,7 +271,7 @@ component
}
this.memento = {
- "defaultIncludes" : [
+ "defaultIncludes": [
"templateID",
"contentType",
"name",
@@ -282,9 +280,9 @@ component
"definition",
"assignedContentItems"
],
- profiles : {
- export : {
- defaultIncludes : [
+ profiles: {
+ export: {
+ defaultIncludes: [
"templateID",
"contentType",
"name",
@@ -293,38 +291,37 @@ component
"createdDate",
"modifiedDate"
],
- defaultExcludes : [ "assignedContentItems", "site", "creator" ]
+ defaultExcludes: [ "assignedContentItems", "site", "creator"]
}
},
- mappers : {
- "assignedContentItems" : function( target, value ){
- return javacast( "int", arguments.target )
+ mappers: {
+ "assignedContentItems": function( target, value ) {
+ return javacast( "int", arguments.target );
}
}
};
this.constraints = {
- "name" : {
- required : true,
- size : "1..200",
- "udf" : ( value, target ) => target.isNameUniqueInSite( value )
+ "name": {
+ required: true,
+ size : "1..200",
+ "udf" : ( value, target ) => target.isNameUniqueInSite( value )
},
- "definition" : { required : true },
- "site" : { required : true },
- "isGlobal" : {
- required : true,
- "udf" : ( value, target ) => target.isGlobalUniqueInSite( value ),
- "udfMessage" : "A site may only have one global template per content type. If you wish to make this template global, please deactivate the existing global template."
+ "definition": { required: true },
+ "site" : { required: true },
+ "isGlobal" : {
+ required : true,
+ "udf" : ( value, target ) => target.isGlobalUniqueInSite( value ),
+ "udfMessage": "A site may only have one global template per content type. If you wish to make this template global, please deactivate the existing global template."
}
};
-
/**
* Overload getter for definition to deal with JSON conversion
*
* @overload
*/
- function getDefinition(){
+ function getDefinition() {
return deserializeJSON( variables.definition );
}
@@ -333,14 +330,14 @@ component
*
* @overload
*/
- function setDefinition( definition ){
+ function setDefinition( definition ) {
variables.definition = isSimpleValue( arguments.definition )
- ? arguments.definition
- : serializeJSON(
- arguments.definition,
- false,
- listFindNoCase( "Lucee", server.coldfusion.productname ) ? "utf-8" : false
- );
+ ? arguments.definition
+ : serializeJSON(
+ arguments.definition,
+ false,
+ listFindNoCase( "Lucee", server.coldfusion.productname ) ? "utf-8" : false
+ );
return this;
}
@@ -349,7 +346,7 @@ component
*
* @value The name to test for uniqueness
*/
- boolean function isNameUniqueInSite( value = variables.name ){
+ boolean function isNameUniqueInSite( value = variables.name ) {
var c = getContentTemplateService()
.newCriteria()
.isEq( "site", getSite() )
@@ -365,8 +362,10 @@ component
/**
* UDF validation method to test for global uniqueness of a Content Template
*/
- boolean function isGlobalUniqueInSite(){
- if ( !variables.isGlobal ) return true;
+ boolean function isGlobalUniqueInSite() {
+ if ( !variables.isGlobal ) {
+ return true;
+ }
var c = getContentTemplateService()
.newCriteria()
@@ -381,4 +380,4 @@ component
return !c.count();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentTemplateService.cfc b/modules/contentbox/models/content/ContentTemplateService.cfc
index 41af14e412..cbc2d2a112 100644
--- a/modules/contentbox/models/content/ContentTemplateService.cfc
+++ b/modules/contentbox/models/content/ContentTemplateService.cfc
@@ -6,15 +6,15 @@
* Template service for contentbox
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// Dependencies
property name="dateUtil" inject="DateUtil@contentbox";
+
property name="contentService" inject="ContentService@contentbox";
/**
* Constructor
*/
- ContentTemplateService function init(){
+ ContentTemplateService function init() {
// init it
super.init( entityName = "cbContentTemplate", useQueryCaching = true );
@@ -39,36 +39,43 @@ component extends="cborm.models.VirtualEntityService" singleton {
max = 0,
offset = 0,
sortOrder = "name asc"
- ){
- var results = { "count" : 0, "templates" : [] };
- var c = newCriteria()
- // Site Filter
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
+ ) {
+ var results = { "count": 0, "templates": [] };
+ var c = newCriteria().when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )// Site Filter
+
// Search Criteria
- .when( len( arguments.search ), function( c ){
- c.or( c.restrictions.like( "name", "%#search#%" ), c.restrictions.like( "description", "%#search#%" ) );
- } );
+ .when(
+ len( arguments.search ),
+ function( c ) {
+ c.or(
+ c.restrictions.like( "name", "%#search#%" ),
+ c.restrictions.like( "description", "%#search#%" )
+ );
+ }
+ );
// run criteria query and projections count
- results.count = c.count( "contentTemplateID" );
+ results.count = c.count( "contentTemplateID" );
results.templates = c.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: arguments.sortOrder
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder
+ );
return results;
}
-
/**
* Delete a template which also removes itself from all many-to-many relationships
*
* @template The template object to remove from the system
*/
- boolean function delete( required template ){
+ boolean function delete( required template ) {
transaction {
// Remove content relationships
var assignedContent = removeTemplateAssignments( arguments.template );
@@ -91,24 +98,28 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @template The template object
*/
- array function removeTemplateAssignments( required template ){
+ array function removeTemplateAssignments( required template ) {
var assignedContent = contentService
.newCriteria()
.isEq( "contentTemplate", arguments.template )
.list();
- assignedContent.each( function( contentItem ){
- contentItem.setContentTemplate( javacast( "null", 0 ) );
- } );
+ assignedContent.each(
+ function( contentItem ) {
+ contentItem.setContentTemplate( javacast( "null", 0 ) );
+ }
+ );
var childrenAssignments = contentService
.newCriteria()
.isEq( "childContentTemplate", arguments.template )
.list();
- childrenAssignments.each( function( contentItem ){
- contentItem.setChildContentTemplate( javacast( "null", 0 ) );
- } );
+ childrenAssignments.each(
+ function( contentItem ) {
+ contentItem.setChildContentTemplate( javacast( "null", 0 ) );
+ }
+ );
assignedContent.append( childrenAssignments, true );
@@ -126,7 +137,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
required string contentType,
required Site site,
string fields
- ){
+ ) {
if ( isNull( arguments.site ) ) {
arguments.site = getWirebox().getInstance( "cbHelper@ContentBox" ).site();
}
@@ -144,79 +155,86 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @site The site to export from
*/
- array function getAllForExport( required site ){
- return findAllWhere( { site : arguments.site } ).map( function( thisItem ){
- return thisItem.getMemento( profile: "export" );
- } );
+ array function getAllForExport( required site ) {
+ return findAllWhere( { site: arguments.site } ).map(
+ function( thisItem ) {
+ return thisItem.getMemento( profile = "export" );
+ }
+ );
}
- ContentTemplate function newFromContentItem( required BaseContent contentItem ){
- var newTemplate = new (
+ ContentTemplate function newFromContentItem( required BaseContent contentItem ) {
+ var newTemplate = new(
properties = {
- "site" : arguments.contentItem.getSite(),
- "name" : arguments.contentItem.getTitle(),
- "contentType" : arguments.contentItem.getContentType(),
- "description" : "Template automatically created from " & arguments.contentItem.getContentType() & " " & arguments.contentItem.getTitle(),
- "creator" : arguments.contentItem.getCreator()
+ "site" : arguments.contentItem.getSite(),
+ "name" : arguments.contentItem.getTitle(),
+ "contentType": arguments.contentItem.getContentType(),
+ "description": "Template automatically created from " & arguments.contentItem.getContentType() & " " & arguments.contentItem.getTitle(),
+ "creator" : arguments.contentItem.getCreator()
}
);
- var schema = newTemplate.getSchema();
- var templateProperties = schema
- .keyArray()
- .filter( function( key ){
- return !schema[ key ].keyExists( "excludeTypes" ) || !schema[ key ].excludeTypes.contains(
- contentItem.getContentType()
- )
- } );
-
- var definition = templateProperties.reduce( function( acc, key ){
- switch ( key ) {
- case "customFields": {
- if ( arrayLen( contentItem.getCustomFields() ) ) {
- acc[ key ] = { "value" : [] };
- contentItem
- .getCustomFields()
- .each( function( field ){
- acc[ key ].value.append( {
- "name" : field.getKey(),
- "defaultValue" : field.getValue()
- } );
- } );
- }
- break;
- }
- case "categories": {
- if ( arrayLen( contentItem.getCategories() ) ) {
- acc[ key ] = {
- "value" : contentItem
- .getCategories()
- .map( function( cat ){
- return cat.getCategoryID();
- } )
- };
- }
- break;
- }
- case "parent": {
- if ( !isNull( contentItem.getParent() ) ) {
- acc[ key ] = { "value" : contentItem.getParent.getContentID() };
- }
- break;
+ var schema = newTemplate.getSchema();
+ var templateProperties = schema.keyArray().filter(
+ function( key ) {
+ return !schema[ key ].keyExists( "excludeTypes" ) ||
+ !schema[ key ].excludeTypes.contains( contentItem.getContentType() );
}
- default: {
- var val = invoke( contentItem, "get" & key );
- if ( !isNull( val ) && isSimpleValue( val ) && len( val ) ) {
- acc[ key ] = { "value" : val };
- if ( !isNumeric( acc[ key ].value ) && isBoolean( acc[ key ].value ) )
- acc[ key ].value = javacast( "boolean", true );
+ );
+
+ var definition = templateProperties.reduce(
+ function( acc, key ) {
+ switch ( key ) {
+ case "customFields": {
+ if ( arrayLen( contentItem.getCustomFields() ) ) {
+ acc[ key ] = { "value": [] };
+ contentItem.getCustomFields().each(
+ function( field ) {
+ acc[ key ].value.append(
+ {
+ "name" : field.getKey(),
+ "defaultValue": field.getValue()
+ }
+ );
+ }
+ );
+ }
+ break;
+ }
+ case "categories": {
+ if ( arrayLen( contentItem.getCategories() ) ) {
+ acc[ key ] = {
+ "value": contentItem.getCategories().map(
+ function( cat ) {
+ return cat.getCategoryID();
+ }
+ )
+ };
+ }
+ break;
+ }
+ case "parent": {
+ if ( !isNull( contentItem.getParent() ) ) {
+ acc[ key ] = { "value": contentItem.getParent.getContentID() };
+ }
+ break;
+ }
+ default: {
+ var val = invoke( contentItem, "get" & key );
+ if ( !isNull( val ) && isSimpleValue( val ) && len( val ) ) {
+ acc[ key ] = { "value": val };
+ if ( !isNumeric( acc[ key ].value ) && isBoolean( acc[ key ].value ) ) {
+ acc[ key ].value = javacast( "boolean", true );
+ }
+ }
+ }
}
- }
- }
- return acc;
- }, {} );
+ return acc;
+ },
+ {}
+ );
newTemplate.setDefinition( definition );
return newTemplate;
- };
+ }
/**
* Import data from a ContentBox JSON file. Returns the import log
@@ -228,14 +246,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -261,13 +282,13 @@ component extends="cborm.models.VirtualEntityService" singleton {
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allTemplates = [];
- var siteService = getWireBox().getInstance( "siteService@contentbox" );
+ var siteService = getWireBox().getInstance( "siteService@contentbox" );
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -275,16 +296,16 @@ component extends="cborm.models.VirtualEntityService" singleton {
for ( var thisTemplate in arguments.importData ) {
var assignedSite = siteService.getBySlugOrFail( thisTemplate.site.slug );
// Get new or persisted
- var oTemplate = this.findBySiteAndName( site = assignedSite, name = thisTemplate.site.name );
- oTemplate = ( isNull( oTemplate ) ? new () : oTemplate );
+ var oTemplate = this.findBySiteAndName( site = assignedSite, name = thisTemplate.site.name );
+ oTemplate = ( isNull( oTemplate ) ? new() : oTemplate );
// populate content from data
getBeanPopulator().populateFromStruct(
- target : oTemplate,
- memento : thisTemplate,
- exclude : "templateID",
- composeRelationships: false
- );
+ target = oTemplate,
+ memento = thisTemplate,
+ exclude = "templateID",
+ composeRelationships = false
+ );
// Link the site
oTemplate.setSite( assignedSite );
@@ -292,18 +313,18 @@ component extends="cborm.models.VirtualEntityService" singleton {
// if new or persisted with override then save.
if ( !oTemplate.isLoaded() ) {
arguments.importLog.append(
- "New template imported for site #assignedSite.getName()#: #thisTemplate.name# "
- );
+ "New template imported for site #assignedSite.getName()#: #thisTemplate.name# "
+ );
arrayAppend( allTemplates, oTemplate );
- } else if ( oTemplate.isLoaded() and arguments.override ) {
+ } else if ( oTemplate.isLoaded() && arguments.override ) {
arguments.importLog.append(
- "Persisted template overriden for site #assignedSite.getName()#: #thisTemplate.name# "
- );
+ "Persisted template overriden for site #assignedSite.getName()#: #thisTemplate.name# "
+ );
arrayAppend( allTemplates, oTemplate );
} else {
arguments.importLog.append(
- "Skipping persisted template for site #assignedSite.getName()#: #thisTemplate.name# "
- );
+ "Skipping persisted template for site #assignedSite.getName()#: #thisTemplate.name# "
+ );
}
}
// end import loop
@@ -314,12 +335,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.importLog.append( "Saved all imported and overriden templates!" );
} else {
arguments.importLog.append(
- "No templates imported as none where found or able to be overriden from the import file."
- );
+ "No templates imported as none where found or able to be overriden from the import file."
+ );
}
}
// end of transaction
return arguments.importLog.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentVersion.cfc b/modules/contentbox/models/content/ContentVersion.cfc
index 95cdcbd5ab..a28cbe1111 100755
--- a/modules/contentbox/models/content/ContentVersion.cfc
+++ b/modules/contentbox/models/content/ContentVersion.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -14,114 +14,106 @@ component
cachename ="cbContentVersion"
cacheuse ="read-write"
{
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
- /* *********************************************************************
- ** DI
- ********************************************************************* */
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="contentVersionID"
- column ="contentVersionID"
+ name="contentVersionID"
+ column="contentVersionID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="content"
- column ="content"
+ name="content"
+ column="content"
notnull="true"
ormtype="text"
- length ="8000"
+ length="8000"
default="";
property
- name ="changelog"
- column ="changelog"
+ name="changelog"
+ column="changelog"
notnull="false"
ormtype="text"
- length ="8000"
+ length="8000"
default="";
property
- name ="version"
- column ="version"
+ name="version"
+ column="version"
notnull="true"
ormtype="integer"
default="1"
- index ="idx_version";
+ index="idx_version";
property
- name ="isActive"
- column ="isActive"
+ name="isActive"
+ column="isActive"
notnull="true"
ormtype="boolean"
default="false"
- index ="idx_activeContentVersion,idx_contentVersions";
+ index="idx_activeContentVersion,idx_contentVersions";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> Author loaded as a proxy and fetched immediately
property
- name ="author"
- notnull ="true"
- cfc ="contentbox.models.security.Author"
+ name="author"
+ notnull="true"
+ cfc="contentbox.models.security.Author"
fieldtype="many-to-one"
- fkcolumn ="FK_authorID"
- fetch ="join";
+ fkcolumn="FK_authorID"
+ fetch="join";
// M20 -> relatedContent
property
- name ="relatedContent"
- notnull ="true"
- cfc ="contentbox.models.content.BaseContent"
+ name="relatedContent"
+ notnull="true"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="many-to-one"
- fkcolumn ="FK_contentID"
- lazy ="true"
- index ="idx_contentVersions";
+ fkcolumn="FK_contentID"
+ lazy="true"
+ index="idx_contentVersions";
- /* *********************************************************************
- ** NON PERSISTED PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** NON PERSISTED PROPERTIES
+ **********************************************************************/
property name="renderedContent" persistent="false";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "contentVersionID";
this.memento = {
- defaultIncludes : [
- "content",
- "changelog",
- "version",
- "isActive",
- "authorSnapshot:author"
- ],
- defaultExcludes : [ "relatedContent" ],
- neverInclude : [ "" ]
+ defaultIncludes: [ "content", "changelog", "version", "isActive", "authorSnapshot:author"],
+ defaultExcludes: [ "relatedContent"],
+ neverInclude : [ ""]
};
this.constraints = {
- "content" : { required : true },
- "version" : { required : true, type : "integer" }
+ "content": { required: true },
+ "version": { required: true, type: "integer" }
};
- function init(){
- variables.createdDate = now();
- variables.isActive = false;
- variables.version = 1;
- variables.content = "";
- variables.changelog = "";
+ function init() {
+ variables.createdDate = now();
+ variables.isActive = false;
+ variables.version = 1;
+ variables.content = "";
+ variables.changelog = "";
variables.renderedContent = "";
super.init();
@@ -132,14 +124,14 @@ component
/**
* Build the author snapshot
*/
- struct function getAuthorSnapshot(){
+ struct function getAuthorSnapshot() {
return ( hasAuthor() ? getAuthor().getInfoSnapshot() : {} );
}
/**
* Build a snapshot of the related content
*/
- struct function getRelatedContentSnapshot(){
+ struct function getRelatedContentSnapshot() {
if ( hasRelatedContent() ) {
return getRelatedContent().getInfoSnapshot();
}
@@ -149,7 +141,7 @@ component
/**
* Shorthand Author name
*/
- string function getAuthorName(){
+ string function getAuthorName() {
if ( hasAuthor() ) {
return getAuthor().getFullName();
}
@@ -159,7 +151,7 @@ component
/**
* Shorthand Author email
*/
- string function getAuthorEmail(){
+ string function getAuthorEmail() {
if ( hasAuthor() ) {
return getAuthor().getEmail();
}
@@ -169,7 +161,7 @@ component
/**
* Get parent slug from the related content it belongs to
*/
- function getParentSlug(){
+ function getParentSlug() {
if ( hasRelatedContent() ) {
return getRelatedContent().getSlug();
}
@@ -179,7 +171,7 @@ component
/**
* Get parent title from the related content it belongs to
*/
- function getParentTitle(){
+ function getParentTitle() {
if ( hasRelatedContent() ) {
return getRelatedContent().getTitle();
}
@@ -189,22 +181,23 @@ component
/**
* Render version content out
*/
- any function renderContent(){
+ any function renderContent() {
// Check if we need to translate
- if ( NOT len( variables.renderedContent ) ) {
+ if ( !len( variables.renderedContent ) ) {
lock
name ="contentbox.versionrendering.#getContentVersionID()#"
type ="exclusive"
throwontimeout="true"
- timeout ="10" {
- if ( NOT len( variables.renderedContent ) ) {
+ timeout ="10"
+ {
+ if ( !len( variables.renderedContent ) ) {
// else render content out, prepare builder
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",
- { builder : builder, content : this }
- );
+ "cb_onContentRendering",
+ { builder: builder, content: this }
+ );
// save content
variables.renderedContent = builder.toString();
@@ -216,4 +209,4 @@ component
return variables.renderedContent;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/ContentVersionService.cfc b/modules/contentbox/models/content/ContentVersionService.cfc
index eee95b5891..aa3dde280d 100755
--- a/modules/contentbox/models/content/ContentVersionService.cfc
+++ b/modules/contentbox/models/content/ContentVersionService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,7 +10,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Constructor
*/
- ContentVersionService function init(){
+ ContentVersionService function init() {
// init it
super.init( entityName = "cbContentVersion" );
@@ -25,12 +25,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return The number of versions a content object has by filters
*/
- numeric function getNumberOfVersions( string contentId = "", boolean isActive ){
+ numeric function getNumberOfVersions( string contentId = "", boolean isActive ) {
return newCriteria()
.isEq( "relatedContent.contentID", arguments.contentId )
- .when( !isNull( arguments.isActive ), function( c ){
- c.isEq( "isActive", javacast( "Boolean", isActive ) );
- } )
+ .when(
+ !isNull( arguments.isActive ),
+ function( c ) {
+ c.isEq( "isActive", javacast( "Boolean", isActive ) );
+ }
+ )
.count();
}
@@ -41,7 +44,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return The active version if found, else a new ContentVersion object
*/
- function getActiveVersion( required contentId ){
+ function getActiveVersion( required contentId ) {
// Get all the active versions
var aVersions = newCriteria()
.isEq( "relatedContent.contentID", arguments.contentId )
@@ -65,22 +68,22 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return struct of { count : numeric, versions : array}
*/
- struct function findRelatedVersions( required contentID, max = 0, offset = 0 ){
+ struct function findRelatedVersions( required contentID, max = 0, offset = 0 ) {
var results = {};
// Find it
var c = newCriteria().isEq( "relatedContent.contentID", arguments.contentId );
// run criteria query and projections count
- results.count = c.count();
+ results.count = c.count();
results.versions = c.list(
- offset = arguments.offset,
- max = arguments.max,
- sortOrder = "version DESC",
- asQuery = false
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = "version DESC",
+ asQuery = false
+ );
return results;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/CustomField.cfc b/modules/contentbox/models/content/CustomField.cfc
index cc3b61224b..8cd566843a 100644
--- a/modules/contentbox/models/content/CustomField.cfc
+++ b/modules/contentbox/models/content/CustomField.cfc
@@ -13,71 +13,69 @@ component
cachename ="cbCustomField"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="customFieldID"
- column ="customFieldID"
+ name="customFieldID"
+ column="customFieldID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="key"
- column ="key"
+ name="key"
+ column="key"
notnull="true"
ormtype="string"
- length ="255";
+ length="255";
property
- name ="value"
- column ="value"
+ name="value"
+ column="value"
notnull="true"
ormtype="text"
- length ="8000";
+ length="8000";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> Content loaded as a proxy
property
- name ="relatedContent"
- notnull ="false"
- cfc ="contentbox.models.content.BaseContent"
+ name="relatedContent"
+ notnull="false"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="many-to-one"
- fkcolumn ="FK_contentID"
- lazy ="true"
- index ="idx_contentCustomFields";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fkcolumn="FK_contentID"
+ lazy="true"
+ index="idx_contentCustomFields";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "customFieldID";
this.memento = {
- defaultIncludes : [ "key", "value" ],
- defaultExcludes : [ "relatedContent" ],
- neverInclude : []
+ defaultIncludes: [ "key", "value"],
+ defaultExcludes: [ "relatedContent"],
+ neverInclude : []
};
this.constraints = {
- "key" : { required : true, size : "1..255" },
- "value" : { required : true }
+ "key" : { required: true, size: "1..255" },
+ "value": { required: true }
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/CustomFieldService.cfc b/modules/contentbox/models/content/CustomFieldService.cfc
index 3ac1b55368..1aed018e60 100755
--- a/modules/contentbox/models/content/CustomFieldService.cfc
+++ b/modules/contentbox/models/content/CustomFieldService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,11 +10,11 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Constructor
*/
- CustomFieldService function init(){
+ CustomFieldService function init() {
// init it
super.init( entityName = "cbCustomField" );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/Entry.cfc b/modules/contentbox/models/content/Entry.cfc
index 27b450dd23..472261803d 100755
--- a/modules/contentbox/models/content/Entry.cfc
+++ b/modules/contentbox/models/content/Entry.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -16,38 +16,37 @@ component
joinColumn ="contentID"
discriminatorValue="Entry"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="excerpt"
- column ="excerpt"
+ name="excerpt"
+ column="excerpt"
notnull="false"
ormtype="text"
default=""
- length ="8000";
+ length="8000";
- /* *********************************************************************
- ** NON PERSISTED PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** NON PERSISTED PROPERTIES
+ **********************************************************************/
property name="renderedExcerpt" persistent="false";
- /* *********************************************************************
- ** CONSTRAINTS
- ********************************************************************* */
+ /**********************************************************************
+ * ** CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** CONSTRUCTOR
- ********************************************************************* */
+ /**********************************************************************
+ * ** CONSTRUCTOR
+ **********************************************************************/
/**
* constructor
*/
- function init(){
- var props = [ "excerpt" ];
+ function init() {
+ var props = [ "excerpt"];
appendToMemento( props, "defaultIncludes" );
appendToMemento( [], "defaultExcludes" );
appendToMementoProfile( props, "response" );
@@ -55,42 +54,47 @@ component
super.init();
- variables.categories = [];
- variables.customFields = [];
+ variables.categories = [];
+ variables.customFields = [];
variables.renderedContent = "";
variables.renderedExcerpt = "";
- variables.createdDate = now();
- variables.contentType = "Entry";
+ variables.createdDate = now();
+ variables.contentType = "Entry";
return this;
}
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* has excerpt
*/
- boolean function hasExcerpt(){
+ boolean function hasExcerpt() {
return len( getExcerpt() ) GT 0;
}
/**
* Render excerpt
*/
- any function renderExcerpt(){
+ 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" {
- if ( NOT len( variables.renderedExcerpt ) ) {
+ if ( !len( variables.renderedExcerpt ) ) {
+ lock
+ name ="contentbox.excerptrendering.#getContentID()#"
+ type ="exclusive"
+ throwontimeout="true"
+ timeout ="10"
+ {
+ if ( !len( variables.renderedExcerpt ) ) {
// render excerpt out, prepare builder
var builder = createObject( "java", "java.lang.StringBuilder" ).init( getExcerpt() );
// announce renderings with data, so content renderers can process them
variables.interceptorService.announce(
- "cb_onContentRendering",
- { builder : builder, content : this }
- );
+ "cb_onContentRendering",
+ { builder: builder, content: this }
+ );
// store processed content
variables.renderedExcerpt = builder.toString();
}
@@ -117,7 +121,7 @@ component
required boolean publish,
required any originalSlugRoot,
required any newSlugRoot
- ){
+ ) {
// Original cloning!
if ( arguments.original.hasExcerpt() ) {
setExcerpt( arguments.original.getExcerpt() );
@@ -126,4 +130,4 @@ component
return super.clone( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/EntryService.cfc b/modules/contentbox/models/content/EntryService.cfc
index 449476eeb9..00d6711c60 100755
--- a/modules/contentbox/models/content/EntryService.cfc
+++ b/modules/contentbox/models/content/EntryService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,14 +6,13 @@
* Manages blog entry content
*/
component extends="ContentService" singleton {
-
// Inject generic content service
property name="contentService" inject="id:ContentService@contentbox";
/**
* Constructor
*/
- EntryService function init(){
+ EntryService function init() {
// init it
super.init( entityName = "cbEntry", useQueryCaching = true );
@@ -28,9 +27,9 @@ component extends="ContentService" singleton {
*
* @return Saved entry
*/
- function save( required any entry, string originalSlug = "" ){
+ function save( required any entry, string originalSlug = "" ) {
// Only create relocations for slug changes to published entries
- if ( entry.getIsPublished() && !isNull( arguments.originalSlug ) AND len( arguments.originalSlug ) ) {
+ if ( entry.getIsPublished() && !isNull( arguments.originalSlug ) && len( arguments.originalSlug ) ) {
addRelocation( arguments.entry, arguments.originalSlug );
}
return super.save( arguments.entry );
@@ -67,22 +66,21 @@ component extends="ContentService" singleton {
boolean showInSearch = false,
string siteId = "",
string propertyList
- ){
- var results = { "count" : 0, "entries" : [] };
+ ) {
+ var results = { "count": 0, "entries": [] };
// criteria queries
- var c = newCriteria();
+ var c = newCriteria();
// stub out activeContent alias based on potential conditions...
// this way, we don't have to worry about accidentally creating it twice, or not creating it at all
if (
- ( arguments.author NEQ "all" ) ||
- ( len( arguments.search ) ) ||
- ( findNoCase( "modifiedDate", arguments.sortOrder ) )
+ ( arguments.author NEQ "all" ) || ( len( arguments.search ) ) ||
+ ( findNoCase( "modifiedDate", arguments.sortOrder ) )
) {
c.createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- );
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ );
}
// only search shownInSearch bits
if ( arguments.showInSearch ) {
@@ -90,7 +88,10 @@ component extends="ContentService" singleton {
}
// isPublished filter
if ( arguments.isPublished NEQ "any" ) {
- c.isEq( "isPublished", javacast( "boolean", arguments.isPublished ) );
+ c.isEq(
+ "isPublished",
+ javacast( "boolean", arguments.isPublished )
+ );
}
// Author Filter
if ( arguments.author NEQ "all" ) {
@@ -106,9 +107,9 @@ component extends="ContentService" singleton {
if ( arguments.searchActiveContent ) {
// like disjunctions
c.$or(
- c.restrictions.like( "title", "%#arguments.search#%" ),
- c.restrictions.like( "ac.content", "%#arguments.search#%" )
- );
+ c.restrictions.like( "title", "%#arguments.search#%" ),
+ c.restrictions.like( "ac.content", "%#arguments.search#%" )
+ );
} else {
c.like( "title", "%#arguments.search#%" );
}
@@ -116,13 +117,12 @@ component extends="ContentService" singleton {
// Category Filter
if ( arguments.category NEQ "all" ) {
// Uncategorized?
- if ( arguments.category eq "none" ) {
+ if ( arguments.category EQ "none" ) {
c.isEmpty( "categories" );
- }
- // With categories
- else {
+ } else {
+ // With categories
// search the association
- c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category ] );
+ c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category] );
}
}
// Site Filter
@@ -138,9 +138,8 @@ component extends="ContentService" singleton {
"modifiedDate",
"ac.createdDate"
);
- }
- // default to title sorting
- else if ( !len( arguments.sortOrder ) ) {
+ } else if ( !len( arguments.sortOrder ) ) {
+ // default to title sorting
sortOrder = "publishedDate DESC";
}
@@ -153,11 +152,11 @@ component extends="ContentService" singleton {
c.resultTransformer( c.DISTINCT_ROOT_ENTITY );
}
results.entries = c.list(
- offset = arguments.offset,
- max = arguments.max,
- sortOrder = arguments.sortOrder,
- asQuery = false
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = false
+ );
return results;
}
@@ -165,7 +164,7 @@ component extends="ContentService" singleton {
/**
* Get a query report of entries archive
*/
- function getArchiveReport(){
+ function getArchiveReport() {
// we use HQL so we can be DB independent using the map() hql function thanks to John Wish, you rock!
var hql = "SELECT new map( count(*) as count, YEAR(publishedDate) as year, MONTH(publishedDate) as month )
FROM cbEntry
@@ -175,7 +174,10 @@ component extends="ContentService" singleton {
GROUP BY YEAR(publishedDate), MONTH(publishedDate)
ORDER BY 2 DESC, 3 DESC";
// run report
- return executeQuery( query = hql, params = { "isPublished" : true, "now" : now() } );
+ return executeQuery(
+ query = hql,
+ params = { "isPublished": true, "now": now() }
+ );
}
/**
@@ -199,13 +201,13 @@ component extends="ContentService" singleton {
numeric offset = 0,
boolean asQuery = false,
string siteId = ""
- ){
+ ) {
var results = {};
- var hql = "FROM cbEntry
+ var hql = "FROM cbEntry
WHERE isPublished = :isPublished
AND passwordProtection = ''
AND publishedDate <= :now";
- var params = { "isPublished" : true };
+ var params = { "isPublished": true };
params[ "now" ] = now();
// Site
@@ -260,8 +262,8 @@ component extends="ContentService" singleton {
*
* @site The site to get the export from
*/
- array function getAllForExport( required site ){
- return super.getAllForExport( findAllWhere( { site : arguments.site } ) );
+ array function getAllForExport( required site ) {
+ return super.getAllForExport( findAllWhere( { site: arguments.site } ) );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/Page.cfc b/modules/contentbox/models/content/Page.cfc
index fd2b1e6d3f..1835eb9937 100755
--- a/modules/contentbox/models/content/Page.cfc
+++ b/modules/contentbox/models/content/Page.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -16,27 +16,26 @@ component
joinColumn ="contentID"
discriminatorValue="Page"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
/**
* The layout in a theme that will be used to render the page out
*/
property
- name ="layout"
- column ="layout"
+ name="layout"
+ column="layout"
notnull="false"
- length ="200"
+ length="200"
default="";
/**
* The ordering numeric sequence
*/
property
- name ="order"
- column ="order"
+ name="order"
+ column="order"
notnull="false"
ormtype="integer"
default="0";
@@ -45,60 +44,59 @@ component
* If true, this page is used when building automated menus. Else it is ignored.
*/
property
- name ="showInMenu"
- column ="showInMenu"
+ name="showInMenu"
+ column="showInMenu"
notnull="true"
ormtype="boolean"
default="true"
- index ="idx_showInMenu";
+ index="idx_showInMenu";
/**
* The excerpt for this page. This can be empty.
*/
property
- name ="excerpt"
- column ="excerpt"
+ name="excerpt"
+ column="excerpt"
notnull="false"
ormtype="text"
default=""
- length ="8000";
+ length="8000";
- /* *********************************************************************
- ** NON PERSISTED PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** NON PERSISTED PROPERTIES
+ **********************************************************************/
property name="renderedExcerpt" persistent="false";
+ /**********************************************************************
+ * ** CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "layout" ] = { required : false, size : "1..200" };
- this.constraints[ "order" ] = { required : true, type : "numeric" };
- this.constraints[ "showInMenu" ] = { required : false, type : "boolean" };
+ this.constraints[ "layout" ] = { required: false, size: "1..200" };
+ this.constraints[ "order" ] = { required: true, type: "numeric" };
+ this.constraints[ "showInMenu" ] = { required: false, type: "boolean" };
- /* *********************************************************************
- ** CONSTRUCTOR
- ********************************************************************* */
+ /**********************************************************************
+ * ** CONSTRUCTOR
+ **********************************************************************/
- function init(){
- var props = [ "excerpt", "layout", "order", "showInMenu" ];
+ function init() {
+ var props = [ "excerpt", "layout", "order", "showInMenu"];
appendToMemento( props, "defaultIncludes" );
appendToMementoProfile( props, "export" );
appendToMementoProfile( props, "response" );
super.init();
- variables.categories = [];
- variables.customFields = [];
+ variables.categories = [];
+ variables.customFields = [];
variables.renderedContent = "";
variables.renderedExcerpt = "";
- variables.allowComments = false;
- variables.createdDate = now();
- variables.layout = "pages";
- variables.contentType = "Page";
- variables.order = 0;
- variables.showInMenu = true;
+ variables.allowComments = false;
+ variables.createdDate = now();
+ variables.layout = "pages";
+ variables.contentType = "Page";
+ variables.order = 0;
+ variables.showInMenu = true;
// INHERITANCE LAYOUT STATIC
variables.LAYOUT_INHERITANCE_KEY = "-inherit-";
@@ -106,29 +104,34 @@ component
return this;
}
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Verifies an excerpt exists in this content object via length checks
*/
- boolean function hasExcerpt(){
+ boolean function hasExcerpt() {
return len( getExcerpt() ) GT 0;
}
- any function renderExcerpt(){
+ 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" {
- if ( NOT len( variables.renderedExcerpt ) ) {
+ if ( !len( variables.renderedExcerpt ) ) {
+ lock
+ name ="contentbox.excerptrendering.#getContentID()#"
+ type ="exclusive"
+ throwontimeout="true"
+ timeout ="10"
+ {
+ if ( !len( variables.renderedExcerpt ) ) {
// render excerpt out, prepare builder
var builder = createObject( "java", "java.lang.StringBuilder" ).init( getExcerpt() );
// announce renderings with data, so content renderers can process them
variables.interceptorService.announce(
- "cb_onContentRendering",
- { builder : builder, content : this }
- );
+ "cb_onContentRendering",
+ { builder: builder, content: this }
+ );
// store processed content
variables.renderedExcerpt = builder.toString();
}
@@ -141,17 +144,17 @@ component
/**
* Get the layout or if empty the default convention of "pages"
*/
- function getLayoutWithDefault(){
+ function getLayoutWithDefault() {
return ( len( getLayout() ) ? getLayout() : "pages" );
}
/**
* Get layout with layout inheritance, if none found return normal saved layout
*/
- function getLayoutWithInheritance(){
+ function getLayoutWithInheritance() {
var thisLayout = getLayout();
// check for inheritance and parent?
- if ( thisLayout eq variables.LAYOUT_INHERITANCE_KEY AND hasParent() ) {
+ if ( thisLayout EQ variables.LAYOUT_INHERITANCE_KEY && hasParent() ) {
return getParent().getLayoutWithInheritance();
}
// Else return the layout
@@ -175,7 +178,7 @@ component
required boolean publish,
required any originalSlugRoot,
required any newSlugRoot
- ){
+ ) {
// Do page property cloning
setLayout( arguments.original.getLayout() );
setShowInMenu( arguments.original.getShowInMenu() );
@@ -190,11 +193,11 @@ component
/**
* Verifies if the current page is the current site homepage
*/
- boolean function isHomepage(){
+ boolean function isHomepage() {
if ( !hasSite() ) {
return false;
}
- return ( getSite().getHomePage() eq getSlug() );
+ return ( getSite().getHomePage() EQ getSlug() );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/PageService.cfc b/modules/contentbox/models/content/PageService.cfc
index a931a92246..a19ab80c75 100755
--- a/modules/contentbox/models/content/PageService.cfc
+++ b/modules/contentbox/models/content/PageService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,14 +6,13 @@
* Service layer for all Page operations
*/
component extends="ContentService" singleton {
-
// Inject generic content service
property name="contentService" inject="id:ContentService@contentbox";
/**
* Constructor
*/
- PageService function init(){
+ PageService function init() {
// init it
super.init( entityName = "cbPage", useQueryCaching = true );
@@ -28,24 +27,24 @@ component extends="ContentService" singleton {
*
* @return Saved page
*/
- function save( required any page, string originalSlug = "" ){
+ function save( required any page, string originalSlug = "" ) {
transaction {
// Save the target page
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 ( !isNull( arguments.originalSlug ) AND len( arguments.originalSlug ) ) {
+ if ( !isNull( arguments.originalSlug ) && len( arguments.originalSlug ) ) {
addRelocation( arguments.page, arguments.originalSlug );
var pagesInNeed = newCriteria().like( "slug", "#arguments.originalSlug#/%" ).list();
for ( var thisPage in pagesInNeed ) {
addRelocation( thisPage, thisPage.getSlug() );
thisPage.setSlug(
- replaceNoCase(
- thisPage.getSlug(),
- arguments.originalSlug,
- arguments.page.getSlug()
- )
- );
+ replaceNoCase(
+ thisPage.getSlug(),
+ arguments.originalSlug,
+ arguments.page.getSlug()
+ )
+ );
super.save( thisPage );
}
}
@@ -74,10 +73,10 @@ component extends="ContentService" singleton {
* @return struct = { pages, count }
*/
struct function search(
- string search = "",
- string isPublished = "any",
- string author = "all",
- string creator = "all",
+ string search = "",
+ string isPublished = "any",
+ string author = "all",
+ string creator = "all",
string parent,
string category = "all",
numeric max = 0,
@@ -87,23 +86,22 @@ component extends="ContentService" singleton {
boolean showInSearch = false,
string siteID = "",
string propertyList
- ){
- var results = { "count" : 0, "pages" : [] };
+ ) {
+ var results = { "count": 0, "pages": [] };
// criteria queries
- var c = newCriteria();
+ var c = newCriteria();
// stub out activeContent alias based on potential conditions...
// this way, we don't have to worry about accidentally creating it twice, or not creating it at all
if (
- ( arguments.author NEQ "all" ) ||
- ( len( arguments.search ) ) ||
- ( findNoCase( "modifiedDate", arguments.sortOrder ) )
+ ( arguments.author NEQ "all" ) || ( len( arguments.search ) ) ||
+ ( findNoCase( "modifiedDate", arguments.sortOrder ) )
) {
c.createAlias(
- associationName: "contentVersions",
- alias : "ac",
- withClause : getRestrictions().isTrue( "ac.isActive" )
- );
+ associationName = "contentVersions",
+ alias = "ac",
+ withClause = getRestrictions().isTrue( "ac.isActive" )
+ );
}
// only search shownInSearch bits
@@ -113,7 +111,10 @@ component extends="ContentService" singleton {
// isPublished filter
if ( arguments.isPublished NEQ "any" ) {
- c.isEq( "isPublished", javacast( "boolean", arguments.isPublished ) );
+ c.isEq(
+ "isPublished",
+ javacast( "boolean", arguments.isPublished )
+ );
}
// Author Filter
@@ -137,15 +138,15 @@ component extends="ContentService" singleton {
if ( arguments.searchActiveContent ) {
// like disjunctions
c.$or(
- c.restrictions.like( "title", "%#arguments.search#%" ),
- c.restrictions.like( "slug", "%#arguments.search#%" ),
- c.restrictions.like( "ac.content", "%#arguments.search#%" )
- );
+ c.restrictions.like( "title", "%#arguments.search#%" ),
+ c.restrictions.like( "slug", "%#arguments.search#%" ),
+ c.restrictions.like( "ac.content", "%#arguments.search#%" )
+ );
} else {
c.$or(
- c.restrictions.like( "title", "%#arguments.search#%" ),
- c.restrictions.like( "slug", "%#arguments.search#%" )
- );
+ c.restrictions.like( "title", "%#arguments.search#%" ),
+ c.restrictions.like( "slug", "%#arguments.search#%" )
+ );
}
}
@@ -161,13 +162,12 @@ component extends="ContentService" singleton {
// Category Filter
if ( arguments.category NEQ "all" ) {
// Uncategorized?
- if ( arguments.category eq "none" ) {
+ if ( arguments.category EQ "none" ) {
c.isEmpty( "categories" );
- }
- // With categories
- else {
+ } else {
+ // With categories
// search the association
- c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category ] );
+ c.createAlias( "categories", "cats" ).isIn( "cats.categoryID", [ arguments.category] );
}
}
@@ -179,9 +179,8 @@ component extends="ContentService" singleton {
"modifiedDate",
"ac.createdDate"
);
- }
- // default to title sorting
- else if ( !len( arguments.sortOrder ) ) {
+ } else if ( !len( arguments.sortOrder ) ) {
+ // default to title sorting
sortOrder = "title asc";
}
@@ -194,11 +193,11 @@ component extends="ContentService" singleton {
c.resultTransformer( c.DISTINCT_ROOT_ENTITY );
}
results.pages = c.list(
- offset = arguments.offset,
- max = arguments.max,
- sortOrder = arguments.sortOrder,
- asQuery = false
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = false
+ );
return results;
}
@@ -223,25 +222,26 @@ component extends="ContentService" singleton {
* @return struct of { count, content }
*/
function findPublishedContent(
- numeric max = 0,
- numeric offset = 0,
- any searchTerm = "",
- any category = "",
- boolean asQuery = false,
- string sortOrder = "publishedDate DESC",
+ numeric max = 0,
+ numeric offset = 0,
+ any searchTerm = "",
+ any category = "",
+ boolean asQuery = false,
+ string sortOrder = "publishedDate DESC",
any parent,
string slugPrefix = "",
string siteID = "",
string properties,
- string authorID = "",
+ string authorID = "",
boolean showInMenu,
string slugSearch = ""
- ){
- arguments.criteria = newCriteria()
- // Show only pages with showInMenu criteria?
- .when( !isNull( arguments.showInMenu ), function( c ){
- arguments.c.isEq( "showInMenu", javacast( "boolean", showInMenu ) );
- } );
+ ) {
+ arguments.criteria = newCriteria().when(
+ !isNull( arguments.showInMenu ),
+ function( c ) {
+ arguments.c.isEq( "showInMenu", javacast( "boolean", showInMenu ) );
+ }
+ );
// run criteria query and projections count
return super.findPublishedContent( argumentCollection = arguments );
@@ -252,13 +252,11 @@ component extends="ContentService" singleton {
*
* @site The site to get the export from
*/
- array function getAllForExport( required site ){
- return super.getAllForExport(
- newCriteria()
- .isNull( "parent" )
- .isEq( "site", arguments.site )
- .list()
- );
+ array function getAllForExport( required site ) {
+ return super.getAllForExport( newCriteria()
+ .isNull( "parent" )
+ .isEq( "site", arguments.site )
+ .list() );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/Relocation.cfc b/modules/contentbox/models/content/Relocation.cfc
index fac5725a79..d30df74017 100644
--- a/modules/contentbox/models/content/Relocation.cfc
+++ b/modules/contentbox/models/content/Relocation.cfc
@@ -14,61 +14,51 @@ component
cachename ="cbRelocation"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="relocationID"
- column ="relocationID"
+ name="relocationID"
+ column="relocationID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
- property
- name ="slug"
- notnull="true"
- length ="500"
- default="";
+ property name="slug" notnull="true" length="500" default="";
/** An optional manual target - may be used if no content is assigned **/
- property
- name ="target"
- notnull="false"
- length ="500"
- default="";
+ property name="target" notnull="false" length="500" default="";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
property
- name ="site"
- notnull ="true"
- cfc ="contentbox.models.system.Site"
+ name="site"
+ notnull="true"
+ cfc="contentbox.models.system.Site"
fieldtype="many-to-one"
- fkcolumn ="FK_siteID"
- fetch ="join";
+ fkcolumn="FK_siteID"
+ fetch="join";
// O2O -> Content
property
- name ="relatedContent"
- notnull ="false"
- cfc ="contentbox.models.content.BaseContent"
+ name="relatedContent"
+ notnull="false"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="many-to-one"
- fkcolumn ="FK_contentID"
- lazy ="false"
- fetch ="select";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fkcolumn="FK_contentID"
+ lazy="false"
+ fetch="select";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "relocationID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"relocationID",
"createdDate",
"modifiedDate",
@@ -79,17 +69,17 @@ component
};
this.constraints = {
- "slug" : {
- required : true,
- size : "1..500",
- validator : "UniqueSiteFieldValidator@contentbox"
+ "slug": {
+ required : true,
+ size : "1..500",
+ validator: "UniqueSiteFieldValidator@contentbox"
}
};
// overload method to clean any leading or trailing slashes
- function setSlug( value ){
+ function setSlug( value ) {
variables.slug = arrayToList( listToArray( arguments.value, "/" ), "/" );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/RelocationService.cfc b/modules/contentbox/models/content/RelocationService.cfc
index a238075901..87aca7a2b2 100644
--- a/modules/contentbox/models/content/RelocationService.cfc
+++ b/modules/contentbox/models/content/RelocationService.cfc
@@ -1,37 +1,37 @@
/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* A generic content service for content objects
-*/
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * A generic content service for content objects
+ */
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="log" inject="logbox:logger:{this}";
+
property name="CBHelper" inject="CBHelper@contentbox";
/**
* Constructor
*/
- function init(){
+ function init() {
super.init( entityname = "cbRelocation", queryCaching = true );
return this;
}
@@ -49,35 +49,46 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @return struct of { count, relocations }
*/
struct function search(
- search = "",
- siteID = "",
+ search = "",
+ siteID = "",
boolean isPublic,
max = 0,
offset = 0,
sortOrder = "slug asc"
- ){
- var results = { "count" : 0, "relocations" : [] };
- var c = newCriteria()
+ ) {
+ var results = { "count": 0, "relocations": [] };
+ var c = newCriteria()
+ .when(
+ len( arguments.search ),
+ function( c ) {
+ c.like( "slug", "%#search#%" );
+ }
+ )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
// Search Criteria
- .when( len( arguments.search ), function( c ){
- c.like( "slug", "%#search#%" );
- } )
+
// Site Filter
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
+
// Content ID filter
- .when( !isNull( arguments.contentID ), function( c ){
- c.isEq( "relatedContent.contentID", arguments.contentID );
- } );
+ .when(
+ !isNull( arguments.contentID ),
+ function( c ) {
+ c.isEq( "relatedContent.contentID", arguments.contentID );
+ }
+ );
// run criteria query and projections count
- results.count = c.count( "relocationID" );
+ results.count = c.count( "relocationID" );
results.relocations = c.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: arguments.sortOrder
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder
+ );
return results;
}
@@ -88,19 +99,25 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @contentItem the content item to associate to this relocation
* @originalSlug the slug which will be relocated
*/
- Relocation function createContentRelocation( required BaseContent contentItem, required string originalSlug ){
- var siteId = arguments.contentItem.getSite().getSiteID();
+ Relocation function createContentRelocation(
+ required BaseContent contentItem,
+ required string originalSlug
+ ) {
+ var siteId = arguments
+ .contentItem
+ .getSite()
+ .getSiteID();
var relocation = newCriteria()
.createAlias( "site", "site" )
.isEq( "site.siteID", siteId )
.isEq( "slug", arguments.originalSlug )
.get();
if ( isNull( relocation ) ) {
- relocation = new (
+ relocation = new(
properties = {
- "slug" : arguments.originalSlug,
- "relatedContent" : arguments.contentItem,
- "site" : siteId
+ "slug" : arguments.originalSlug,
+ "relatedContent": arguments.contentItem,
+ "site" : siteId
}
);
} else {
@@ -116,18 +133,18 @@ component extends="cborm.models.VirtualEntityService" singleton {
* @slug The URI to be checked
* @target The target to relocate the URI to
*/
- Relocation function createTargetRelocation( required string slug, required string target ){
- var site = variables.cbHelper.site();
+ Relocation function createTargetRelocation( required string slug, required string target ) {
+ var site = variables.cbHelper.site();
var relocation = newCriteria()
.isEq( "site", site )
.isEq( "slug", arguments.originalSlug )
.get();
if ( isNull( relocation ) ) {
- relocation = new (
+ relocation = new(
properties = {
- "slug" : arguments.slug,
- "target" : arguments.target,
- "site" : site
+ "slug" : arguments.slug,
+ "target": arguments.target,
+ "site" : site
}
);
} else {
@@ -148,7 +165,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
required string slug,
string contentType = "Page",
Site site
- ){
+ ) {
param arguments.site = variables.CBHelper.site();
return newCriteria()
@@ -159,4 +176,4 @@ component extends="cborm.models.VirtualEntityService" singleton {
.get();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/Stats.cfc b/modules/contentbox/models/content/Stats.cfc
index e82f8b416d..271d7d3bc1 100644
--- a/modules/contentbox/models/content/Stats.cfc
+++ b/modules/contentbox/models/content/Stats.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -14,51 +14,49 @@ component
cachename ="cbStats"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="statsID"
- column ="statsID"
+ name="statsID"
+ column="statsID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="hits"
- column ="hits"
+ name="hits"
+ column="hits"
notnull="false"
ormtype="long"
default="0";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// O2O -> Content
property
- name ="relatedContent"
- notnull ="true"
- cfc ="contentbox.models.content.BaseContent"
+ name="relatedContent"
+ notnull="true"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="one-to-one"
- fkcolumn ="FK_contentID"
- lazy ="true";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fkcolumn="FK_contentID"
+ lazy="true";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "statsID";
- this.memento = { defaultIncludes : [ "hits" ], defaultExcludes : [ "" ] };
+ this.memento = { defaultIncludes: [ "hits"], defaultExcludes: [ ""] };
- this.constraints = { "hits" : { required : false, type : "numeric" } };
+ this.constraints = { "hits": { required: false, type: "numeric" } };
- function init(){
+ function init() {
super.init();
return this;
}
@@ -66,11 +64,11 @@ component
/**
* Build a snapshot of the related content
*/
- struct function getRelatedContentSnapshot(){
+ struct function getRelatedContentSnapshot() {
if ( hasRelatedContent() ) {
return getRelatedContent().getInfoSnapshot();
}
return {};
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/StatsService.cfc b/modules/contentbox/models/content/StatsService.cfc
index 633d023813..46a3e9d458 100644
--- a/modules/contentbox/models/content/StatsService.cfc
+++ b/modules/contentbox/models/content/StatsService.cfc
@@ -1,51 +1,50 @@
/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* A generic content service for content objects
-*/
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * A generic content service for content objects
+ */
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
/**
* Constructor
*/
- function init(){
+ function init() {
super.init( entityname = "cbStats", queryCaching = true );
return this;
}
-
/**
* Determine if we have a bot
*/
- function isUserAgentABot(){
+ function isUserAgentABot() {
var userAgent = lCase( CGI.http_user_agent );
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 ) {
+ if ( arrayLen( reMatch( thisBot, userAgent ) ) GT 0 ) {
return true;
}
}
@@ -58,10 +57,10 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @contentId The site to filter on
*/
- numeric function getTotalHitsByContent( string contentId = "" ){
+ numeric function getTotalHitsByContent( string contentId = "" ) {
var oStat = newCriteria()
.isEq( "relatedContent.contentID", arguments.contentId )
- .withProjections( property: "hits" )
+ .withProjections( property = "hits" )
.get();
return ( isNull( oStat ) ? 0 : oStat );
}
@@ -71,41 +70,41 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @content. The content object to update the hits on
*/
- StatsService function syncUpdateHits( required content ){
+ StatsService function syncUpdateHits( required content ) {
// are we tracking hit counts?
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" ) || !isUserAgentABot() ) {
queryExecute(
"UPDATE cb_stats
SET hits = hits + 1,
modifiedDate = :modifiedDate
WHERE FK_contentID = :contentId",
{
- modifiedDate : {
- value : createODBCDateTime( now() ),
- cfsqltype : "timestamp"
+ modifiedDate: {
+ value : createODBCDateTime( now() ),
+ cfsqltype: "timestamp"
},
- contentId : arguments.content.getContentId()
+ contentId: arguments.content.getContentId()
},
- { result : "local.qResults" }
+ { result: "local.qResults" }
);
// if no record, means, new record, so insert
- if ( qResults.recordcount eq 0 ) {
- save( this.new( { hits : 1, relatedContent : arguments.content } ) );
+ if ( qResults.recordcount EQ 0 ) {
+ save( this.new( { hits: 1, relatedContent: arguments.content } ) );
}
}
- } catch ( any e ) {
+ } catch (any e) {
log.error(
- "Error hit tracking contentID: #arguments.content.getContentId()#. #e.message# #e.detail#",
- e
- );
+ "Error hit tracking contentID: #arguments.content.getContentId()#. #e.message# #e.detail#",
+ e
+ );
}
}
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/renderers/BaseRenderer.cfc b/modules/contentbox/models/content/renderers/BaseRenderer.cfc
index 597e257481..89f3de6ae4 100644
--- a/modules/contentbox/models/content/renderers/BaseRenderer.cfc
+++ b/modules/contentbox/models/content/renderers/BaseRenderer.cfc
@@ -6,15 +6,16 @@
* Our base content renderer
*/
component accessors="true" {
-
// DI
property name="cb" inject="id:CBHelper@contentbox";
+
property name="log" inject="logbox:logger:{this}";
/**
* Base Configure
*/
- void function configure(){
+ void function configure() {
+
}
/**
@@ -30,18 +31,18 @@ component accessors="true" {
required builder,
required indexOf,
required replaceWith
- ){
+ ) {
var rLocation = arguments.builder.indexOf( arguments.indexOf );
- var rLen = len( arguments.indexOf );
+ var rLen = len( arguments.indexOf );
// Loop findings of same instances to replace
- while ( rLocation gt -1 ) {
+ while ( rLocation GT -1 ) {
// Replace it
arguments.builder.replace(
- javacast( "int", rLocation ),
- javacast( "int", rLocation + rLen ),
- arguments.replaceWith
- );
+ javacast( "int", rLocation ),
+ javacast( "int", rLocation + rLen ),
+ arguments.replaceWith
+ );
// look again
rLocation = arguments.builder.indexOf( arguments.indexOf, javacast( "int", rLocation ) );
}
@@ -49,4 +50,4 @@ component accessors="true" {
return arguments.builder;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/renderers/LinkRenderer.cfc b/modules/contentbox/models/content/renderers/LinkRenderer.cfc
index 83a9e69ce7..e35c0620ea 100755
--- a/modules/contentbox/models/content/renderers/LinkRenderer.cfc
+++ b/modules/contentbox/models/content/renderers/LinkRenderer.cfc
@@ -5,12 +5,12 @@
* ---
* A content renderer that transforms _page:XX_ and _entry:XX_ into page and entry links
*/
-component accessors="true" extends="BaseRenderer" {
+component accessors="true" extends ="BaseRenderer" {
/**
* Execute on content translations for pages and blog entries
*/
- void function cb_onContentRendering( event, struct data ){
+ void function cb_onContentRendering( event, struct data ) {
translateContent(
builder = arguments.data.builder,
content = arguments.data.content,
@@ -23,13 +23,17 @@ component accessors="true" extends="BaseRenderer" {
*
* @tagString The tag string
*/
- private function determineSlug( required tagString ){
+ private function determineSlug( required tagString ) {
var slug = reReplaceNoCase(
arguments.tagString,
"(page|entry|pagessl|entryssl)\:\[",
""
);
- return reReplaceNoCase( slug, "\]$", "" );
+ return reReplaceNoCase(
+ slug,
+ "\]$",
+ ""
+ );
}
/**
@@ -38,26 +42,45 @@ component accessors="true" extends="BaseRenderer" {
* @builder java.lang.StringBuilder that contains all the content to manipulate
* @content The content object that requested translation
*/
- private function translateContent( required builder, required content ){
+ private function translateContent( required builder, required content ) {
// our mustaches pattern
- var regex = "(page|pagessl|entry|entryssl|root)\:\[[^\]]*]";
+ var regex = "(page|pagessl|entry|entryssl|root)\:\[[^\]]*]";
// match contentbox links in our incoming builder and build our targets array and len
- var targets = reMatchNoCase( regex, builder.toString() );
- var targetLen = arrayLen( targets );
- var tagString = "";
+ var targets = reMatchNoCase( regex, builder.toString() );
+ var targetLen = arrayLen( targets );
+ var tagString = "";
var linkContent = "";
// Loop over found links
- for ( var x = 1; x lte targetLen; x++ ) {
+ for ( var x = 1; x LTE targetLen; x++ ) {
tagString = targets[ x ];
// convert quotes to standards
- tagString = replace( tagString, "#34;", """", "all" );
- tagString = replace( tagString, "#39;", "'", "all" );
- tagString = replace( tagString, """, "'", "all" );
+ tagString = replace(
+ tagString,
+ "#34;",
+ """",
+ "all"
+ );
+ tagString = replace(
+ tagString,
+ "#39;",
+ "'",
+ "all"
+ );
+ tagString = replace(
+ tagString,
+ """,
+ "'",
+ "all"
+ );
try {
- var linkType = getToken( tagString, 1, ":" );
+ var linkType = getToken(
+ tagString,
+ 1,
+ ":"
+ );
switch ( linkType ) {
case "page": {
linkContent = cb.linkPage( page = determineSlug( tagString ) );
@@ -80,7 +103,7 @@ component accessors="true" extends="BaseRenderer" {
break;
}
}
- } catch ( Any e ) {
+ } catch (Any e) {
linkContent = "Error translating link: #e.message# #e.detail#";
log.error( "Error translating link on target: #targets[ x ]#", e );
}
@@ -94,4 +117,4 @@ component accessors="true" extends="BaseRenderer" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc b/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc
index 6d4e462e1b..f414eaaf46 100644
--- a/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc
+++ b/modules/contentbox/models/content/renderers/MarkdownRenderer.cfc
@@ -8,37 +8,53 @@
* @author Luis Majano
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="cb" inject="id:CBHelper@contentbox";
- property name="markdown" inject="Processor@cbmarkdown";
+ property name="markdown" inject="Processor@cbmarkdown";
// MARKUP EDITOR
variables.MARKDOWN_EDITOR = "Markdown";
/**
* Execute on content translations for pages and blog entries
*/
- void function cb_onContentRendering( any event, struct data ){
+ void function cb_onContentRendering( any event, struct data ) {
// If no markup, then maybe a direct convent version conversion.
if ( !structKeyExists( arguments.data.content, "getMarkup" ) ) {
return;
}
- var thisMarkup = arguments.data.content.getMarkup();
+ var thisMarkup = arguments
+ .data
+ .content
+ .getMarkup();
// Markdown
- if ( !isNull( thisMarkup ) and thisMarkup eq variables.MARKDOWN_EDITOR ) {
+ if ( !isNull( thisMarkup ) && thisMarkup EQ variables.MARKDOWN_EDITOR ) {
// convert markup to HTML
- var results = variables.markdown.toHTML( arguments.data.builder.toString() );
+ var results = variables.markdown.toHTML( arguments
+ .data
+ .builder
+ .toString() );
// Replace builder with new content
- arguments.data.builder.replace(
- javacast( "int", 0 ),
- arguments.data.builder.length(),
- results
- );
+ arguments
+ .data
+ .builder
+ .replace(
+ javacast( "int", 0 ),
+ arguments
+ .data
+ .builder
+ .length(),
+ 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()#"
+ );
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/renderers/SettingRenderer.cfc b/modules/contentbox/models/content/renderers/SettingRenderer.cfc
index a23f1d0796..fd9ccddfdd 100755
--- a/modules/contentbox/models/content/renderers/SettingRenderer.cfc
+++ b/modules/contentbox/models/content/renderers/SettingRenderer.cfc
@@ -9,16 +9,16 @@
*
* You can escape this notation by surrounding them with our tags
*/
-component accessors="true" extends="BaseRenderer" {
-
+component accessors="true" extends ="BaseRenderer" {
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="cbResourceService" inject="resourceService@cbi18n";
/**
* Execute on content translations for pages and blog entries
*/
- void function cb_onContentRendering( required event, struct data = {} ){
+ void function cb_onContentRendering( required event, struct data = {} ) {
translateContent(
builder = arguments.data.builder,
content = arguments.data.content,
@@ -37,7 +37,7 @@ component accessors="true" extends="BaseRenderer" {
required builder,
required content,
required event
- ){
+ ) {
// Escape values for non-rendering
multiStringReplace(
builder = arguments.builder,
@@ -46,45 +46,47 @@ component accessors="true" extends="BaseRenderer" {
);
// our mustaches pattern
- var regex = "(?!\)\$\{([^\}])+\}(?!\<\/escape\>)";
+ var regex = "(?!\)\$\{([^\}])+\}(?!\<\/escape\>)";
// match contentbox settings: ${setting} except surrounded by escape tags
- var targets = reMatchNoCase( regex, builder.toString() );
- var targetLen = arrayLen( targets );
+ var targets = reMatchNoCase( regex, builder.toString() );
+ var targetLen = arrayLen( targets );
var thisSetting = "";
- var thisValue = "";
+ var thisValue = "";
// Loop over found variables to build target + settings
- for ( var x = 1; x lte targetLen; x++ ) {
+ for ( var x = 1; x LTE targetLen; x++ ) {
try {
// get the setting defined in ${}
- thisSetting = mid( targets[ x ], 3, len( targets[ x ] ) - 3 );
+ thisSetting = mid(
+ targets[ x ],
+ 3,
+ len( targets[ x ] ) - 3
+ );
// Do we have rc or prc prefix?
if ( reFindNoCase( "^p?rc\:", thisSetting ) ) {
thisValue = event.getValue(
- name = listLast( thisSetting, ":" ),
- private = ( listFirst( thisSetting, ":" ) eq "rc" ? false : true )
- );
- }
- // Do we have i18n?
- else if ( reFindNoCase( "^i18n\:", thisSetting ) ) {
+ name = listLast( thisSetting, ":" ),
+ private = ( listFirst( thisSetting, ":" ) EQ "rc" ? false : true )
+ );
+ } else if ( reFindNoCase( "^i18n\:", thisSetting ) ) {
+ // Do we have i18n?
var resource = listLast( thisSetting, ":" );
- var bundle = "default";
+ var bundle = "default";
// check for resource@bundle convention:
if ( find( "@", resource ) ) {
- bundle = listLast( resource, "@" );
+ bundle = listLast( resource, "@" );
resource = listFirst( resource, "@" );
}
thisValue = variables.cbResourceService.getResource( resource = resource, bundle = bundle );
- }
- // Normal Setting
- else {
+ } else {
+ // Normal Setting
thisValue = settingService.getSetting(
- name = thisSetting,
- defaultValue = "${Setting: #thisSetting# not found}"
- );
+ name = thisSetting,
+ defaultValue = "${Setting: #thisSetting# not found}"
+ );
}
- } catch ( Any e ) {
+ } catch (Any e) {
thisValue = "Error translating setting on target #thisSetting#: #e.message# #e.detail#";
log.error( "Error translating setting on target: #thisSetting#", e );
}
@@ -98,4 +100,4 @@ component accessors="true" extends="BaseRenderer" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/renderers/WidgetRenderer.cfc b/modules/contentbox/models/content/renderers/WidgetRenderer.cfc
index 1c268ebb42..83e375212e 100755
--- a/modules/contentbox/models/content/renderers/WidgetRenderer.cfc
+++ b/modules/contentbox/models/content/renderers/WidgetRenderer.cfc
@@ -5,15 +5,14 @@
* ---
* A content renderer that transforms {{{}}} into widget executions
*/
-component accessors="true" extends="BaseRenderer" {
-
+component accessors="true" extends ="BaseRenderer" {
// DI
property name="widgetService" inject="id:widgetService@contentbox";
/**
* Execute on content translations for pages and blog entries
*/
- void function cb_onContentRendering( event, struct data ){
+ void function cb_onContentRendering( event, struct data ) {
translateContent(
builder = arguments.data.builder,
content = arguments.data.content,
@@ -27,7 +26,7 @@ component accessors="true" extends="BaseRenderer" {
* @builder java.lang.StringBuilder that contains all the content to manipulate
* @content The content object that requested translation
*/
- private function translateContent( required builder, content ){
+ private function translateContent( required builder, content ) {
parseTagWidgets( argumentCollection = arguments );
parseTripleMustacheWidgets( argumentCollection = arguments );
}
@@ -38,65 +37,88 @@ component accessors="true" extends="BaseRenderer" {
* @builder java.lang.StringBuilder that contains all the content to manipulate
* @content The content object that requested translation
*/
- private void function parseTagWidgets( required builder, required content ){
+ private void function parseTagWidgets( required builder, required content ) {
// widget tag syntax
- var regex = "]*>(.*?) ";
+ var regex = "]*>(.*?) ";
// match widgets in our incoming builder and build our targets array and len
- var targets = reMatchNoCase( regex, builder.toString() );
+ var targets = reMatchNoCase( regex, builder.toString() );
var targetLen = arrayLen( targets );
// Loop over found tags
- for ( var x = 1; x lte targetLen; x++ ) {
+ for ( var x = 1; x LTE targetLen; x++ ) {
var tagAttributes = xmlParse( targets[ x ] ).widget.XmlAttributes;
try {
- var widgetName = tagAttributes.widgetname;
- var widgetType = tagAttributes.widgettype;
- var widgetUDF = structKeyExists( tagAttributes, "widgetUDF" ) ? tagAttributes.widgetUDF : "renderIt";
+ var widgetName = tagAttributes.widgetname;
+ var widgetType = tagAttributes.widgettype;
+ var widgetUDF = structKeyExists( tagAttributes, "widgetUDF" ) ? tagAttributes.widgetUDF : "renderIt";
var isModuleWidget = widgetType == "Module";
- var isThemeWidget = widgetType == "Theme";
+ var isThemeWidget = widgetType == "Theme";
// Widget Executions
- var oWidget = "";
+ var oWidget = "";
var oWidgetMethod = "";
var widgetContent = "";
// Detect Widget and Method Calls
if ( find( ".", widgetName ) ) {
- oWidget = widgetService.getWidget( "#getToken( widgetName, 1, "." )#" );
- oWidgetMethod = getToken( widgetName, 2, "." );
+ oWidget = widgetService.getWidget(
+ "#getToken(
+ widgetName,
+ 1,
+ "."
+ )#"
+ );
+ oWidgetMethod = getToken(
+ widgetName,
+ 2,
+ "."
+ );
} else if ( isModuleWidget ) {
// Render out the module widget
- oWidget = widgetService.getWidget( name = widgetName, type = "module" );
+ oWidget = widgetService.getWidget( name = widgetName, type = "module" );
oWidgetMethod = widgetUDF;
} else if ( isThemeWidget ) {
// Render out the theme widget
- oWidget = widgetService.getWidget( name = widgetName, type = "theme" );
+ oWidget = widgetService.getWidget( name = widgetName, type = "theme" );
oWidgetMethod = widgetUDF;
} else {
oWidget = widgetService.getWidget(
- name = widgetName,
- type = widgetService.discoverWidgetType( widgetName )
- );
+ name = widgetName,
+ type = widgetService.discoverWidgetType( widgetName )
+ );
oWidgetMethod = widgetUDF;
}
// 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 )" );
+ if (
+ server.keyExists( "lucee" ) &&
+ server
+ .lucee
+ .version
+ .getToken( 1, "." ) ==
+ 4
+ ) {
+ widgetContent = evaluate(
+ "oWidget.#oWidgetMethod#( argumentCollection=tagAttributes )"
+ );
} else {
// Render out the widgets
- widgetContent = invoke( oWidget, oWidgetMethod, tagAttributes );
+ widgetContent = invoke(
+ oWidget,
+ oWidgetMethod,
+ tagAttributes
+ );
}
// Verify null widgetContent
if ( isNull( widgetContent ) ) {
log.warn(
- "Widget: #widgetName# produce no content in page #arguments.content.getTitle()#",
- tagAttributes
- );
+ "Widget: #widgetName# produce no content in page #arguments.content.getTitle()#",
+ tagAttributes
+ );
widgetContent = "";
}
- } catch ( Any e ) {
+ } catch (Any e) {
widgetContent = "Error translating tag widget: #e.message#";
if ( len( e.detail ) ) {
@@ -107,7 +129,10 @@ component accessors="true" extends="BaseRenderer" {
widgetContent &= "StackTrace: #e.stacktrace# ";
}
- log.error( "Error translating tag widget on target: #targets[ x ]#", e );
+ log.error(
+ "Error translating tag widget on target: #targets[ x ]#",
+ e
+ );
}
// PROCESS REPLACING
@@ -125,7 +150,7 @@ component accessors="true" extends="BaseRenderer" {
* @builder java.lang.StringBuilder that contains all the content to manipulate
* @content The content object that requested translation
*/
- private void function parseTripleMustacheWidgets( required builder, required content ){
+ private void function parseTripleMustacheWidgets( required builder, required content ) {
// Escape values for non-rendering
multiStringReplace(
builder = arguments.builder,
@@ -134,56 +159,107 @@ component accessors="true" extends="BaseRenderer" {
);
// our mustaches pattern
- var regex = "(?!\<\/escape\>)\{\{\{[^\}]*\}\}\}(?!\<\/escape\>)";
+ var regex = "(?!\<\/escape\>)\{\{\{[^\}]*\}\}\}(?!\<\/escape\>)";
// match widgets in our incoming builder and build our targets array and len
- var targets = reMatch( regex, builder.toString() );
- var targetLen = arrayLen( targets );
+ var targets = reMatch( regex, builder.toString() );
+ var targetLen = arrayLen( targets );
var moduleName = "";
// Loop over found mustaches {{{Widget}}}
- for ( var x = 1; x lte targetLen; x++ ) {
+ for ( var x = 1; x LTE targetLen; x++ ) {
// convert mustache to tag
- var tagString = replace( targets[ x ], "{{{", "<" );
- tagString = replace( tagString, "}}}", "/>" );
+ var tagString = replace(
+ targets[ x ],
+ "{{{",
+ "<"
+ );
+ tagString = replace(
+ tagString,
+ "}}}",
+ "/>"
+ );
// convert quotes to standards
- tagString = replace( tagString, "#34;", """", "all" );
- tagString = replace( tagString, "#39;", "'", "all" );
- tagString = replace( tagString, """, "'", "all" );
+ tagString = replace(
+ tagString,
+ "#34;",
+ """",
+ "all"
+ );
+ tagString = replace(
+ tagString,
+ "#39;",
+ "'",
+ "all"
+ );
+ tagString = replace(
+ tagString,
+ """,
+ "'",
+ "all"
+ );
try {
// Parse : separator from method to first argument
if ( reFindNoCase( "\<[^\>\=\:\s]+\:", tagString ) ) {
- tagString = replace( tagString, ":", " " );
+ tagString = replace(
+ tagString,
+ ":",
+ " "
+ );
}
// Parse arguments separated by commas
- tagString = replace( tagString, "',", "' ", "all" );
- tagString = replace( tagString, """,", """ ", "all" );
+ tagString = replace(
+ tagString,
+ "',",
+ "' ",
+ "all"
+ );
+ tagString = replace(
+ tagString,
+ """,",
+ """ ",
+ "all"
+ );
var isModuleWidget = findNoCase( "@", tagString ) ? true : false;
- var isThemeWidget = findNoCase( "~", tagString ) ? true : false;
+ var isThemeWidget = findNoCase( "~", tagString ) ? true : false;
if ( isModuleWidget ) {
var startPos = find( "@", tagString ) + 1;
// default end is last character of closing tag.
- var endPos = find( "/>", tagString );
+ var endPos = find( "/>", tagString );
var spacePos = find( " ", tagString );
// If we have arguments, then change this to first break position
if ( spacePos > 0 ) {
endPos = spacePos;
}
// Get module name now
- moduleName = mid( tagString, startPos, endPos - startPos );
+ moduleName = mid(
+ tagString,
+ startPos,
+ endPos - startPos
+ );
// clean the tag
- tagString = replaceNoCase( tagString, "@#moduleName#", "", "one" );
+ tagString = replaceNoCase(
+ tagString,
+ "@#moduleName#",
+ "",
+ "one"
+ );
}
if ( isThemeWidget ) {
- tagString = reReplace( tagString, "~", "", "one" );
+ tagString = reReplace(
+ tagString,
+ "~",
+ "",
+ "one"
+ );
}
// Parse it now as XML
- var tagXML = xmlParse( tagString );
+ var tagXML = xmlParse( tagString );
var widgetName = tagXML.XMLRoot.XMLName;
var widgetArgs = {};
@@ -200,50 +276,74 @@ component accessors="true" extends="BaseRenderer" {
}
// Widget Executions
- var oWidget = "";
+ var oWidget = "";
var oWidgetMethod = "";
var widgetContent = "";
// Detect direct method call
if ( find( ".", widgetName ) ) {
oWidget = widgetService.getWidget(
- name = "#getToken( widgetName, 1, "." )#",
- type = widgetService.discoverWidgetType( widgetName )
+ name = "#getToken(
+ widgetName,
+ 1,
+ "."
+ )#",
+ type = widgetService.discoverWidgetType( widgetName )
+ );
+ oWidgetMethod = getToken(
+ widgetName,
+ 2,
+ "."
);
- 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" );
+ oWidget = widgetService.getWidget( name = widgetName, type = "theme" );
oWidgetMethod = widgetArgs.widgetUDF;
} else {
oWidget = widgetService.getWidget(
- name = widgetName,
- type = widgetService.discoverWidgetType( widgetName )
- );
+ name = widgetName,
+ type = widgetService.discoverWidgetType( widgetName )
+ );
oWidgetMethod = widgetArgs.widgetUDF;
}
// 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 )" );
+ if (
+ server.keyExists( "lucee" ) &&
+ server
+ .lucee
+ .version
+ .getToken( 1, "." ) ==
+ 4
+ ) {
+ widgetContent = evaluate(
+ "oWidget.#oWidgetMethod#( argumentCollection=widgetArgs )"
+ );
} else {
// Render out the widgets
- widgetContent = invoke( oWidget, oWidgetMethod, widgetArgs );
+ widgetContent = invoke(
+ oWidget,
+ oWidgetMethod,
+ widgetArgs
+ );
}
// Verify null widgetContent
if ( isNull( widgetContent ) ) {
log.warn(
- "Widget: #widgetName# produce no content in page #arguments.content.getTitle()#",
- tagAttributes
- );
+ "Widget: #widgetName# produce no content in page #arguments.content.getTitle()#",
+ tagAttributes
+ );
widgetContent = "";
}
- } catch ( Any e ) {
+ } catch (Any e) {
widgetContent = "Error translating markup widget: #e.message# #e.detail# #e.stacktrace#";
- log.error( "Error translating markup widget on target: #targets[ x ]#", e );
+ log.error(
+ "Error translating markup widget on target: #targets[ x ]#",
+ e
+ );
}
// PROCESS REPLACING
@@ -255,4 +355,4 @@ component accessors="true" extends="BaseRenderer" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/content/util/ContentCacheCleanup.cfc b/modules/contentbox/models/content/util/ContentCacheCleanup.cfc
index 9129c5ec89..c17f38c2fd 100644
--- a/modules/contentbox/models/content/util/ContentCacheCleanup.cfc
+++ b/modules/contentbox/models/content/util/ContentCacheCleanup.cfc
@@ -1,11 +1,12 @@
-/**
+/**
* This interceptor monitors pages, posts and custom html content so it can purge caches on updates
*/
component extends="coldbox.system.Interceptor" {
-
// DI Injections
property name="settingService" inject="settingService@contentbox";
+
property name="commentService" inject="commentService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
/**
@@ -14,8 +15,12 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbui_onCommentPost( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbui_onCommentPost( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/**
@@ -24,15 +29,19 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_onCommentStatusUpdate( event, data ){
- variables.commentService
+ function cbadmin_onCommentStatusUpdate( event, data ) {
+ variables
+ .commentService
.getAll( arguments.data.commentID )
- .each( function( thisComment ){
- doCacheCleanup(
- arguments.thisComment.getRelatedContent().buildContentCacheCleanupKey(),
- arguments.thisComment.getRelatedContent()
- );
- } );
+ .each(
+ function( thisComment ) {
+ doCacheCleanup( arguments
+ .thisComment
+ .getRelatedContent()
+ .buildContentCacheCleanupKey(),
+ arguments.thisComment.getRelatedContent() );
+ }
+ );
}
/**
@@ -41,7 +50,7 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_preCommentRemove( event, data ){
+ function cbadmin_preCommentRemove( event, data ) {
var oComment = variables.commentService.get( arguments.data.commentID );
doCacheCleanup( oComment.getRelatedContent().buildContentCacheCleanupKey(), oComment.getRelatedContent() );
}
@@ -52,8 +61,12 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_postEntrySave( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbadmin_postEntrySave( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/**
@@ -62,8 +75,12 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_preEntryRemove( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbadmin_preEntryRemove( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/**
@@ -72,8 +89,12 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_postPageSave( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbadmin_postPageSave( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/**
@@ -82,8 +103,12 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_prePageRemove( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbadmin_prePageRemove( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/**
@@ -92,8 +117,12 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_postContentStoreSave( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbadmin_postContentStoreSave( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/**
@@ -102,12 +131,16 @@ component extends="coldbox.system.Interceptor" {
* @event The request context
* @data Intercept data
*/
- function cbadmin_preContentStoreRemove( event, data ){
- doCacheCleanup( arguments.data.content.buildContentCacheCleanupKey(), arguments.data.content );
+ function cbadmin_preContentStoreRemove( event, data ) {
+ doCacheCleanup( arguments
+ .data
+ .content
+ .buildContentCacheCleanupKey(),
+ arguments.data.content );
}
/*********************************************************************************************************/
- /* PRIVATE */
+ /* PRIVATE */
/*********************************************************************************************************/
/**
@@ -116,28 +149,32 @@ component extends="coldbox.system.Interceptor" {
* @cacheKey The cache key to use
* @content The content object
*/
- private function doCacheCleanup( required string cacheKey, any content ){
+ private function doCacheCleanup( required string cacheKey, any content ) {
// Log it
variables.log.info(
- "=> Starting content cache cleanup for : #arguments.content.getContentType()#:#arguments.cacheKey#..."
- );
+ "=> Starting content cache cleanup for : #arguments.content.getContentType()#:#arguments.cacheKey#..."
+ );
// Get settings
var settings = variables.settingService.getAllSettings();
// Get appropriate cache provider
- var cache = variables.cacheBox.getCache( settings.cb_content_cacheName );
+ var cache = variables.cacheBox.getCache( settings.cb_content_cacheName );
// clear content translation caches
cache.clearByKeySnippet( keySnippet = arguments.cacheKey, async = true );
// log it
- variables.log.info( "+ Cleared content translation caches for: #arguments.cacheKey#" );
+ 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
- variables.log.info( "+ Cleared content wrapper caches using wrapper key of: #wrapperKey#" );
+ variables.log.info(
+ "+ Cleared content wrapper caches using wrapper key of: #wrapperKey#"
+ );
// Clear category count caches
variables.contentService.clearAllCategoryCountCaches();
@@ -150,8 +187,8 @@ component extends="coldbox.system.Interceptor" {
variables.log.info( "+ Cleared all sitemap caches" );
variables.log.info(
- "=> Finalized cache content cleanup for #arguments.content.getContentType()#:#arguments.cacheKey#"
- );
+ "=> Finalized cache content cleanup for #arguments.content.getContentType()#:#arguments.cacheKey#"
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/exporters/BaseExporter.cfc b/modules/contentbox/models/exporters/BaseExporter.cfc
index 5bd7bcde0a..4650c574c0 100644
--- a/modules/contentbox/models/exporters/BaseExporter.cfc
+++ b/modules/contentbox/models/exporters/BaseExporter.cfc
@@ -5,8 +5,7 @@
* ---
* Base exporter class
*/
-component accessors=true {
-
+component accessors="#true#" {
// DI
property name="log" inject="logbox:logger:{this}";
@@ -40,16 +39,15 @@ component accessors=true {
*/
property name="allowedFormats";
-
/**
* Constructor
*/
- function init(){
+ function init() {
setFileName( createUUID() );
setFormat( "json" );
setPriority( 1 );
- variables.name = "";
+ variables.name = "";
variables.allowedFormats = "";
return this;
@@ -58,8 +56,8 @@ component accessors=true {
/**
* Determines if exporter is valid based on validation criteria
*/
- boolean function isValid(){
+ boolean function isValid() {
return !arrayLen( validate() );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/exporters/ContentBoxExporter.cfc b/modules/contentbox/models/exporters/ContentBoxExporter.cfc
index 7877adcc6a..319d1f2d67 100644
--- a/modules/contentbox/models/exporters/ContentBoxExporter.cfc
+++ b/modules/contentbox/models/exporters/ContentBoxExporter.cfc
@@ -5,8 +5,7 @@
* ---
* Export ContentBox data based on user selection. This is a transient object
*/
-component accessors=true {
-
+component accessors="#true#" {
/**
* The exporters to use
*/
@@ -29,35 +28,55 @@ component accessors=true {
// DI
property name="moduleSettings" inject="coldbox:setting:modules";
+
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="contentStoreService" inject="id:contentStoreService@contentbox";
+
property name="menuService" inject="id:menuService@contentbox";
+
property name="securityRuleService" inject="id:securityRuleService@contentbox";
+
property name="authorService" inject="id:authorService@contentbox";
+
property name="roleService" inject="id:roleService@contentbox";
+
property name="permissionService" inject="id:permissionService@contentbox";
+
property name="settingService" inject="id:settingService@contentbox";
+
property name="securityService" inject="id:securityService@contentbox";
+
property name="moduleService" inject="id:moduleService@contentbox";
+
property name="themeService" inject="id:themeService@contentbox";
+
property name="widgetService" inject="id:widgetService@contentbox";
+
property name="siteService" inject="id:siteService@contentbox";
+
property name="templateService" inject="id:emailtemplateService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="zipUtil" inject="zipUtil@contentbox";
+
property name="wirebox" inject="wirebox";
+
property name="HTMLHelper" inject="HTMLHelper@coldbox";
/**
* Constructor
*/
- ContentBoxExporter function init(){
- variables.exporters = [];
- variables.descriptor = {};
+ ContentBoxExporter function init() {
+ variables.exporters = [];
+ variables.descriptor = {};
variables.dataServiceMappings = {};
- variables.filePathMappings = {};
+ variables.filePathMappings = {};
return this;
}
@@ -65,126 +84,126 @@ component accessors=true {
/**
* On DI Complete
*/
- function onDIComplete(){
+ function onDIComplete() {
var contentBoxPath = variables.moduleSettings[ "contentbox" ].path;
- var customPath = variables.moduleSettings[ "contentbox-custom" ].path;
+ var customPath = variables.moduleSettings[ "contentbox-custom" ].path;
variables.dataServiceMappings = {
- "authors" : {
- fileName : "authors",
- service : "authorService",
- displayName : "Authors",
- priority : 3
+ "authors": {
+ fileName : "authors",
+ service : "authorService",
+ displayName: "Authors",
+ priority : 3
},
- "categories" : {
- fileName : "categories",
- service : "categoryService",
- displayName : "Categories",
- priority : 1
+ "categories": {
+ fileName : "categories",
+ service : "categoryService",
+ displayName: "Categories",
+ priority : 1
},
- "contentstore" : {
- fileName : "contentstore",
- service : "contentStoreService",
- displayName : "Content Store",
- priority : 4
+ "contentstore": {
+ fileName : "contentstore",
+ service : "contentStoreService",
+ displayName: "Content Store",
+ priority : 4
},
- "entries" : {
- fileName : "entries",
- service : "entryService",
- displayName : "Entries",
- priority : 4
+ "entries": {
+ fileName : "entries",
+ service : "entryService",
+ displayName: "Entries",
+ priority : 4
},
- "menus" : {
- fileName : "menus",
- service : "menuService",
- displayName : "Menus",
- priority : 5
+ "menus": {
+ fileName : "menus",
+ service : "menuService",
+ displayName: "Menus",
+ priority : 5
},
- "pages" : {
- fileName : "pages",
- service : "pageService",
- displayName : "Pages",
- priority : 4
+ "pages": {
+ fileName : "pages",
+ service : "pageService",
+ displayName: "Pages",
+ priority : 4
},
- "permissions" : {
- fileName : "permissions",
- service : "permissionService",
- displayName : "Permissions",
- priority : 1
+ "permissions": {
+ fileName : "permissions",
+ service : "permissionService",
+ displayName: "Permissions",
+ priority : 1
},
- "permissionGroups" : {
- fileName : "permissionGroups",
- service : "permissionGroupService",
- displayName : "Permission Groups",
- priority : 2
+ "permissionGroups": {
+ fileName : "permissionGroups",
+ service : "permissionGroupService",
+ displayName: "Permission Groups",
+ priority : 2
},
- "roles" : {
- fileName : "roles",
- service : "roleService",
- displayName : "Roles",
- priority : 2
+ "roles": {
+ fileName : "roles",
+ service : "roleService",
+ displayName: "Roles",
+ priority : 2
},
- "securityrules" : {
- fileName : "securityrules",
- service : "securityRuleService",
- displayName : "Security Rules",
- priority : 1
+ "securityrules": {
+ fileName : "securityrules",
+ service : "securityRuleService",
+ displayName: "Security Rules",
+ priority : 1
},
- "settings" : {
- fileName : "settings",
- service : "settingService",
- displayName : "Settings",
- priority : 1
+ "settings": {
+ fileName : "settings",
+ service : "settingService",
+ displayName: "Settings",
+ priority : 1
},
- "sites" : {
- fileName : "site",
- service : "siteService",
- displayName : "Site",
- priority : 1
+ "sites": {
+ fileName : "site",
+ service : "siteService",
+ displayName: "Site",
+ priority : 1
}
};
variables.filePathMappings = {
- "emailtemplates" : {
- fileName : "emailtemplates",
- displayName : "Email Templates",
- directory : contentBoxPath & "/email_templates",
- type : "template",
- extension : "",
- priority : 1
+ "emailtemplates": {
+ fileName : "emailtemplates",
+ displayName: "Email Templates",
+ directory : contentBoxPath & "/email_templates",
+ type : "template",
+ extension : "",
+ priority : 1
},
- "medialibrary" : {
- fileName : "medialibrary",
- displayName : "Media Library",
- directory : expandPath( variables.settingService.getSetting( "cb_media_directoryRoot" ) ),
- includeFiles : "*",
- type : "folder",
- extension : "",
- priority : 1
- },
- "modules" : {
- fileName : "modules",
- displayName : "Modules",
- directory : customPath & "/_modules",
+ "medialibrary": {
+ fileName : "medialibrary",
+ displayName : "Media Library",
+ directory : expandPath( variables.settingService.getSetting( "cb_media_directoryRoot" ) ),
+ includeFiles: "*",
type : "folder",
extension : "",
priority : 1
},
- "themes" : {
- fileName : "themes",
- displayName : "Themes",
- directory : customPath & "/_themes",
- type : "folder",
- extension : "",
- priority : 1
+ "modules": {
+ fileName : "modules",
+ displayName: "Modules",
+ directory : customPath & "/_modules",
+ type : "folder",
+ extension : "",
+ priority : 1
},
- "widgets" : {
- fileName : "widgets",
- displayName : "Widgets",
- directory : customPath & "/_widgets",
- type : "component",
- extension : ".cfc",
- priority : 1
+ "themes": {
+ fileName : "themes",
+ displayName: "Themes",
+ directory : customPath & "/_themes",
+ type : "folder",
+ extension : "",
+ priority : 1
+ },
+ "widgets": {
+ fileName : "widgets",
+ displayName: "Widgets",
+ directory : customPath & "/_widgets",
+ type : "component",
+ extension : ".cfc",
+ priority : 1
}
};
}
@@ -194,7 +213,7 @@ component accessors=true {
*
* @targets The struct of targets to prepare for export
*/
- ContentBoxExporter function setup( required struct targets ){
+ ContentBoxExporter function setup( required struct targets ) {
// loop over targets and build up exporters
for ( var key in arguments.targets ) {
// find config data struct for the given key
@@ -213,15 +232,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
+ // 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 );
@@ -231,7 +250,6 @@ component accessors=true {
// set included files dynamically from arguments
exporter.setIncludeFiles( includedFiles );
break;
- // add exporter
}
addExporter( exporter );
@@ -247,7 +265,7 @@ component accessors=true {
*
* @return SiteExporterService
*/
- ContentBoxExporter function addExporter( required any exporter ){
+ ContentBoxExporter function addExporter( required any exporter ) {
arrayAppend( variables.exporters, arguments.exporter );
return this;
}
@@ -255,7 +273,7 @@ component accessors=true {
/**
* Gets the descriptor def for the export, it builds it first.
*/
- struct function getDescriptor(){
+ struct function getDescriptor() {
// build descriptor
return buildDescriptor();
}
@@ -263,10 +281,9 @@ component accessors=true {
/**
* Processes export!
*/
- struct function export(){
- var exportLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting ContentBox package export... "
- );
+ struct function export() {
+ var exportLog = createObject( "java",
+ "java.lang.StringBuilder" ).init( "Starting ContentBox package export... " );
// do some directory checking/creating
var tmpDirectory = getTempDirectory() & "cbexport";
if ( directoryExists( tmpDirectory ) ) {
@@ -286,17 +303,21 @@ component accessors=true {
var fileName = tmpDirectory & "/" & exporter.getFileName() & "." & exporter.getFormat();
// if all files, just grab directory
if ( exporter.getIncludeFiles() == "*" ) {
- exportLog.append( "Beginning export of all #exporter.getDisplayName()# " );
+ exportLog.append(
+ "Beginning export of all #exporter.getDisplayName()# "
+ );
zipUtil.addFiles(
- zipFilePath = fileName,
- directory = exporter.getDirectory(),
- recurse = true
- );
- exportLog.append( "Export of all #exporter.getDisplayName()# complete! " );
+ zipFilePath = fileName,
+ directory = exporter.getDirectory(),
+ recurse = true
+ );
+ exportLog.append(
+ "Export of all #exporter.getDisplayName()# complete! "
+ );
} else {
exportLog.append(
- "Beginning export of #exporter.getDisplayName()#: #exporter.getFileList()# "
- );
+ "Beginning export of #exporter.getDisplayName()#: #exporter.getFileList()# "
+ );
if ( exporter.getType() == "folder" ) {
var folders = listToArray( exporter.getFileList() );
var tmppath = tmpDirectory & "/tmp_" & exporter.getFileName();
@@ -313,18 +334,18 @@ component accessors=true {
}
// now add tmp to zip file
zipUtil.addFiles(
- zipFilePath = fileName,
- directory = tmppath,
- recurse = true
- );
+ zipFilePath = fileName,
+ directory = tmppath,
+ recurse = true
+ );
// finally, we can delete that now
directoryDelete( tmppath, true );
} else {
zipUtil.addFiles(
- zipFilePath = fileName,
- files = exporter.getFileList(),
- recurse = true
- );
+ zipFilePath = fileName,
+ files = exporter.getFileList(),
+ recurse = true
+ );
}
exportLog.append( "Export of #exporter.getDisplayName()# complete! " );
}
@@ -332,7 +353,10 @@ component accessors=true {
}
exportLog.append( "Creating package descriptor file " );
// add descriptor file
- fileWrite( tmpDirectory & "/descriptor.json", serializeJSON( getDescriptor() ) );
+ fileWrite(
+ tmpDirectory & "/descriptor.json",
+ serializeJSON( getDescriptor() )
+ );
exportLog.append( "Package descriptor complete! " );
// done! now we just need to compress the whole thing
@@ -340,16 +364,16 @@ component accessors=true {
var exportFile = tmpDirectory & "/cbsite.cbox";
zipUtil.addFiles(
- zipFilePath = exportFile,
- directory = tmpDirectory,
- recurse = true
- );
+ zipFilePath = exportFile,
+ directory = tmpDirectory,
+ recurse = true
+ );
exportLog.append( "ContentBox package export complete! " );
var flattendExportLog = exportLog.toString();
log.info( flattendExportLog );
- return { "exportfile" : exportFile, exportlog : flattendExportLog };
+ return { "exportfile": exportFile, exportlog: flattendExportLog };
}
/**
@@ -359,19 +383,19 @@ component accessors=true {
*
* @return Struct of { type : "data|file", def : data service mapping }
*/
- private struct function findConfig( required string key ){
+ private struct function findConfig( required string key ) {
var isData = structKeyExists( variables.dataServiceMappings, arguments.key );
var isFile = structKeyExists( variables.filePathMappings, arguments.key );
if ( isData ) {
return {
- "type" : "data",
- "def" : variables.dataServiceMappings[ arguments.key ]
+ "type": "data",
+ "def" : variables.dataServiceMappings[ arguments.key ]
};
}
if ( isFile ) {
return {
- "type" : "file",
- "def" : variables.filePathMappings[ arguments.key ]
+ "type": "file",
+ "def" : variables.filePathMappings[ arguments.key ]
};
}
return {};
@@ -380,30 +404,32 @@ component accessors=true {
/**
* Creates descriptor structure
*/
- private struct function buildDescriptor(){
+ private struct function buildDescriptor() {
var loggedInUser = variables.securityService.getAuthorSession();
- var descriptor = {};
+ var descriptor = {};
// set static descriptor values
descriptor[ "exportDate" ] = now();
descriptor[ "exportedBy" ] = "#loggedInUser.getFullName()# (#loggedInUser.getUsername()#)";
- descriptor[ "content" ] = {};
- descriptor[ "site" ] = variables.siteService.getCurrentWorkingSite().getMemento();
+ descriptor[ "content" ] = {};
+ descriptor[ "site" ] = variables
+ .siteService
+ .getCurrentWorkingSite()
+ .getMemento();
// add dynamic content
for ( var exporter in variables.exporters ) {
descriptor[ "content" ][ exporter.getFileName() ] = {
- "total" : exporter.getTotal(),
- "name" : exporter.getDisplayName(),
- "format" : exporter.getFormat(),
- "filename" : exporter.getFileName() & "." & exporter.getFormat(),
- "priority" : exporter.getPriority()
+ "total" : exporter.getTotal(),
+ "name" : exporter.getDisplayName(),
+ "format" : exporter.getFormat(),
+ "filename": exporter.getFileName() & "." & exporter.getFormat(),
+ "priority": exporter.getPriority()
};
}
setDescriptor( descriptor );
-
return descriptor;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/exporters/DataExporter.cfc b/modules/contentbox/models/exporters/DataExporter.cfc
index 3333059811..3904b4949e 100644
--- a/modules/contentbox/models/exporters/DataExporter.cfc
+++ b/modules/contentbox/models/exporters/DataExporter.cfc
@@ -5,12 +5,7 @@
* ---
* Exporter for Data-based content
*/
-component
- extends ="BaseExporter"
- implements="contentbox.models.exporters.ICBExporter"
- accessors =true
-{
-
+component extends ="BaseExporter" implements="contentbox.models.exporters.ICBExporter" accessors ="#true#" {
/**
* The records this exporter will export
*/
@@ -19,10 +14,10 @@ component
/**
* Constructor
*/
- DataExporter function init(){
+ DataExporter function init() {
super.init();
- variables.format = "json";
- variables.name = "DataExporter";
+ variables.format = "json";
+ variables.name = "DataExporter";
variables.allowedFormats = "json,xml";
return this;
}
@@ -30,7 +25,7 @@ component
/**
* Gets "total" based on content type
*/
- numeric function getTotal(){
+ numeric function getTotal() {
var total = 0;
if ( !isNull( variables.content ) ) {
if ( isArray( variables.content ) ) {
@@ -49,7 +44,7 @@ component
/**
* Custom validator for this exporter...any rules can be applied
*/
- array function validate(){
+ array function validate() {
var errors = [];
if ( isNull( getContent() ) || isSimpleValue( getContent() ) ) {
arrayAppend( errors, "The data exporter does not contain any content!" );
@@ -61,9 +56,12 @@ component
);
}
if ( isNull( getFileName() ) || !len( getFileName() ) ) {
- arrayAppend( errors, "A valid file name for the export must be specified!" );
+ arrayAppend(
+ errors,
+ "A valid file name for the export must be specified!"
+ );
}
return errors;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/exporters/FileExporter.cfc b/modules/contentbox/models/exporters/FileExporter.cfc
index db3207ae92..7de7f6055e 100644
--- a/modules/contentbox/models/exporters/FileExporter.cfc
+++ b/modules/contentbox/models/exporters/FileExporter.cfc
@@ -5,21 +5,19 @@
* ---
* Exporter for file-based content
*/
-component
- extends ="BaseExporter"
- implements="contentbox.models.exporters.ICBExporter"
- accessors =true
-{
-
+component extends ="BaseExporter" implements="contentbox.models.exporters.ICBExporter" accessors ="#true#" {
property name="directory" type="string";
+
property name="includeFiles" type="string";
+
property name="type" type="string";
+
property name="extension" type="string";
/**
* Constructor
*/
- public FileExporter function init(){
+ public FileExporter function init() {
super.init();
setFormat( "zip" );
@@ -27,7 +25,7 @@ component
setType( "component" );
setExtension( "" );
- variables.name = "FileExporter";
+ variables.name = "FileExporter";
variables.allowedFormats = "zip";
return this;
@@ -36,10 +34,16 @@ component
/**
* Gets "total" based on content type
*/
- public numeric function getTotal(){
+ public numeric function getTotal() {
var total = 0;
if ( getIncludeFiles() == "*" ) {
- total = arrayLen( directoryList( getDirectory(), true, "name" ) );
+ total = arrayLen(
+ directoryList(
+ getDirectory(),
+ true,
+ "name"
+ )
+ );
} else {
total = listLen( getIncludeFiles() );
}
@@ -49,10 +53,13 @@ component
/**
* Custom validator for this exporter...any rules can be applied
*/
- public array function validate(){
+ public array function validate() {
var errors = [];
if ( isNull( getDirectory() ) ) {
- arrayAppend( errors, "The files exporter does not have a configured directory!" );
+ arrayAppend(
+ errors,
+ "The files exporter does not have a configured directory!"
+ );
}
if ( !listFindNoCase( variables.allowedFormats, getFormat() ) ) {
arrayAppend(
@@ -61,7 +68,10 @@ component
);
}
if ( isNull( getFileName() ) || !len( getFileName() ) ) {
- arrayAppend( errors, "A valid file name for the export must be specified!" );
+ arrayAppend(
+ errors,
+ "A valid file name for the export must be specified!"
+ );
}
return errors;
}
@@ -69,15 +79,19 @@ component
/**
* Gets list of files (absolute paths) when not "all" options are chosen for export
*/
- public string function getFileList(){
- var files = "";
+ public string function getFileList() {
+ var files = "";
var delimiter = type == "folder" ? "," : chr( 124 );
for ( var i = 1; i <= listLen( getIncludeFiles() ); i++ ) {
var includeFile = listGetAt( getIncludeFiles(), i );
- var fileName = getDirectory() & "/" & includeFile & getExtension();
- files = listAppend( files, fileName, delimiter );
+ var fileName = getDirectory() & "/" & includeFile & getExtension();
+ files = listAppend(
+ files,
+ fileName,
+ delimiter
+ );
}
return files;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/exporters/ICBExporter.cfc b/modules/contentbox/models/exporters/ICBExporter.cfc
index 379b342e16..a3154e14af 100644
--- a/modules/contentbox/models/exporters/ICBExporter.cfc
+++ b/modules/contentbox/models/exporters/ICBExporter.cfc
@@ -21,5 +21,4 @@ interface {
* Gets "total" based on content type
*/
public numeric function getTotal();
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/exporters/StaticExporter.cfc b/modules/contentbox/models/exporters/StaticExporter.cfc
index c3addfc606..e6ccb7adc5 100644
--- a/modules/contentbox/models/exporters/StaticExporter.cfc
+++ b/modules/contentbox/models/exporters/StaticExporter.cfc
@@ -5,24 +5,32 @@
* ---
* Static content exporter service
*/
-component accessors=true threadSafe singleton {
-
+component accessors="#true#" threadSafe singleton {
// DI
property name="settingService" inject="SettingService@contentbox";
+
property name="pageService" inject="PageService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="entryService" inject="entryService@contentbox";
+
property name="themeService" inject="ThemeService@contentbox";
+
property name="categoryService" inject="CategoryService@contentbox";
+
property name="uiConfig" inject="coldbox:moduleconfig:contentbox-ui";
+
property name="interceptorService" inject="coldbox:interceptorService";
+
property name="zipUtil" inject="zipUtil@contentbox";
+
property name="Renderer" inject="Provider:Renderer@coldbox";
/**
* Constructor
*/
- function init(){
+ function init() {
return this;
}
@@ -47,14 +55,14 @@ component accessors=true threadSafe singleton {
required rc,
required prc,
required site
- ){
- var lb = chr( 13 ) & chr( 10 );
+ ) {
+ var lb = chr( 13 ) & chr( 10 );
var results = {
- "exportLog" : createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting static site generation with the following options: #arguments.toString()#. #lb#"
- ),
- "exportDirectory" : arguments.exportDirectory,
- "exportFile" : getTempDirectory() & "/" & createUUID() & ".zip"
+ "exportLog": createObject( "java", "java.lang.StringBuilder" ).init(
+ "Starting static site generation with the following options: #arguments.toString()#. #lb#"
+ ),
+ "exportDirectory": arguments.exportDirectory,
+ "exportFile" : getTempDirectory() & "/" & createUUID() & ".zip"
};
var allSettings = variables.settingService.getAllSettings();
@@ -64,31 +72,37 @@ component accessors=true threadSafe singleton {
}
directoryCreate( arguments.exportDirectory );
- results.exportLog.append( "Created export directory: #arguments.exportDirectory# #lb#" );
+ results.exportLog.append(
+ "Created export directory: #arguments.exportDirectory# #lb#"
+ );
// ************ Prepare as if we are doing a UI request ******************
// store UI module root
- arguments.prc.cbRoot = getContextRoot() & arguments.event.getModuleRoot( "contentbox" );
+ arguments.prc.cbRoot = getContextRoot() & arguments.event.getModuleRoot( "contentbox" );
// store module entry point
- arguments.prc.cbEntryPoint = variables.uiConfig.entryPoint;
+ arguments.prc.cbEntryPoint = variables.uiConfig.entryPoint;
// Place global cb options on scope
- arguments.prc.cbSettings = allSettings;
+ arguments.prc.cbSettings = allSettings;
// Place the site to export
- arguments.prc.oCurrentSite = arguments.site;
+ arguments.prc.oCurrentSite = arguments.site;
// Place the default theme
- arguments.prc.cbTheme = arguments.prc.oCurrentSite.getActiveTheme();
+ arguments.prc.cbTheme = arguments
+ .prc
+ .oCurrentSite
+ .getActiveTheme();
// Place the default theme record
- arguments.prc.cbThemeRecord = variables.themeService.getThemeRecord( arguments.prc.cbTheme );
+ arguments.prc.cbThemeRecord = variables.themeService.getThemeRecord( arguments.prc.cbTheme );
// Place theme root location
- arguments.prc.cbthemeRoot = arguments.prc.cbRoot & "/themes/" & arguments.prc.cbTheme;
+ arguments.prc.cbthemeRoot = arguments.prc.cbRoot & "/themes/" & arguments.prc.cbTheme;
// Place widgets root location
- arguments.prc.cbWidgetRoot = arguments.prc.cbRoot & "/widgets";
+ arguments.prc.cbWidgetRoot = arguments.prc.cbRoot & "/widgets";
// Marker to tell layouts we are in static export mode
- arguments.prc.staticExport = true;
+ arguments.prc.staticExport = true;
// Current Site
- arguments.prc.cbSiteSettings = variables.settingService.getAllSiteSettings(
- arguments.prc.oCurrentSite.getSlug()
- );
+ arguments.prc.cbSiteSettings = variables.settingService.getAllSiteSettings( arguments
+ .prc
+ .oCurrentSite
+ .getSlug() );
/******************************************************************************/
@@ -100,7 +114,10 @@ component accessors=true threadSafe singleton {
);
// Copy over the theme
directoryCopy(
- arguments.prc.cbThemeRecord.path,
+ arguments
+ .prc
+ .cbThemeRecord
+ .path,
arguments.exportDirectory & "/__theme",
true
);
@@ -112,20 +129,21 @@ component accessors=true threadSafe singleton {
}
// Announce export
- interceptorService.announce( "cbadmin_preStaticSiteExport", { options : arguments } );
+ interceptorService.announce( "cbadmin_preStaticSiteExport", { options: arguments } );
// Get root pages, we need objects in order to render out the site
var aPages = variables.pageService.search(
- parent = "",
- siteID : arguments.site.getSiteID(),
- sortOrder= "order asc"
- );
+ parent = "",
+ siteID = arguments.site.getSiteID(),
+ sortOrder = "order asc"
+ );
// Process Homepage
- var oHomePage = variables.pageService.findBySlug(
- slug : arguments.prc.oCurrentSite.getHomepage(),
- siteID: arguments.site.getSiteID()
- );
+ var oHomePage = variables.pageService.findBySlug( slug = arguments
+ .prc
+ .oCurrentSite
+ .getHomepage(),
+ siteID = arguments.site.getSiteID() );
if ( !isNull( oHomePage ) && oHomepage.isLoaded() ) {
// put in scope for fake access
prc.page = oHomePage;
@@ -159,13 +177,14 @@ component accessors=true threadSafe singleton {
// Process blog entries
if ( arguments.includeBlog ) {
- var aEntries = variables.entryService.search( siteID: arguments.site.getSiteID() );
+ 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
- prc.entry = thisEntry;
+ prc.entry = thisEntry;
prc.comments = prc.entry.getComments();
// process it
processStaticEntry(
@@ -181,13 +200,16 @@ component accessors=true threadSafe singleton {
// zip archive
zipUtil.addFiles(
- zipFilePath = results.exportFile,
- directory = arguments.exportDirectory,
- recurse = true
- );
+ zipFilePath = results.exportFile,
+ directory = arguments.exportDirectory,
+ recurse = true
+ );
// 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 );
@@ -195,7 +217,7 @@ component accessors=true threadSafe singleton {
return results;
}
- /*************************************** PRIVATE *************************************** */
+ /*************************************** PRIVATE ****************************************/
/**
* Process a static entry export
@@ -214,8 +236,8 @@ component accessors=true threadSafe singleton {
required prc,
required exportDir,
required settings
- ){
- var allSettings = arguments.settings;
+ ) {
+ var allSettings = arguments.settings;
var outputContent = "";
// announce event
@@ -223,21 +245,35 @@ component accessors=true threadSafe singleton {
// Render out entry
arguments.event.setView(
- view = "#arguments.prc.cbTheme#/views/entry",
- module = arguments.prc.cbThemeRecord.module
- );
+ view = "#arguments.prc.cbTheme#/views/entry",
+ module = arguments
+ .prc
+ .cbThemeRecord
+ .module
+ );
outputContent = renderer.layout(
- layout = "#arguments.prc.cbTheme#/layouts/blog",
- module = arguments.prc.cbThemeRecord.module
- );
+ layout = "#arguments.prc.cbTheme#/layouts/blog",
+ module = arguments
+ .prc
+ .cbThemeRecord
+ .module
+ );
// ****** Content Conversions ******
// replace base tags
- outputContent = reReplaceNoCase( outputContent, " ]+?>", "", "all" );
+ outputContent = reReplaceNoCase(
+ outputContent,
+ " ]+?>",
+ "",
+ "all"
+ );
// replace local server addresses
outputContent = replaceNoCase(
outputContent,
- arguments.content.getSite().getSiteRoot(),
+ arguments
+ .content
+ .getSite()
+ .getSiteRoot(),
"/",
"all"
);
@@ -256,7 +292,7 @@ component accessors=true threadSafe singleton {
}
// Write it out
fileWrite( arguments.exportDir & "/" & arguments.content.getSlug() & "/index.html", outputContent );
- };
+ }
/**
* Process a static page export
@@ -277,35 +313,49 @@ component accessors=true threadSafe singleton {
required prc,
required exportDir,
required settings
- ){
- var allSettings = arguments.settings;
- var thisLayout = arguments.content.getLayoutWithInheritance();
+ ) {
+ var allSettings = arguments.settings;
+ var thisLayout = arguments.content.getLayoutWithInheritance();
var outputContent = "";
// announce event
interceptorService.announce( "cbui_preRequest" );
// Verify No Layout
- if ( thisLayout eq "-no-layout-" ) {
+ if ( thisLayout EQ "-no-layout-" ) {
outputContent = arguments.content.renderContent();
} else {
arguments.event.setView(
- view = "#arguments.prc.cbTheme#/views/page",
- module = arguments.prc.cbThemeRecord.module
- );
+ view = "#arguments.prc.cbTheme#/views/page",
+ module = arguments
+ .prc
+ .cbThemeRecord
+ .module
+ );
outputContent = renderer.layout(
- layout = "#arguments.prc.cbTheme#/layouts/#thisLayout#",
- module = arguments.prc.cbThemeRecord.module
- );
+ layout = "#arguments.prc.cbTheme#/layouts/#thisLayout#",
+ module = arguments
+ .prc
+ .cbThemeRecord
+ .module
+ );
}
// ****** Content Conversions ******
// replace base tags
- outputContent = reReplaceNoCase( outputContent, " ]+?>", "", "all" );
+ outputContent = reReplaceNoCase(
+ outputContent,
+ " ]+?>",
+ "",
+ "all"
+ );
// replace local server addresses
outputContent = replaceNoCase(
outputContent,
- arguments.content.getSite().getSiteRoot(),
+ arguments
+ .content
+ .getSite()
+ .getSiteRoot(),
"/",
"all"
);
@@ -346,6 +396,6 @@ component accessors=true threadSafe singleton {
);
}
}
- };
+ }
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/importers/BlogCFCImporter.cfc b/modules/contentbox/models/importers/BlogCFCImporter.cfc
index 89491aa3ae..da7c746e92 100644
--- a/modules/contentbox/models/importers/BlogCFCImporter.cfc
+++ b/modules/contentbox/models/importers/BlogCFCImporter.cfc
@@ -1,46 +1,56 @@
/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* Import a blogcfc database into contentbox
-*/
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * Import a blogcfc database into contentbox
+ */
component implements="contentbox.models.importers.ICBImporter" {
-
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="statsService" inject="id:statsService@contentbox";
+
property name="authorService" inject="id:authorService@contentbox";
+
property name="roleService" inject="id:roleService@contentbox";
+
property name="commentService" inject="id:commentService@contentbox";
+
property name="customFieldService" inject="id:customFieldService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="interceptorService" inject="coldbox:interceptorService";
+
property name="settingService" inject="id:settingService@contentbox";
+
property name="bCrypt" inject="BCrypt@BCrypt";
// ------------------------------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------------------------------
- blogcfcImporter function init(){
+ blogcfcImporter function init() {
return this;
}
@@ -53,12 +63,12 @@ component implements="contentbox.models.importers.ICBImporter" {
dsnPassword = "",
defaultPassword = "",
required roleID,
- tableprefix = ""
- ){
- var authorMap = {};
- var catMap = {};
- var entryMap = {};
- var slugMap = {};
+ tableprefix = ""
+ ) {
+ var authorMap = {};
+ var catMap = {};
+ var entryMap = {};
+ var slugMap = {};
var defaultAuthor = {};
log.info( "Starting import process: #arguments.toString()#" );
@@ -71,10 +81,10 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select categoryid, categoryname, categoryalias, blog FROM tblBlogCategories"
).execute().getResult();
- for ( var x = 1; x lte qCategories.recordcount; x++ ) {
+ for ( var x = 1; x LTE qCategories.recordcount; x++ ) {
var props = {
- category : qCategories.categoryName[ x ],
- slug : qCategories.categoryAlias[ x ]
+ category: qCategories.categoryName[ x ],
+ slug : qCategories.categoryAlias[ x ]
};
var cat = categoryService.new( properties = props );
entitySave( cat );
@@ -94,14 +104,14 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select username, password, name from tblUsers"
).execute().getResult();
- for ( var x = 1; x lte qAuthors.recordcount; x++ ) {
+ for ( var x = 1; x LTE qAuthors.recordcount; x++ ) {
var props = {
- email : qAuthors.username[ x ],
- username : qAuthors.username[ x ],
- password : bcrypt.hashPassword( defaultPassword ),
- isActive : 1,
- firstName : listFirst( qAuthors.name[ x ], " " ),
- lastName : trim(
+ email : qAuthors.username[ x ],
+ username : qAuthors.username[ x ],
+ password : bcrypt.hashPassword( defaultPassword ),
+ isActive : 1,
+ firstName: listFirst( qAuthors.name[ x ], " " ),
+ lastName : trim(
replaceNoCase(
qAuthors.name[ x ],
listFirst( qAuthors.name[ x ], " " ),
@@ -110,7 +120,7 @@ component implements="contentbox.models.importers.ICBImporter" {
)
};
- var author = authorService.findWhere( { username : qAuthors.username[ x ] } );
+ var author = authorService.findWhere( { username: qAuthors.username[ x ] } );
if ( isNull( author ) ) {
author = authorService.new( properties = props );
}
@@ -137,31 +147,31 @@ component implements="contentbox.models.importers.ICBImporter" {
sql = "select id, blog, title, alias, body from tblblogpages"
).execute().getResult();
- for ( var x = 1; x lte qPages.recordcount; x++ ) {
+ for ( var x = 1; x LTE qPages.recordcount; x++ ) {
var props = {
- title : qPages.title[ x ],
- slug : qPages.alias[ x ],
- content : qPages.body[ x ],
- publishedDate : now(),
- createdDate : now(),
- isPublished : true,
- allowComments : false,
- layout : "pages"
+ title : qPages.title[ x ],
+ slug : qPages.alias[ x ],
+ content : qPages.body[ x ],
+ publishedDate: now(),
+ createdDate : now(),
+ isPublished : true,
+ allowComments: false,
+ layout : "pages"
};
var page = pageService.new( properties = props );
// blogCFC has no concept of authored pages, so we grab the first author we find from blogCFC
// This may need revising later.
page.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = defaultAuthor
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = defaultAuthor
+ );
page.setCreator( defaultAuthor );
entitySave( page );
}
log.info( "Pages imported" );
- } catch ( any e ) {
+ } catch (any e) {
log.info( "Error Importing Pages - Version might support Pages" );
}
@@ -177,8 +187,8 @@ component implements="contentbox.models.importers.ICBImporter" {
from tblBlogEntries
"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
- var published = true;
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
+ var published = true;
var commentStatus = true;
if ( !trim( q.released[ x ] ) ) {
published = false;
@@ -188,32 +198,31 @@ component implements="contentbox.models.importers.ICBImporter" {
}
var importedBody = q.Body[ x ] & q.moreBody[ x ];
- interceptorService.announce( "preImportEntry", { post : importedBody } );
+ interceptorService.announce( "preImportEntry", { post: importedBody } );
importedBody = findImages( importedBody );
importedBody = convertContent( importedBody );
- interceptorService.announce( "postImportEntry", { post : importedBody } );
+ interceptorService.announce( "postImportEntry", { post: importedBody } );
var props = {
- title : q.title[ x ],
- slug : q.alias[ x ],
- content : importedBody,
- excerpt : q.Body[ x ],
- publishedDate : q.posted[ x ],
- createdDate : q.posted[ x ],
- isPublished : published,
- allowComments : commentStatus,
- hits : q.views[ x ]
+ title : q.title[ x ],
+ slug : q.alias[ x ],
+ content : importedBody,
+ excerpt : q.Body[ x ],
+ publishedDate: q.posted[ x ],
+ createdDate : q.posted[ x ],
+ isPublished : published,
+ allowComments: commentStatus,
+ hits : q.views[ x ]
};
var entry = entryService.new( properties = props );
- var oStat = statsService.new( { hits : props.hits } );
+ var oStat = statsService.new( { hits: props.hits } );
oStat.setRelatedContent( entry );
- entry.setStats( oStat );
entry.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = authorService.get( authorMap[ q.username[ x ] ] )
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = authorService.get( authorMap[ q.username[ x ] ] )
+ );
entry.setCreator( authorService.get( authorMap[ q.username[ x ] ] ) );
// entry categories
@@ -231,11 +240,15 @@ component implements="contentbox.models.importers.ICBImporter" {
sql = thisSQL
).execute().getResult();
var aCategories = [];
- for ( var y = 1; y lte qCategories.recordcount; y++ ) {
- arrayAppend( aCategories, categoryService.get( catMap[ qCategories.categoryId[ y ] ] ) );
+ for ( var y = 1; y LTE qCategories.recordcount; y++ ) {
+ arrayAppend(
+ aCategories,
+ categoryService.get( catMap[ qCategories.categoryId[ y ] ] )
+ );
}
entry.setCategories( aCategories );
entitySave( entry );
+ statsService.save( oStat );
// Categories won't save in ContentBox Express without this flush :/
ormFlush();
@@ -249,15 +262,15 @@ component implements="contentbox.models.importers.ICBImporter" {
sql = "select * from tblBlogComments where entryidfk = '#q.id[ x ]#'"
).execute().getResult();
- for ( var y = 1; y lte qComments.recordcount; y++ ) {
+ for ( var y = 1; y LTE qComments.recordcount; y++ ) {
var props = {
- content : qComments.comment[ y ],
- author : qComments.name[ y ],
- authorEmail : qComments.email[ y ],
- createdDate : qComments.posted[ y ],
- authorIP : "127.0.0.1",
- isApproved : qComments.moderated[ y ],
- authorUrl : qComments.website[ y ]
+ content : qComments.comment[ y ],
+ author : qComments.name[ y ],
+ authorEmail: qComments.email[ y ],
+ createdDate: qComments.posted[ y ],
+ authorIP : "127.0.0.1",
+ isApproved : qComments.moderated[ y ],
+ authorUrl : qComments.website[ y ]
};
var comment = commentService.new( properties = props );
@@ -269,30 +282,28 @@ component implements="contentbox.models.importers.ICBImporter" {
log.info( "Entry imported: #entry.getTitle()#" );
}
log.info( "Entries imported successfully!" );
- } catch ( any e ) {
- transaction action="rollback" {
- }
+ } catch (any e) {
+ transaction action="rollback";
log.error( "Error importing blog: #e.message# #e.detail#", e );
rethrow;
}
- transaction action="commit" {
- }
+ transaction action="commit";
}
// ------------------------------------------------------------------------------------------------
// Convert blogCFC code blocks to a more uniform approach
// ------------------------------------------------------------------------------------------------
- private string function convertContent( required string content ){
- if ( findNoCase( "", arguments.content ) and findNoCase( "", arguments.content ) ) {
+ private string function convertContent( required string content ) {
+ if ( findNoCase( "", arguments.content ) && findNoCase( "", arguments.content ) ) {
var counter = findNoCase( "", arguments.content );
- while ( counter gte 1 ) {
+ while ( counter GTE 1 ) {
var codeblock = reFindNoCase(
"(?s)(.*)()(.*)()(.*)",
arguments.content,
1,
1
);
- if ( arrayLen( codeblock.len ) gte 6 ) {
+ if ( arrayLen( codeblock.len ) GTE 6 ) {
var codeportion = mid(
arguments.content,
codeblock.pos[ 4 ],
@@ -300,15 +311,23 @@ component implements="contentbox.models.importers.ICBImporter" {
);
if ( len( trim( codeportion ) ) ) {
var result = "[code]#codeportion#[/code]";
- result = htmlCodeFormat( result );
+ result = htmlCodeFormat( result );
}
- var newbody = mid( arguments.content, 1, codeblock.len[ 2 ] ) & result & mid(
+ var newbody = mid(
+ arguments.content,
+ 1,
+ codeblock.len[ 2 ]
+ ) & result & mid(
arguments.content,
codeblock.pos[ 6 ],
codeblock.len[ 6 ]
);
arguments.content = newBody;
- counter = findNoCase( "", arguments.content, counter );
+ counter = findNoCase(
+ "",
+ arguments.content,
+ counter
+ );
} else {
counter = 0;
}
@@ -320,13 +339,13 @@ 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 pattern = createObject( "java", "java.util.regex.Pattern" );
- var exp = "(?<=\=\"" )([^""])+(?=\"" )";
+ 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 pattern = createObject( "java", "java.util.regex.Pattern" );
+ var exp = "(?<=\=\"" )([^""])+(?=\"" )";
var mediaPath = expandPath( settingService.getSetting( "cb_media_directoryRoot" ) );
- var newUrl = "/__media/blogImages/";
+ var newUrl = "/__media/blogImages/";
// Create a directory in the Media Manager for all the blog entry images
if ( !directoryExists( mediaPath & "\blogImages" ) ) {
@@ -339,7 +358,7 @@ component implements="contentbox.models.importers.ICBImporter" {
for ( var item in images ) {
var matcher = pattern.compile( exp ).matcher( item );
while ( matcher.find() ) {
- var urlObj = matcher.group();
+ var urlObj = matcher.group();
var fileName = listLast( matcher.group(), "/" );
var httpService = new http();
@@ -349,7 +368,11 @@ 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
+ );
}
}
}
@@ -359,7 +382,7 @@ component implements="contentbox.models.importers.ICBImporter" {
for ( var item in images1 ) {
var matcher = pattern.compile( exp ).matcher( item );
while ( matcher.find() ) {
- var urlObj = matcher.group();
+ var urlObj = matcher.group();
var fileName = listLast( matcher.group(), "/" );
var httpService = new http();
@@ -369,7 +392,11 @@ 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
+ );
}
}
}
@@ -377,4 +404,4 @@ component implements="contentbox.models.importers.ICBImporter" {
return arguments.content;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/importers/ContentBoxImporter.cfc b/modules/contentbox/models/importers/ContentBoxImporter.cfc
index ea23c130fc..ed8241ec7a 100644
--- a/modules/contentbox/models/importers/ContentBoxImporter.cfc
+++ b/modules/contentbox/models/importers/ContentBoxImporter.cfc
@@ -5,20 +5,22 @@
* ---
* Import a .cbox package into ContentBOx
*/
-component accessors=true {
-
+component accessors="#true#" {
/**
* The import file names found
*/
property name="fileNames" type="array";
+
/**
* The location of the import file (zip|box)
*/
property name="ContentBoxPackagePath" type="any";
+
/**
* The location of the data services used for exporting
*/
property name="dataServiceMappings" type="struct";
+
/**
* The location of the file mappings used for exporting
*/
@@ -26,32 +28,49 @@ component accessors=true {
// DI
property name="moduleSettings" inject="coldbox:setting:modules";
+
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="contentStoreService" inject="id:contentStoreService@contentbox";
+
property name="menuService" inject="id:menuService@contentbox";
+
property name="securityRuleService" inject="id:securityRuleService@contentbox";
+
property name="authorService" inject="id:authorService@contentbox";
+
property name="roleService" inject="id:roleService@contentbox";
+
property name="permissionService" inject="id:permissionService@contentbox";
+
property name="settingService" inject="id:settingService@contentbox";
+
property name="securityService" inject="id:securityService@contentbox";
+
property name="moduleService" inject="id:moduleService@contentbox";
+
property name="themeService" inject="id:themeService@contentbox";
+
property name="widgetService" inject="id:widgetService@contentbox";
+
property name="templateService" inject="id:emailtemplateService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="zipUtil" inject="zipUtil@contentbox";
/**
* Constructor
*/
- ContentBoxImporter function init(){
- variables.fileNames = [];
+ ContentBoxImporter function init() {
+ variables.fileNames = [];
variables.contentBoxPackagePath = "";
- variables.dataServiceMappings = {};
- variables.fileServiceMappings = {};
+ variables.dataServiceMappings = {};
+ variables.fileServiceMappings = {};
return this;
}
@@ -60,15 +79,21 @@ component accessors=true {
*
* @importFile The uploaded .cbox package to import
*/
- public void function setup( required any importFile ){
+ 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 ) ).map( function( item ){
- return arguments.item.reReplace( "(\\|\/)", "", "all" );
- } );
+ 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;
+ var customPath = variables.moduleSettings[ "contentbox-custom" ].path;
// now set values
setFileNames( fileList );
@@ -76,45 +101,53 @@ component accessors=true {
// set some cheat mappings
variables.dataServiceMappings = {
- "Authors" : "authorService",
- "Categories" : "categoryService",
- "Content Store" : "contentStoreService",
- "Menus" : "menuService",
- "Permissions" : "permissionService",
- "Roles" : "roleService",
- "Security Rules" : "securityRuleService",
- "Settings" : "settingService",
- "Entries" : "entryService",
- "Pages" : "pageService"
+ "Authors" : "authorService",
+ "Categories" : "categoryService",
+ "Content Store" : "contentStoreService",
+ "Menus" : "menuService",
+ "Permissions" : "permissionService",
+ "Roles" : "roleService",
+ "Security Rules": "securityRuleService",
+ "Settings" : "settingService",
+ "Entries" : "entryService",
+ "Pages" : "pageService"
};
variables.filePathMappings = {
- "Email Templates" : contentBoxPath & "/email_templates",
- "Themes" : customPath & "/_themes",
- "Media Library" : expandPath( settingService.getSetting( "cb_media_directoryRoot" ) ),
- "Modules" : customPath & "/_modules",
- "Widgets" : customPath & "/_widgets"
+ "Email Templates": contentBoxPath & "/email_templates",
+ "Themes" : customPath & "/_themes",
+ "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 );
+ } catch (any e) {
+ log.error(
+ "Error processing ContentBox import package: #e.message# #e.detail#",
+ e
+ );
}
}
/**
* Retrieves contents of descriptor file
*/
- public any function getDescriptorContents( required boolean asObject = false ){
+ public any function getDescriptorContents( required boolean asObject = false ) {
var descriptorContents = "";
if ( hasFile( "descriptor.json" ) ) {
// if we have a descriptor, extract it
variables.zipUtil.extract(
- zipFilePath = getContentBoxPackagePath(),
- extractPath = getTempDirectory(),
- extractFiles = "descriptor.json",
- overwriteFiles = true
- );
+ zipFilePath = getContentBoxPackagePath(),
+ extractPath = getTempDirectory(),
+ extractFiles = "descriptor.json",
+ overwriteFiles = true
+ );
descriptorContents = fileRead( getTempDirectory() & "descriptor.json" );
- descriptorContents = replaceNoCase( descriptorContents, "null,", "0,", "all" );
+ descriptorContents = replaceNoCase(
+ descriptorContents,
+ "null,",
+ "0,",
+ "all"
+ );
}
return !arguments.asObject ? descriptorContents : deserializeJSON( descriptorContents );
}
@@ -124,8 +157,8 @@ component accessors=true {
*
* @importFile.hint The uploaded .cbox package
*/
- public boolean function isValid(){
- var isVerified = false;
+ public boolean function isValid() {
+ var isVerified = false;
var rawDescriptorContent = getDescriptorContents();
// if this is JSON data (as it is expected to be...), deserialize and start verifying package contents
if ( isJSON( rawDescriptorContent ) ) {
@@ -136,7 +169,9 @@ component accessors=true {
isVerified = hasFile( descriptorContent.content[ contentSection ].filename );
}
} else {
- log.error( "ContentBox package import not valid: #rawDescriptorContent#" );
+ log.error(
+ "ContentBox package import not valid: #rawDescriptorContent#"
+ );
}
return isVerified;
}
@@ -146,16 +181,16 @@ component accessors=true {
*
* @overrideContent.hint Whether or not to override existing content with uploaded data (default=false)
*/
- public string function execute( required boolean overrideContent = false ){
+ public string function execute( required boolean overrideContent = false ) {
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting ContentBox package import with override = #arguments.overrideContent#... "
- );
+ "Starting ContentBox package import with override = #arguments.overrideContent#... "
+ );
// first, unzip entire package
variables.zipUtil.extract(
- zipFilePath = getContentBoxPackagePath(),
- extractPath = getTempDirectory(),
- overwriteFiles = true
- );
+ zipFilePath = getContentBoxPackagePath(),
+ extractPath = getTempDirectory(),
+ overwriteFiles = true
+ );
// get all content
var descriptorContents = getDescriptorContents( true );
// Fix for null priorites, this should go away in later versions
@@ -176,16 +211,14 @@ component accessors=true {
// Start import transaction
transaction {
for ( key in priorityOrder ) {
- var content = descriptorContents.content[ key ];
+ var content = descriptorContents.content[ key ];
var filePath = getTempDirectory() & content.filename;
// handle json (data) imports
if ( content.format == "json" ) {
- var service = variables.dataServiceMappings[ content.name ];
- var importResults = variables[ service ].importFromFile(
- importFile = filePath,
- override = arguments.overrideContent
- );
+ var service = variables.dataServiceMappings[ content.name ];
+ var importResults = variables[ service ].importFromFile( importFile = filePath,
+ override = arguments.overrideContent );
importLog.append( importResults );
}
@@ -194,10 +227,10 @@ component accessors=true {
importLog.append( " Extracting #content.name#... " );
var path = variables.filePathMappings[ content.name ];
zipUtil.extract(
- zipFilePath = filePath,
- extractPath = path,
- overwriteFiles = true
- );
+ zipFilePath = filePath,
+ extractPath = path,
+ overwriteFiles = true
+ );
importLog.append( "Finished extracting #content.name#... " );
}
}
@@ -214,9 +247,9 @@ component accessors=true {
*
* @fileName.hint The file name to validate
*/
- private boolean function hasFile( required string fileName ){
+ private boolean function hasFile( required string fileName ) {
// try to find
return arrayContains( getFileNames(), arguments.fileName );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/importers/ICBImporter.cfc b/modules/contentbox/models/importers/ICBImporter.cfc
index 940eb9f281..a2631606af 100644
--- a/modules/contentbox/models/importers/ICBImporter.cfc
+++ b/modules/contentbox/models/importers/ICBImporter.cfc
@@ -1,27 +1,27 @@
-/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* This is the main importer for importing databases into contentbox
-*/
+/**
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * This is the main importer for importing databases into contentbox
+ */
interface {
function execute(
@@ -30,7 +30,6 @@ interface {
dsnPassword = "",
defaultPassword = "",
required roleID,
- tableprefix = ""
+ tableprefix = ""
);
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/importers/MachBlogImporter.cfc b/modules/contentbox/models/importers/MachBlogImporter.cfc
index efb738a66a..884bc470ac 100644
--- a/modules/contentbox/models/importers/MachBlogImporter.cfc
+++ b/modules/contentbox/models/importers/MachBlogImporter.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,24 +6,31 @@
* Import a MachBlog database into contentbox
*/
component implements="ICBImporter" {
-
// DI
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="authorService" inject="id:authorService@contentbox";
+
property name="roleService" inject="id:roleService@contentbox";
+
property name="commentService" inject="id:commentService@contentbox";
+
property name="customFieldService" inject="id:customFieldService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="htmlHelper" inject="HTMLHelper@coldbox";
- property name="bCrypt" inject="BCrypt@BCrypt";
+ property name="bCrypt" inject="BCrypt@BCrypt";
/**
* Constructor
*/
- MachBlogImporter function init(){
+ MachBlogImporter function init() {
return this;
}
@@ -36,15 +43,19 @@ component implements="ICBImporter" {
dsnPassword = "",
defaultPassword = "",
required roleID,
- tableprefix = ""
- ){
- var authorMap = {};
- var catMap = {};
- var entryMap = {};
- var pageMap = {};
- var slugMap = {};
+ tableprefix = ""
+ ) {
+ var authorMap = {};
+ var catMap = {};
+ var entryMap = {};
+ var pageMap = {};
+ var slugMap = {};
var pageSlugMap = {};
- var baseDate = createDate( 1970, 1, 1 );
+ var baseDate = createDate(
+ 1970,
+ 1,
+ 1
+ );
log.info( "Starting import process: #arguments.toString()#" );
@@ -57,10 +68,10 @@ component implements="ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#machblog_category"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
var props = {
- category : q.category_name[ x ],
- slug : htmlHelper.slugify( q.category_name[ x ] )
+ category: q.category_name[ x ],
+ slug : htmlHelper.slugify( q.category_name[ x ] )
};
var cat = categoryService.new( properties = props );
entitySave( cat );
@@ -75,20 +86,20 @@ component implements="ICBImporter" {
// Get the default role
var defaultRole = roleService.get( arguments.roleID );
// Import Authors
- var q = new Query(
+ var q = new Query(
datasource = arguments.dsn,
username = arguments.dsnUsername,
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#machblog_user"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
var props = {
- email : q.email[ x ],
- username : q.email[ x ],
- password : bcrypt.hashPassword( defaultPassword ),
- isActive : q.is_active[ x ],
- firstName : q.first_name[ x ],
- lastName : q.last_name[ x ]
+ email : q.email[ x ],
+ username : q.email[ x ],
+ password : bcrypt.hashPassword( defaultPassword ),
+ isActive : q.is_active[ x ],
+ firstName: q.first_name[ x ],
+ lastName : q.last_name[ x ]
};
var author = authorService.new( properties = props );
author.setRole( defaultRole );
@@ -117,20 +128,28 @@ component implements="ICBImporter" {
sql = "select * from #arguments.tablePrefix#machblog_entry order by dt_modified asc"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
var published = true;
if ( !q.is_active[ x ] ) {
published = false;
}
var props = {
- title : q.title[ x ],
- slug : htmlHelper.slugify( q.title[ x ] ),
- content : q.body[ x ] & q.more_body[ x ],
- excerpt : q.body[ x ],
- publishedDate : dateAdd( "s", q.dt_posted[ x ] / 1000, baseDate ),
- createdDate : dateAdd( "s", q.dt_created[ x ] / 1000, baseDate ),
- isPublished : published,
- allowComments : q.allow_comments[ x ]
+ title : q.title[ x ],
+ slug : htmlHelper.slugify( q.title[ x ] ),
+ content : q.body[ x ] & q.more_body[ x ],
+ excerpt : q.body[ x ],
+ publishedDate: dateAdd(
+ "s",
+ q.dt_posted[ x ] / 1000,
+ baseDate
+ ),
+ createdDate: dateAdd(
+ "s",
+ q.dt_created[ x ] / 1000,
+ baseDate
+ ),
+ isPublished : published,
+ allowComments: q.allow_comments[ x ]
};
// slug checks
@@ -147,10 +166,10 @@ component implements="ICBImporter" {
var entry = entryService.new( properties = props );
// Add content versionized!
entry.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = authorService.get( authorMap[ q.created_by_id[ x ] ] )
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = authorService.get( authorMap[ q.created_by_id[ x ] ] )
+ );
entry.setCreator( authorService.get( authorMap[ q.created_by_id[ x ] ] ) );
// entry categories
var qCategories = new Query(
@@ -160,8 +179,11 @@ component implements="ICBImporter" {
sql = "select * from #arguments.tablePrefix#machblog_entry_category as category where category.entry_id = '#q.entry_id[ x ]#'"
).execute().getResult();
var aCategories = [];
- for ( var y = 1; y lte qCategories.recordcount; y++ ) {
- arrayAppend( aCategories, categoryService.get( catMap[ qCategories.category_id[ y ] ] ) );
+ for ( var y = 1; y LTE qCategories.recordcount; y++ ) {
+ arrayAppend(
+ aCategories,
+ categoryService.get( catMap[ qCategories.category_id[ y ] ] )
+ );
}
entry.setCategories( aCategories );
@@ -179,19 +201,19 @@ component implements="ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#machblog_comment as comment where comment.entry_id = '#q.entry_id[ x ]#' order by dt_created asc"
).execute().getResult();
- for ( var y = 1; y lte qComments.recordcount; y++ ) {
+ for ( var y = 1; y LTE qComments.recordcount; y++ ) {
var props = {
- content : qComments.comment[ y ],
- author : qComments.name[ y ],
- authorIP : qComments.ip_created[ y ],
- authorEmail : qComments.email[ y ],
- authorURL : qComments.url[ y ],
- createdDate : dateAdd(
+ content : qComments.comment[ y ],
+ author : qComments.name[ y ],
+ authorIP : qComments.ip_created[ y ],
+ authorEmail: qComments.email[ y ],
+ authorURL : qComments.url[ y ],
+ createdDate: dateAdd(
"s",
qComments.dt_created[ y ] / 1000,
baseDate
),
- isApproved : qComments.is_active[ y ]
+ isApproved: qComments.is_active[ y ]
};
var comment = commentService.new( properties = props );
comment.setRelatedContent( entry );
@@ -203,16 +225,14 @@ component implements="ICBImporter" {
log.info( "Entry imported: #entry.getTitle()#" );
}
log.info( "Entries imported successfully!" );
- }
- // end of try
- catch ( any e ) {
+ }// end of try
+ catch (any e) {
log.error( "Error importing blog: #e.message# #e.detail#", e );
rethrow;
}
// Commit All entities
- transaction action="commit" {
- }
+ transaction action="commit";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/importers/MangoImporter.cfc b/modules/contentbox/models/importers/MangoImporter.cfc
index b8564f4325..95f1e1bc1d 100644
--- a/modules/contentbox/models/importers/MangoImporter.cfc
+++ b/modules/contentbox/models/importers/MangoImporter.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,24 +6,31 @@
* Import a mango database into contentbox
*/
component implements="contentbox.models.importers.ICBImporter" {
-
// DI
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="authorService" inject="id:authorService@contentbox";
+
property name="roleService" inject="id:roleService@contentbox";
+
property name="commentService" inject="id:commentService@contentbox";
+
property name="customFieldService" inject="id:customFieldService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="htmlHelper" inject="HTMLHelper@coldbox";
- property name="bCrypt" inject="BCrypt@BCrypt";
+ property name="bCrypt" inject="BCrypt@BCrypt";
/**
* Constructor
*/
- MangoImporter function init(){
+ MangoImporter function init() {
return this;
}
@@ -36,13 +43,13 @@ component implements="contentbox.models.importers.ICBImporter" {
dsnPassword = "",
defaultPassword = "",
required roleID,
- tableprefix = ""
- ){
- var authorMap = {};
- var catMap = {};
- var entryMap = {};
- var pageMap = {};
- var slugMap = {};
+ tableprefix = ""
+ ) {
+ var authorMap = {};
+ var catMap = {};
+ var entryMap = {};
+ var pageMap = {};
+ var slugMap = {};
var pageSlugMap = {};
log.info( "Starting import process: #arguments.toString()#" );
@@ -56,9 +63,9 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#category"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
- var props = { category : q.title[ x ], slug : q.name[ x ] };
- var cat = categoryService.new( properties = props );
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
+ var props = { category: q.title[ x ], slug: q.name[ x ] };
+ var cat = categoryService.new( properties = props );
var exists = categoryService.findAllBySlug( q.name[ x ] );
if ( arrayLen( exists ) ) {
@@ -78,20 +85,26 @@ component implements="contentbox.models.importers.ICBImporter" {
// Get the default role
var defaultRole = roleService.get( arguments.roleID );
// Import Authors
- var q = new Query(
+ var q = new Query(
datasource = arguments.dsn,
username = arguments.dsnUsername,
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#author"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
var props = {
- email : q.email[ x ],
- username : q.username[ x ],
- password : bcrypt.hashPassword( defaultPassword ),
- isActive : 1,
- firstName : listFirst( q.name[ x ], " " ),
- lastName : trim( replaceNoCase( q.name[ x ], listFirst( q.name[ x ], " " ), "" ) )
+ email : q.email[ x ],
+ username : q.username[ x ],
+ password : bcrypt.hashPassword( defaultPassword ),
+ isActive : 1,
+ firstName: listFirst( q.name[ x ], " " ),
+ lastName : trim(
+ replaceNoCase(
+ q.name[ x ],
+ listFirst( q.name[ x ], " " ),
+ ""
+ )
+ )
};
var author = authorService.new( properties = props );
author.setRole( defaultRole );
@@ -118,23 +131,23 @@ component implements="contentbox.models.importers.ICBImporter" {
where me.id = mp.id
order by mp.hierarchy"
).execute().getResult();
- for ( var x = 1; x lte qPages.recordcount; x++ ) {
+ for ( var x = 1; x LTE qPages.recordcount; x++ ) {
// Get properties
var published = true;
- if ( qPages.status[ x ] neq "published" ) {
+ if ( qPages.status[ x ] NEQ "published" ) {
published = false;
}
var props = {
- title : qPages.title[ x ],
- slug : qPages.name[ x ],
- content : qPages.content[ x ],
- excerpt : qPages.excerpt[ x ],
- publishedDate : qPages.last_modified[ x ],
- createdDate : qPages.last_modified[ x ],
- isPublished : published,
- allowComments : qPages.comments_allowed[ x ],
- order : qPages.sort_order[ x ],
- layout : "pages"
+ title : qPages.title[ x ],
+ slug : qPages.name[ x ],
+ content : qPages.content[ x ],
+ excerpt : qPages.excerpt[ x ],
+ publishedDate: qPages.last_modified[ x ],
+ createdDate : qPages.last_modified[ x ],
+ isPublished : published,
+ allowComments: qPages.comments_allowed[ x ],
+ order : qPages.sort_order[ x ],
+ layout : "pages"
};
// slug checks
@@ -151,10 +164,10 @@ component implements="contentbox.models.importers.ICBImporter" {
var page = pageService.new( properties = props );
// Add content versionized!
page.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = authorService.get( authorMap[ qPages.author_id[ x ] ] )
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = authorService.get( authorMap[ qPages.author_id[ x ] ] )
+ );
page.setCreator( authorService.get( authorMap[ qPages.author_id[ x ] ] ) );
// Custom Fields
log.info( "Starting to import Page Custom Fields...." );
@@ -164,10 +177,10 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#entry_custom_field as cf where cf.entry_id = '#qPages.id[ x ]#'"
).execute().getResult();
- for ( var y = 1; y lte qCustomFields.recordcount; y++ ) {
+ for ( var y = 1; y LTE qCustomFields.recordcount; y++ ) {
var props = {
- key : qCustomFields.name[ y ],
- value : qCustomFields.field_value[ y ]
+ key : qCustomFields.name[ y ],
+ value: qCustomFields.field_value[ y ]
};
var thisCustomField = customFieldService.new( properties = props );
page.addCustomField( thisCustomField );
@@ -186,15 +199,15 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#comment as mc where mc.entry_id = '#qPages.id[ x ]#'"
).execute().getResult();
- for ( var y = 1; y lte qComments.recordcount; y++ ) {
+ for ( var y = 1; y LTE qComments.recordcount; y++ ) {
var props = {
- content : qComments.content[ y ],
- author : qComments.creator_name[ y ],
- authorIP : "127.0.0.1",
- authorEmail : qComments.creator_email[ y ],
- authorURL : qComments.creator_url[ y ],
- createdDate : qComments.created_on[ y ],
- isApproved : qComments.approved[ y ]
+ content : qComments.content[ y ],
+ author : qComments.creator_name[ y ],
+ authorIP : "127.0.0.1",
+ authorEmail: qComments.creator_email[ y ],
+ authorURL : qComments.creator_url[ y ],
+ createdDate: qComments.created_on[ y ],
+ isApproved : qComments.approved[ y ]
};
var comment = commentService.new( properties = props );
comment.setRelatedContent( page );
@@ -227,20 +240,20 @@ component implements="contentbox.models.importers.ICBImporter" {
)
order by last_modified asc"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
var published = true;
- if ( q.status[ x ] neq "published" ) {
+ if ( q.status[ x ] NEQ "published" ) {
published = false;
}
var props = {
- title : q.title[ x ],
- slug : q.name[ x ],
- content : q.content[ x ],
- excerpt : q.excerpt[ x ],
- publishedDate : q.last_modified[ x ],
- createdDate : q.last_modified[ x ],
- isPublished : published,
- allowComments : q.comments_allowed[ x ]
+ title : q.title[ x ],
+ slug : q.name[ x ],
+ content : q.content[ x ],
+ excerpt : q.excerpt[ x ],
+ publishedDate: q.last_modified[ x ],
+ createdDate : q.last_modified[ x ],
+ isPublished : published,
+ allowComments: q.comments_allowed[ x ]
};
// slug checks
@@ -257,10 +270,10 @@ component implements="contentbox.models.importers.ICBImporter" {
var entry = entryService.new( properties = props );
// Add content versionized!
entry.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = authorService.get( authorMap[ q.author_id[ x ] ] )
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = authorService.get( authorMap[ q.author_id[ x ] ] )
+ );
entry.setCreator( authorService.get( authorMap[ q.author_id[ x ] ] ) );
// entry categories
var qCategories = new Query(
@@ -270,8 +283,11 @@ component implements="contentbox.models.importers.ICBImporter" {
sql = "select * from #arguments.tablePrefix#post_category as mp where mp.post_id = '#q.id[ x ]#'"
).execute().getResult();
var aCategories = [];
- for ( var y = 1; y lte qCategories.recordcount; y++ ) {
- arrayAppend( aCategories, categoryService.get( catMap[ qCategories.category_id[ y ] ] ) );
+ for ( var y = 1; y LTE qCategories.recordcount; y++ ) {
+ arrayAppend(
+ aCategories,
+ categoryService.get( catMap[ qCategories.category_id[ y ] ] )
+ );
}
entry.setCategories( aCategories );
@@ -282,10 +298,10 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#entry_custom_field as cf where cf.entry_id = '#q.id[ x ]#'"
).execute().getResult();
- for ( var y = 1; y lte qCustomFields.recordcount; y++ ) {
+ for ( var y = 1; y LTE qCustomFields.recordcount; y++ ) {
var props = {
- key : qCustomFields.name[ y ],
- value : qCustomFields.field_value[ y ]
+ key : qCustomFields.name[ y ],
+ value: qCustomFields.field_value[ y ]
};
var thisCustomField = customFieldService.new( properties = props );
entry.addCustomField( thisCustomField );
@@ -303,15 +319,15 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tablePrefix#comment as mc where mc.entry_id = '#q.id[ x ]#'"
).execute().getResult();
- for ( var y = 1; y lte qComments.recordcount; y++ ) {
+ for ( var y = 1; y LTE qComments.recordcount; y++ ) {
var props = {
- content : qComments.content[ y ],
- author : qComments.creator_name[ y ],
- authorIP : "127.0.0.1",
- authorEmail : qComments.creator_email[ y ],
- authorURL : qComments.creator_url[ y ],
- createdDate : qComments.created_on[ y ],
- isApproved : qComments.approved[ y ]
+ content : qComments.content[ y ],
+ author : qComments.creator_name[ y ],
+ authorIP : "127.0.0.1",
+ authorEmail: qComments.creator_email[ y ],
+ authorURL : qComments.creator_url[ y ],
+ createdDate: qComments.created_on[ y ],
+ isApproved : qComments.approved[ y ]
};
var comment = commentService.new( properties = props );
comment.setRelatedContent( entry );
@@ -323,16 +339,14 @@ component implements="contentbox.models.importers.ICBImporter" {
log.info( "Entry imported: #entry.getTitle()#" );
}
log.info( "Entries imported successfully!" );
- }
- // end of try
- catch ( any e ) {
+ }// end of try
+ catch (any e) {
log.error( "Error importing blog: #e.message# #e.detail#", e );
rethrow;
}
// Commit All entities
- transaction action="commit" {
- }
+ transaction action="commit";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/importers/WordpressImporter.cfc b/modules/contentbox/models/importers/WordpressImporter.cfc
index e5e4603d11..92cf518036 100644
--- a/modules/contentbox/models/importers/WordpressImporter.cfc
+++ b/modules/contentbox/models/importers/WordpressImporter.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,24 +6,31 @@
* Import a WordPress database into contentbox
*/
component implements="contentbox.models.importers.ICBImporter" {
-
// DI
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="authorService" inject="id:authorService@contentbox";
+
property name="roleService" inject="id:roleService@contentbox";
+
property name="commentService" inject="id:commentService@contentbox";
+
property name="customFieldService" inject="id:customFieldService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="htmlHelper" inject="HTMLHelper@coldbox";
- property name="bCrypt" inject="BCrypt@BCrypt";
+ property name="bCrypt" inject="BCrypt@BCrypt";
/**
* Constructor
*/
- WordPressImporter function init(){
+ WordPressImporter function init() {
return this;
}
@@ -36,13 +43,13 @@ component implements="contentbox.models.importers.ICBImporter" {
dsnPassword = "",
defaultPassword = "",
required roleID,
- tableprefix = ""
- ){
- var authorMap = {};
- var catMap = {};
- var entryMap = {};
- var pageMap = {};
- var slugMap = {};
+ tableprefix = ""
+ ) {
+ var authorMap = {};
+ var catMap = {};
+ var entryMap = {};
+ var pageMap = {};
+ var slugMap = {};
var pageSlugMap = {};
log.info( "Starting import process: #arguments.toString()#" );
@@ -56,9 +63,9 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select * from #arguments.tableprefix#_terms a, #arguments.tableprefix#_term_taxonomy b where a.term_id = b.term_id AND b.taxonomy = 'category'"
).execute().getResult();
- for ( var x = 1; x lte q.recordcount; x++ ) {
- var props = { category : q.name[ x ], slug : q.slug[ x ] };
- var cat = categoryService.new( properties = props );
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
+ var props = { category: q.name[ x ], slug: q.slug[ x ] };
+ var cat = categoryService.new( properties = props );
var exists = categoryService.findAllBySlug( q.slug[ x ] );
if ( arrayLen( exists ) ) {
@@ -78,22 +85,22 @@ component implements="contentbox.models.importers.ICBImporter" {
// Get the default role
var defaultRole = roleService.get( arguments.roleID );
// Import Authors
- var q = new Query(
+ var q = new Query(
datasource = arguments.dsn,
username = arguments.dsnUsername,
password = arguments.dsnPassword,
sql = "select * from #arguments.tableprefix#_users"
).execute().getResult();
var selectedRole = roleService.get( arguments.roleID );
- for ( var x = 1; x lte q.recordcount; x++ ) {
+ for ( var x = 1; x LTE q.recordcount; x++ ) {
var props = {
- email : q.user_email[ x ],
- username : q.user_login[ x ],
- password : bcrypt.hashPassword( defaultPassword ),
- isActive : 1,
- role : selectedRole,
- firstName : listFirst( q.display_name[ x ], " " ),
- lastName : trim(
+ email : q.user_email[ x ],
+ username : q.user_login[ x ],
+ password : bcrypt.hashPassword( defaultPassword ),
+ isActive : 1,
+ role : selectedRole,
+ firstName: listFirst( q.display_name[ x ], " " ),
+ lastName : trim(
replaceNoCase(
q.display_name[ x ],
listFirst( q.display_name[ x ], " " ),
@@ -124,27 +131,27 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select id,post_title AS title,post_name AS name,post_content AS content,post_status,comment_status,post_password,post_date AS last_modified,post_author AS author_id from #arguments.tableprefix#_posts where post_type='page'"
).execute().getResult();
- for ( var x = 1; x lte qPages.recordcount; x++ ) {
+ for ( var x = 1; x LTE qPages.recordcount; x++ ) {
// Get properties
- var published = true;
+ var published = true;
var commentStatus = true;
- if ( trim( qPages.post_status[ x ] ) neq "publish" ) {
+ if ( trim( qPages.post_status[ x ] ) NEQ "publish" ) {
published = false;
}
- if ( qPages.comment_status[ x ] neq "open" ) {
+ if ( qPages.comment_status[ x ] NEQ "open" ) {
commentSatus = false;
}
var props = {
- title : qPages.title[ x ],
- slug : qPages.name[ x ],
- content : fixWordPressContent( qPages.content[ x ] ),
- excerpt : "",
- publishedDate : qPages.last_modified[ x ],
- createdDate : qPages.last_modified[ x ],
- isPublished : published,
- allowComments : commentStatus,
- layout : "pages"
+ title : qPages.title[ x ],
+ slug : qPages.name[ x ],
+ content : fixWordPressContent( qPages.content[ x ] ),
+ excerpt : "",
+ publishedDate: qPages.last_modified[ x ],
+ createdDate : qPages.last_modified[ x ],
+ isPublished : published,
+ allowComments: commentStatus,
+ layout : "pages"
};
var moreLoc = findNoCase( "", props.content );
@@ -166,24 +173,24 @@ component implements="contentbox.models.importers.ICBImporter" {
var page = pageService.new( properties = props );
// Add content versionized!
page.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = authorService.get( authorMap[ qPages.author_id[ x ] ] )
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = authorService.get( authorMap[ qPages.author_id[ x ] ] )
+ );
// Add Creator
page.setCreator( authorService.get( authorMap[ qPages.author_id[ x ] ] ) );
// Save page and store in reference map
pageMap[ qPages.id[ x ] ] = page;
- var c = pageService.newCriteria();
+ var c = pageService.newCriteria();
var counter = 1;
- var count = new query(
+ var count = new query(
sql = "SELECT COUNT(*) AS ct FROM cb_content WHERE contentType = 'page' AND slug = '#page.getSlug()#';"
).execute().getResult()[ "ct" ];
do {
var count = new query(
sql = "SELECT COUNT(*) AS ct FROM cb_content WHERE contentType = 'page' AND slug = '#page.getSlug()#';"
).execute().getResult()[ "ct" ];
- if ( count eq 0 ) {
+ if ( count EQ 0 ) {
break;
}
// verify no slug exists & append if it does
@@ -202,15 +209,15 @@ component implements="contentbox.models.importers.ICBImporter" {
AND comment_approved <> 'spam'"
).execute().getResult();
var aComments = [];
- for ( var y = 1; y lte qComments.recordcount; y++ ) {
+ for ( var y = 1; y LTE qComments.recordcount; y++ ) {
var props = {
- content : qComments.comment_content[ y ],
- author : qComments.comment_author[ y ],
- authorIP : "127.0.0.1",
- authorEmail : qComments.comment_author_email[ y ],
- authorURL : qComments.comment_author_url[ y ],
- createdDate : qComments.comment_date[ y ],
- isApproved : qComments.comment_approved[ y ]
+ content : qComments.comment_content[ y ],
+ author : qComments.comment_author[ y ],
+ authorIP : "127.0.0.1",
+ authorEmail: qComments.comment_author_email[ y ],
+ authorURL : qComments.comment_author_url[ y ],
+ createdDate: qComments.comment_date[ y ],
+ isApproved : qComments.comment_approved[ y ]
};
var comment = commentService.new( properties = props );
comment.setRelatedContent( page );
@@ -234,27 +241,27 @@ component implements="contentbox.models.importers.ICBImporter" {
password = arguments.dsnPassword,
sql = "select id,post_title AS title,post_name AS name,post_content AS content,post_status,comment_status,post_password,post_date AS last_modified,post_author AS author_id from #arguments.tableprefix#_posts where post_type='post'"
).execute().getResult();
- for ( var x = 1; x lte qEntries.recordcount; x++ ) {
+ for ( var x = 1; x LTE qEntries.recordcount; x++ ) {
// Get properties
- var published = true;
+ var published = true;
var commentStatus = true;
- if ( trim( qEntries.post_status[ x ] ) neq "publish" ) {
+ if ( trim( qEntries.post_status[ x ] ) NEQ "publish" ) {
published = false;
}
- if ( qEntries.comment_status[ x ] neq "open" ) {
+ if ( qEntries.comment_status[ x ] NEQ "open" ) {
commentSatus = false;
}
var props = {
- title : qEntries.title[ x ],
- slug : qEntries.name[ x ],
- content : fixWordPressContent( qEntries.content[ x ] ),
- excerpt : "",
- publishedDate : qEntries.last_modified[ x ],
- createdDate : qEntries.last_modified[ x ],
- isPublished : published,
- allowComments : commentStatus,
- layout : "entries"
+ title : qEntries.title[ x ],
+ slug : qEntries.name[ x ],
+ content : fixWordPressContent( qEntries.content[ x ] ),
+ excerpt : "",
+ publishedDate: qEntries.last_modified[ x ],
+ createdDate : qEntries.last_modified[ x ],
+ isPublished : published,
+ allowComments: commentStatus,
+ layout : "entries"
};
var moreLoc = findNoCase( "", props.content );
@@ -276,24 +283,24 @@ component implements="contentbox.models.importers.ICBImporter" {
var entry = entryService.new( properties = props );
// Add content versionized!
entry.addNewContentVersion(
- content = props.content,
- changelog = "Imported content",
- author = authorService.get( authorMap[ qEntries.author_id[ x ] ] )
- );
+ content = props.content,
+ changelog = "Imported content",
+ author = authorService.get( authorMap[ qEntries.author_id[ x ] ] )
+ );
entry.setCreator( authorService.get( authorMap[ qEntries.author_id[ x ] ] ) );
// Save entry and store in reference map
entryMap[ qEntries.id[ x ] ] = entry;
- var c = entryService.newCriteria();
+ var c = entryService.newCriteria();
var counter = 1;
- var count = new query(
+ var count = new query(
sql = "SELECT COUNT(*) AS ct FROM cb_content WHERE contentType = 'post' AND slug = '#entry.getSlug()#';"
).execute().getResult()[ "ct" ];
do {
var count = new query(
sql = "SELECT COUNT(*) AS ct FROM cb_content WHERE contentType = 'post' AND slug = '#entry.getSlug()#';"
).execute().getResult()[ "ct" ];
- if ( count eq 0 ) {
+ if ( count EQ 0 ) {
break;
}
// verify no slug exists & append if it does
@@ -319,7 +326,7 @@ component implements="contentbox.models.importers.ICBImporter" {
sql = thisSQL
).execute().getResult();
var aCategories = [];
- for ( var y = 1; y lte qCategories.recordcount; y++ ) {
+ for ( var y = 1; y LTE qCategories.recordcount; y++ ) {
arrayAppend( aCategories, categoryService.get( catMap[ qCategories.term_id[ y ] ] ) );
}
entry.setCategories( aCategories );
@@ -336,15 +343,15 @@ component implements="contentbox.models.importers.ICBImporter" {
).execute().getResult();
var aComments = [];
- for ( var y = 1; y lte qComments.recordcount; y++ ) {
+ for ( var y = 1; y LTE qComments.recordcount; y++ ) {
var props = {
- content : qComments.comment_content[ y ],
- author : qComments.comment_author[ y ],
- authorIP : "127.0.0.1",
- authorEmail : qComments.comment_author_email[ y ],
- authorURL : qComments.comment_author_url[ y ],
- createdDate : qComments.comment_date[ y ],
- isApproved : qComments.comment_approved[ y ]
+ content : qComments.comment_content[ y ],
+ author : qComments.comment_author[ y ],
+ authorIP : "127.0.0.1",
+ authorEmail: qComments.comment_author_email[ y ],
+ authorURL : qComments.comment_author_url[ y ],
+ createdDate: qComments.comment_date[ y ],
+ isApproved : qComments.comment_approved[ y ]
};
var comment = commentService.new( properties = props );
comment.setRelatedContent( entry );
@@ -358,41 +365,114 @@ component implements="contentbox.models.importers.ICBImporter" {
// Save entry
entitySave( entry );
}
- }
- // end of try
- catch ( any e ) {
+ }// end of try
+ catch (any e) {
log.error( "Error importing blog: #e.message# #e.detail#", e );
rethrow;
}
// Commit All entities
- transaction action="commit" {
- }
+ transaction action="commit";
}
- private function fixWordPressContent( required string str ){
+ private function fixWordPressContent( required string str ) {
var myStr = trim( arguments.str );
- myStr = replaceNoCase( myStr, chr( 10 ), "
", "all" );
- myStr = replaceNoCase( myStr, chr( 13 ), "
", "all" );
- myStr = replaceNoCase( myStr, "
", "", "all" );
- myStr = replaceNoCase( myStr, "
", "", "all" );
- myStr = replaceNoCase( myStr, "
", "", "all" );
- myStr = replaceNoCase( myStr, "
", "", "all" );
- myStr = replaceNoCase( myStr, "
", "", "all" );
- myStr = replaceNoCase( myStr, "
", " ", "all" );
-
- myStr = replaceNoCase( myStr, "
", " ", "all" );
-
- myStr = replaceNoCase( myStr, "
", " ", "all" );
-
- myStr = reReplace( myStr, "\[caption[^\]]*\]", "", "all" );
- myStr = replaceNoCase( myStr, "[/caption]", "", "all" );
+ myStr = replaceNoCase(
+ myStr,
+ chr( 10 ),
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ chr( 13 ),
+ "
",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ " ",
+ "all"
+ );
+
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ " ",
+ "all"
+ );
+
+ myStr = replaceNoCase(
+ myStr,
+ "
",
+ " ",
+ "all"
+ );
+
+ myStr = reReplace(
+ myStr,
+ "\[caption[^\]]*\]",
+ "",
+ "all"
+ );
+ myStr = replaceNoCase(
+ myStr,
+ "[/caption]",
+ "",
+ "all"
+ );
return myStr;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/media/BaseProvider.cfc b/modules/contentbox/models/media/BaseProvider.cfc
index ae2d8dbc45..49f8f62360 100644
--- a/modules/contentbox/models/media/BaseProvider.cfc
+++ b/modules/contentbox/models/media/BaseProvider.cfc
@@ -1,10 +1,13 @@
component accessors="true" singleton {
-
// Dependecnies
property name="mediaService" inject="mediaService@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="cbfs" inject="DiskService@cbfs";
+
property name="templateCache" inject="cachebox:template";
+
/**
* The internal name of the provider
*/
@@ -25,25 +28,28 @@ component accessors="true" singleton {
*
* @mediaPath.hint the media path to verify if it exists
*/
- public boolean function mediaExists( required mediaPath ){
- return templateCache.getOrSet( "provider_item_exists_#hash( mediaPath )#", function(){
- var cbfsParts = listToArray( mediaPath, ":" );
- return cbfsParts.len() > 1
- ? cbfs.get( cbfsParts[ 1 ] ).exists( cbfsParts[ 2 ] )
- : fileExists( getRealMediaPath( mediaPath ) );
- } );
+ public boolean function mediaExists( required mediaPath ) {
+ return templateCache.getOrSet(
+ "provider_item_exists_#hash( mediaPath )#",
+ function() {
+ var cbfsParts = listToArray( mediaPath, ":" );
+ return cbfsParts.len() > 1
+ ? cbfs.get( cbfsParts[ 1 ] ).exists( cbfsParts[ 2 ] )
+ : fileExists( getRealMediaPath( mediaPath ) );
+ }
+ );
}
/************************************** Package Utility Methods *********************************************/
- package function getPublicURL( required mediaPath ){
+ package function getPublicURL( required mediaPath ) {
var cbfsParts = listToArray( arguments.mediaPath, ":" );
return cbfsParts.len() > 1
- ? cbfs.get( cbfsParts[ 1 ] ).url( cbfsParts[ 2 ] )
- : cbfs.get( "contentbox" ).url( arguments.mediaPath );
+ ? cbfs.get( cbfsParts[ 1 ] ).url( cbfsParts[ 2 ] )
+ : cbfs.get( "contentbox" ).url( arguments.mediaPath );
}
- package function getRealMediaPath( required mediaPath ){
+ package function getRealMediaPath( required mediaPath ) {
return mediaService.getCoreMediaRoot( absolute = true ) & "/#arguments.mediaPath#";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/media/CFContentMediaProvider.cfc b/modules/contentbox/models/media/CFContentMediaProvider.cfc
index 549ea4dbad..b3e6eb3d49 100644
--- a/modules/contentbox/models/media/CFContentMediaProvider.cfc
+++ b/modules/contentbox/models/media/CFContentMediaProvider.cfc
@@ -5,15 +5,14 @@
* ---
* Deliver file via cfcontent
*/
-component accessors="true" extends="BaseProvider" singleton {
-
+component accessors="true" extends ="BaseProvider" singleton {
property name="requestService" inject="coldbox:requestService";
/**
* Constructor
*/
- any function init(){
- variables.name = "CFContentMediaProvider";
+ any function init() {
+ variables.name = "CFContentMediaProvider";
variables.displayName = "CF Content Media Provider";
variables.description = "This provider uses the ColdFusion cfcontent tag to deliver and stream files securely to the user.";
return this;
@@ -24,21 +23,24 @@ component accessors="true" extends="BaseProvider" singleton {
*
* @mediaPath.hint the media path to deliver back to the user
*/
- any function deliverMedia( required mediaPath ){
+ any function deliverMedia( required mediaPath ) {
var cbfsParts = listToArray( arguments.mediaPath, ":" );
- var context = variables.requestService.getContext();
+ var context = variables.requestService.getContext();
if ( cbfsParts.len() > 1 ) {
- return variables.cbfs.get( cbfsParts[ 1 ] ).download( cbfsParts[ 2 ] );
+ return variables
+ .cbfs
+ .get( cbfsParts[ 1 ] )
+ .download( cbfsParts[ 2 ] );
} else {
- var file = getRealMediaPath( arguments.mediaPath );
+ var file = getRealMediaPath( arguments.mediaPath );
var mimeType = fileGetMimeType( file );
context.sendFile(
- file = file,
- disposition = "inline",
- mimeType = mimeType,
- extension = listLast( arguments.mediaPath, "." )
- );
+ file = file,
+ disposition = "inline",
+ mimeType = mimeType,
+ extension = listLast( arguments.mediaPath, "." )
+ );
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/media/ForwardMediaProvider.cfc b/modules/contentbox/models/media/ForwardMediaProvider.cfc
index 0612c899b8..9782661342 100644
--- a/modules/contentbox/models/media/ForwardMediaProvider.cfc
+++ b/modules/contentbox/models/media/ForwardMediaProvider.cfc
@@ -5,13 +5,13 @@
* ---
* Deliver file via pagecontext forward
*/
-component accessors="true" extends="BaseProvider" singleton {
+component accessors="true" extends ="BaseProvider" singleton {
/**
* Constructor
*/
- any function init(){
- variables.name = "ForwardMediaProvider";
+ any function init() {
+ variables.name = "ForwardMediaProvider";
variables.displayName = "Forward Media Provider";
variables.description = "This provider will forward to the real physical location in the server for the media path requested via the internal servlet
page context, so no real media path URL will be shown to the user. Use only if the media root is web accessible and a relative web root path, so double check your media root.";
@@ -23,29 +23,27 @@ component accessors="true" extends="BaseProvider" singleton {
*
* @mediaPath.hint the media path to deliver back to the user
*/
- any function deliverMedia( required mediaPath ){
+ any function deliverMedia( required mediaPath ) {
var publicURL = getPublicURL( arguments.mediaPath );
var connection = createObject( "java", "java.net.URL" ).init( publicURL ).openConnection();
- var response = structKeyExists( server, "lucee" ) ? getPageContext().getResponse() : getPageContext()
- .getResponse()
- .getResponse();
+ var response = structKeyExists( server, "lucee" )
+ ? getPageContext().getResponse()
+ : getPageContext().getResponse().getResponse();
var outputStream = response.getOutputStream();
try {
var inputStream = connection.getInputStream();
- } catch ( any e ) {
+ } catch (any e) {
connection.disconnect();
rethrow;
}
-
response.setStatus( connection.getResponseCode(), connection.getResponseMessage() );
- response.setContentType(
- createObject( "java", "java.net.URLConnection" ).guessContentTypeFromName( listLast( publicURL, "/" ) )
- );
+ response.setContentType( createObject( "java",
+ "java.net.URLConnection" ).guessContentTypeFromName( listLast( publicURL, "/" ) ) );
if ( connection.getResponseCode() > 399 ) {
response.flushBuffer();
@@ -57,26 +55,32 @@ component accessors="true" extends="BaseProvider" singleton {
while ( true ) {
try {
var remaining = inputStream.available();
- if ( remaining == 0 ) break;
+ if ( remaining == 0 ) {
+ break;
+ }
var chunkSize = remaining > 1024 ? 1024 : remaining;
- var buffer = createObject( "java", "java.nio.ByteBuffer" ).allocate( chunkSize );
+ var buffer = createObject( "java", "java.nio.ByteBuffer" ).allocate( chunkSize );
var bytesRead = inputStream.read( buffer.array() );
outputStream.write(
- buffer.array(),
- javacast( "int", 0 ),
- bytesRead
- );
+ buffer.array(),
+ javacast( "int", 0 ),
+ bytesRead
+ );
outputStream.flush();
- } catch ( java.net.SocketException e ) {
+ } catch (java.net.SocketException e) {
// Connection reset by peer: socket write error
break;
}
}
} finally {
- if ( !isNull( inputStream ) ) inputStream.close();
- if ( !isNull( connection ) ) connection.disconnect();
+ if ( !isNull( inputStream ) ) {
+ inputStream.close();
+ }
+ if ( !isNull( connection ) ) {
+ connection.disconnect();
+ }
response.flushBuffer();
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/media/MediaService.cfc b/modules/contentbox/models/media/MediaService.cfc
index cb6179f75f..cbd142b96c 100644
--- a/modules/contentbox/models/media/MediaService.cfc
+++ b/modules/contentbox/models/media/MediaService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,13 +6,13 @@
* Manage's the system's media files
*/
component accessors="true" singleton {
-
/**
* --------------------------------------------------------------------------
* DI
* --------------------------------------------------------------------------
*/
property name="log" inject="logbox:logger:{this}";
+
property name="settingService" inject="settingservice@contentbox";
/**
@@ -25,7 +25,6 @@ component accessors="true" singleton {
* ContentBox Providers Map
*/
property name="providers" type="struct";
-
/**
* --------------------------------------------------------------------------
* Static
@@ -40,7 +39,7 @@ component accessors="true" singleton {
*
* @wirebox.inject wirebox
*/
- MediaService function init( required wirebox ){
+ MediaService function init( required wirebox ) {
// The registered system media providers
variables.providers = {};
@@ -58,7 +57,7 @@ component accessors="true" singleton {
/**
* Get the default system media provider name as a string
*/
- function getDefaultProviderName(){
+ function getDefaultProviderName() {
return variables.settingService.getSetting( "cb_media_provider" );
}
@@ -67,7 +66,7 @@ component accessors="true" singleton {
*
* @return contentbox.models.media.BaseProvider
*/
- function getDefaultProvider(){
+ function getDefaultProvider() {
return getProvider( getDefaultProviderName() );
}
@@ -78,7 +77,7 @@ component accessors="true" singleton {
*
* @return contentbox.models.media.BaseProvider
*/
- function getProvider( required name ){
+ function getProvider( required name ) {
return variables.providers[ arguments.name ];
}
@@ -87,7 +86,9 @@ component accessors="true" singleton {
*
* @provider The provider object to register
*/
- MediaService function registerProvider( required contentbox.models.media.BaseProvider provider ){
+ MediaService function registerProvider(
+ required contentbox.models.media.BaseProvider provider
+ ) {
variables.providers[ arguments.provider.getName() ] = arguments.provider;
return this;
}
@@ -97,7 +98,7 @@ component accessors="true" singleton {
*
* @name The name of the provider to unregister
*/
- MediaService function unRegisterProvider( required name ){
+ MediaService function unRegisterProvider( required name ) {
structDelete( variables.providers, arguments.name );
return this;
}
@@ -105,8 +106,10 @@ component accessors="true" singleton {
/**
* Get an array of registered providers in alphabetical order
*/
- array function getRegisteredProviders(){
- return listToArray( listSort( structKeyList( variables.providers ), "textnocase" ) );
+ array function getRegisteredProviders() {
+ return listToArray(
+ listSort( structKeyList( variables.providers ), "textnocase" )
+ );
}
/**
@@ -114,14 +117,16 @@ component accessors="true" singleton {
*
* @return array of structs { name, displayName, description }
*/
- array function getRegisteredProvidersMap(){
- return getRegisteredProviders().map( function( thisProvider ){
- return {
- name : arguments.thisProvider,
- displayName : variables.providers[ arguments.thisProvider ].getDisplayName(),
- description : variables.providers[ arguments.thisProvider ].getDescription()
- };
- } );
+ array function getRegisteredProvidersMap() {
+ return getRegisteredProviders().map(
+ function( thisProvider ) {
+ return {
+ name : arguments.thisProvider,
+ displayName: variables.providers[ arguments.thisProvider ].getDisplayName(),
+ description: variables.providers[ arguments.thisProvider ].getDescription()
+ };
+ }
+ );
}
/**
@@ -129,9 +134,9 @@ component accessors="true" singleton {
*
* @absolute Return the absolute path or relative, if absolute then it expands the path.
*/
- function getCoreMediaRoot( required boolean absolute = false ){
+ function getCoreMediaRoot( required boolean absolute = false ) {
var mRoot = variables.settingService.getSetting( "cb_media_directoryRoot", variables.DEFAULT_MEDIA_ROOT );
return ( arguments.absolute ? expandPath( mRoot ) : mRoot );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/media/RelocationMediaProvider.cfc b/modules/contentbox/models/media/RelocationMediaProvider.cfc
index 0cbbd01402..cd3affc97e 100644
--- a/modules/contentbox/models/media/RelocationMediaProvider.cfc
+++ b/modules/contentbox/models/media/RelocationMediaProvider.cfc
@@ -5,13 +5,13 @@
* ---
* Deliver file via pagecontext forward
*/
-component accessors="true" extends="BaseProvider" singleton {
+component accessors="true" extends ="BaseProvider" singleton {
/**
* Constructor
*/
- any function init(){
- variables.name = "RelocationMediaProvider";
+ any function init() {
+ variables.name = "RelocationMediaProvider";
variables.displayName = "Relocation Media Provider";
variables.description = "This provider will relocate to the real physical location in the server for the media path requested. Use only
if the media root is web accessible, so double check your media root.";
@@ -23,7 +23,7 @@ component accessors="true" extends="BaseProvider" singleton {
*
* @mediaPath.hint the media path to deliver back to the user
*/
- any function deliverMedia( required mediaPath ){
+ any function deliverMedia( required mediaPath ) {
location(
url = getPublicURL( arguments.mediaPath ),
addToken = false,
@@ -31,4 +31,4 @@ component accessors="true" extends="BaseProvider" singleton {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/Menu.cfc b/modules/contentbox/models/menu/Menu.cfc
index 15ab103407..869f7a57c0 100644
--- a/modules/contentbox/models/menu/Menu.cfc
+++ b/modules/contentbox/models/menu/Menu.cfc
@@ -13,121 +13,113 @@ component
cachename ="cbMenu"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="menuService"
- inject ="provider:menuService@contentbox"
+ name="menuService"
+ inject="provider:menuService@contentbox"
persistent="false";
property
- name ="menuItemService"
- inject ="provider:menuItemService@contentbox"
+ name="menuItemService"
+ inject="provider:menuItemService@contentbox"
persistent="false";
property
- name ="ORMService"
- inject ="provider:entityservice"
+ name="ORMService"
+ inject="provider:entityservice"
persistent="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="menuID"
- column ="menuID"
+ name="menuID"
+ column="menuID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="title"
- column ="title"
+ name="title"
+ column="title"
notnull="true"
ormtype="string"
- length ="200"
+ length="200"
default=""
- index ="idx_menutitle";
+ index="idx_menutitle";
property
- name ="slug"
- column ="slug"
+ name="slug"
+ column="slug"
notnull="true"
ormtype="string"
- length ="200"
+ length="200"
default=""
- index ="idx_menuslug";
+ index="idx_menuslug";
property
- name ="menuClass"
- column ="menuClass"
+ name="menuClass"
+ column="menuClass"
ormtype="string"
- length ="160"
+ length="160"
default="";
property
- name ="listClass"
- column ="listClass"
+ name="listClass"
+ column="listClass"
ormtype="string"
- length ="160"
+ length="160"
default="";
property
- name ="listType"
- column ="listType"
+ name="listType"
+ column="listType"
ormtype="string"
- length ="20"
+ length="20"
default="ul";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> site loaded as a proxy and fetched immediately
property
- name ="site"
- notnull ="true"
- cfc ="contentbox.models.system.Site"
+ name="site"
+ notnull="true"
+ cfc="contentbox.models.system.Site"
fieldtype="many-to-one"
- fkcolumn ="FK_siteID"
- lazy ="true";
+ fkcolumn="FK_siteID"
+ lazy="true";
// O2M -> Comments
property
- name ="menuItems"
+ name="menuItems"
singularName="menuItem"
- fieldtype ="one-to-many"
- type ="array"
- cfc ="contentbox.models.menu.item.BaseMenuItem"
- fkcolumn ="FK_menuID"
- cascade ="all-delete-orphan"
- inverse ="true"
- lazy ="extra";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fieldtype="one-to-many"
+ type="array"
+ cfc="contentbox.models.menu.item.BaseMenuItem"
+ fkcolumn="FK_menuID"
+ cascade="all-delete-orphan"
+ inverse="true"
+ lazy="extra";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "menuID";
this.memento = {
- defaultIncludes : [
- "listClass",
- "listType",
- "menuClass",
- "slug",
- "title"
- ],
- defaultExcludes : [ "site", "menuItems" ],
- profiles : {
- export : {
- defaultIncludes : [
+ defaultIncludes: [ "listClass", "listType", "menuClass", "slug", "title"],
+ defaultExcludes: [ "site", "menuItems"],
+ profiles : {
+ export: {
+ defaultIncludes: [
"listClass",
"listType",
"menuClass",
@@ -138,28 +130,28 @@ component
"menuItems.parentSnapshot:parent",
"siteSnapshot:site"
],
- defaultExcludes : []
+ defaultExcludes: []
}
}
};
this.constraints = {
- "title" : { required : true, size : "1..200" },
- "slug" : { required : true, size : "1..200" },
- "menuClass" : { required : false, size : "1..160" },
- "listClass" : { required : false, size : "1..160" },
- "listType" : { required : false, size : "1..20" }
+ "title" : { required: true, size: "1..200" },
+ "slug" : { required: true, size: "1..200" },
+ "menuClass": { required: false, size: "1..160" },
+ "listClass": { required: false, size: "1..160" },
+ "listType" : { required: false, size: "1..20" }
};
- /* *********************************************************************
- ** CONSTRUCTOR
- ********************************************************************* */
+ /**********************************************************************
+ * ** CONSTRUCTOR
+ **********************************************************************/
/**
* constructor
*/
- Menu function init(){
- variables.listType = "ul";
+ Menu function init() {
+ variables.listType = "ul";
variables.menuItems = [];
super.init();
@@ -167,14 +159,14 @@ component
return this;
}
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* @Override due to bi-directional relationships
*/
- Menu function addMenuItem( required menuItem ){
+ Menu function addMenuItem( required menuItem ) {
// add them to the local array
arrayAppend( variables.menuItems, arguments.menuItem );
// set the bi-directional relation
@@ -185,7 +177,7 @@ component
/**
* @Override due to bi-directional relationships
*/
- Menu function setMenuItems( required array menuItems ){
+ Menu function setMenuItems( required array menuItems ) {
if ( hasMenuItem() ) {
// manual remove, so hibernate can clear the existing relationships
variables.menuItems.clear();
@@ -202,7 +194,7 @@ component
*
* @rawData The raw data from which to create menu items
*/
- array function populateMenuItems( required array rawData ){
+ array function populateMenuItems( required array rawData ) {
variables.menuItems.clear();
return createMenuItems( arguments.rawData );
}
@@ -210,42 +202,75 @@ component
/**
* Retrieves root menu items (only items with no parents)
*/
- array function getRootMenuItems(){
+ array function getRootMenuItems() {
if ( hasMenuItem() ) {
- return getMenuItems().filter( function( thisItem ){
- return !arguments.thisItem.hasParent();
- } );
+ return getMenuItems().filter(
+ function( thisItem ) {
+ return !arguments.thisItem.hasParent();
+ }
+ );
}
return [];
}
- /* *********************************************************************
- ** PRIVATE FUNCTIONS
- ********************************************************************* */
+ /**
+ * Shortcut to get the site name
+ */
+ function getSiteName() {
+ return getSite().getName();
+ }
+
+ /**
+ * Shortcut to get the site slug
+ */
+ function getSiteSlug() {
+ return getSite().getSlug();
+ }
+
+ /**
+ * Shortcut to get the site id
+ */
+ function getSiteId() {
+ if ( hasSite() ) {
+ return getSite().getsiteID();
+ }
+ return "";
+ }
+
+ /**
+ * Build a site snapshot
+ */
+ struct function getSiteSnapshot() {
+ return ( hasSite() ? getSite().getInfoSnapshot() : {} );
+ }
+
+ /**********************************************************************
+ * ** PRIVATE FUNCTIONS
+ **********************************************************************/
/**
* Recursive function to build menu items hierarchy from raw data
*
* @rawData The raw data definitions for the menu items
*/
- private array function createMenuItems( required array rawData ){
+ private array function createMenuItems( required array rawData ) {
var items = [];
// loop over rawData and create items :)
for ( var data in arguments.rawData ) {
var provider = variables.menuItemService.getProvider( data.menuType );
- var entity = variables.ORMService.new( entityName = provider.getEntityName() );
- var newItem = variables.menuItemService.populate(
- target = entity,
- memento = data,
- exclude = "menuItemId,children,parent"
- );
+ var entity = variables.ORMService.new( entityName = provider.getEntityName() );
+ var newItem = variables.menuItemService.populate(
+ target = entity,
+ memento = data,
+ exclude = "menuItemId,children,parent"
+ );
// Link the item to this menu
addMenuItem( newItem );
// populate the children
if ( !isNull( data.children ) && arrayLen( data.children ) ) {
var children = createMenuItems( data.children );
- var setter = [];
+ var setter = [];
for ( var child in children ) {
// Link the child to this parent
child.setParent( newItem );
@@ -261,35 +286,4 @@ component
return items;
}
- /**
- * Shortcut to get the site name
- */
- function getSiteName(){
- return getSite().getName();
- }
-
- /**
- * Shortcut to get the site slug
- */
- function getSiteSlug(){
- return getSite().getSlug();
- }
-
- /**
- * Shortcut to get the site id
- */
- function getSiteId(){
- if ( hasSite() ) {
- return getSite().getsiteID();
- }
- return "";
- }
-
- /**
- * Build a site snapshot
- */
- struct function getSiteSnapshot(){
- return ( hasSite() ? getSite().getInfoSnapshot() : {} );
- }
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/MenuItemService.cfc b/modules/contentbox/models/menu/MenuItemService.cfc
index 59d259d679..7a4d0ab07a 100644
--- a/modules/contentbox/models/menu/MenuItemService.cfc
+++ b/modules/contentbox/models/menu/MenuItemService.cfc
@@ -1,33 +1,28 @@
/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* Service to handle menu items.
-*/
-component
- extends ="cborm.models.VirtualEntityService"
- accessors="true"
- singleton
-{
-
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * Service to handle menu items.
+ */
+component extends ="cborm.models.VirtualEntityService" accessors="true" singleton {
// DI
property name="wirebox" inject="wirebox";
@@ -39,7 +34,7 @@ component
/**
* Constructor
*/
- MenuItemService function init(){
+ MenuItemService function init() {
// init it
super.init( entityName = "cbMenuItem" );
variables.providers = {};
@@ -50,13 +45,31 @@ 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" );
+ 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"
+ );
}
/**
@@ -65,7 +78,10 @@ component
* @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;
}
@@ -75,7 +91,7 @@ component
*
* @type.hint The type of provider
*/
- public MenuItemService function unRegisterProvider( required string type ){
+ public MenuItemService function unRegisterProvider( required string type ) {
structDelete( variables.providers, arguments.type );
return this;
}
@@ -85,8 +101,8 @@ component
*
* @type.hint The type of provider
*/
- public any function getProvider( required string type ){
+ public any function getProvider( required string type ) {
return variables.providers[ arguments.type ];
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/MenuService.cfc b/modules/contentbox/models/menu/MenuService.cfc
index 985d03c7d1..6d060ee1ba 100644
--- a/modules/contentbox/models/menu/MenuService.cfc
+++ b/modules/contentbox/models/menu/MenuService.cfc
@@ -5,21 +5,18 @@
* ---
* Service to handle menu operations.
*/
-component
- extends ="cborm.models.VirtualEntityService"
- accessors="true"
- singleton
-{
-
+component extends ="cborm.models.VirtualEntityService" accessors="true" singleton {
// DI
property name="renderer" inject="coldbox:renderer";
+
property name="menuItemService" inject="menuItemService@contentbox";
+
property name="dateUtil" inject="DateUtil@contentbox";
/**
* Constructor
*/
- MenuService function init(){
+ MenuService function init() {
// init it
super.init( entityName = "cbMenu" );
return this;
@@ -33,7 +30,7 @@ component
*
* @return The saved menu
*/
- function save( required menu, string originalSlug = "" ){
+ function save( required menu, string originalSlug = "" ) {
return super.save( arguments.menu );
}
@@ -54,16 +51,16 @@ component
boolean asQuery = false,
string sortOrder = "title",
string siteID = ""
- ){
+ ) {
var results = {};
- var c = newCriteria();
+ var c = newCriteria();
// Search
if ( len( arguments.searchTerm ) ) {
c.$or(
- c.restrictions.like( "title", "%#arguments.searchTerm#%" ),
- c.restrictions.like( "slug", "%#arguments.searchTerm#%" )
- );
+ c.restrictions.like( "title", "%#arguments.searchTerm#%" ),
+ c.restrictions.like( "slug", "%#arguments.searchTerm#%" )
+ );
}
// Site Filter
@@ -74,11 +71,11 @@ component
// run criteria query and projections count
results.count = c.count( "menuID" );
results.menus = c.list(
- offset = arguments.offset,
- max = arguments.max,
- sortOrder = arguments.sortOrder,
- asQuery = arguments.asQuery
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder,
+ asQuery = arguments.asQuery
+ );
return results;
}
@@ -91,16 +88,19 @@ component
*
* @return The menu found or a new menu blank
*/
- function findBySlug( required any slug, string siteID = "" ){
+ function findBySlug( required any slug, string siteID = "" ) {
// By criteria now
var menu = newCriteria()
.isEq( "slug", arguments.slug )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
.get();
// return accordingly
- return ( isNull( menu ) ? new () : menu );
+ return ( isNull( menu ) ? new() : menu );
}
/**
@@ -108,10 +108,12 @@ component
*
* @site The site to export from
*/
- array function getAllForExport( required site ){
- return findAllWhere( { site : arguments.site } ).map( function( thisItem ){
- return thisItem.getMemento( profile: "export" );
- } );
+ array function getAllForExport( required site ) {
+ return findAllWhere( { site: arguments.site } ).map(
+ function( thisItem ) {
+ return thisItem.getMemento( profile = "export" );
+ }
+ );
}
/**
@@ -119,11 +121,14 @@ component
*
* @siteID Filter by site
*/
- array function getAllSlugs( string siteID = "" ){
+ array function getAllSlugs( string siteID = "" ) {
return newCriteria()
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
.withProjections( property = "slug" )
.list( sortOrder = "slug asc" );
}
@@ -138,14 +143,17 @@ component
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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(
@@ -170,16 +178,16 @@ component
boolean override = false,
required importLog,
site
- ){
+ ) {
var siteService = getWireBox().getInstance( "siteService@contentbox" );
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
// Setup logging function
- var logThis = function( message ){
+ var logThis = function( message ) {
variables.logger.info( arguments.message );
importLog.append( arguments.message & " " );
};
@@ -189,14 +197,18 @@ 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 );
}
- logThis( "+ Importing menu (#thisMenu.slug#) to site (#arguments.site.getSlug()#)" );
+ logThis(
+ "+ Importing menu (#thisMenu.slug#) to site (#arguments.site.getSlug()#)"
+ );
// Get new or persisted from site by slug
- var oMenu = findWhere( { "slug" : thisMenu.slug, "site" : arguments.site } );
+ var oMenu = findWhere( { "slug": thisMenu.slug, "site": arguments.site } );
if ( isNull( oMenu ) ) {
logThis( "+ New menu (#thisMenu.slug#) to import" );
oMenu = this.new();
@@ -218,11 +230,11 @@ component
// populate content from data
getBeanPopulator().populateFromStruct(
- target = oMenu,
- memento = thisMenu,
- composeRelationships = false,
- exclude = "menuID,menuItems,site"
- );
+ target = oMenu,
+ memento = thisMenu,
+ composeRelationships = false,
+ exclude = "menuID,menuItems,site"
+ );
// Compose Menu Items
if ( arrayLen( thisMenu.menuItems ) ) {
@@ -230,13 +242,17 @@ component
}
entitySave( oMenu );
- logThis( "+ Imported menu (#thisMenu.slug#) to site (#arguments.site.getSlug()#)" );
+ logThis(
+ "+ Imported menu (#thisMenu.slug#) to site (#arguments.site.getSlug()#)"
+ );
}
// end import loop
// 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
@@ -251,15 +267,15 @@ component
* @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
*/
- public String function buildEditableMenu(
+ public string function buildEditableMenu(
required array menu,
required string menuString = "",
boolean inChild = false
- ){
+ ) {
// loop over menu items
for ( var item in arguments.menu ) {
var providerContent = "";
- var skipItem = false;
+ var skipItem = false;
// if item has a parent, and it's being evaluated on the same level as its parent, skip it
if ( item.hasParent() && !inChild ) {
@@ -271,16 +287,16 @@ component
arguments.menuString &= "";
// render default menu item
- var args = { menuItem : item, provider : item.getProvider() };
+ var args = { menuItem: item, provider: item.getProvider() };
savecontent variable="providerContent" {
writeOutput(
variables.renderer.view(
- view = "menus/provider",
- module = "contentbox-admin",
- args = args
- )
+ view = "menus/provider",
+ module = "contentbox-admin",
+ args = args
+ )
);
- };
+ }
menuString &= providerContent;
// if this item has children, recursively call this method to build them out too
@@ -308,16 +324,25 @@ component
required any slug,
any menuID = "",
string siteID = ""
- ){
+ ) {
return newCriteria()
- .isEq( "slug", arguments.slug )
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } )
- .when( len( arguments.menuID ), function( c ){
- c.ne( "menuID", menuID );
- } )
- .count() > 0 ? false : true;
+ .isEq( "slug", arguments.slug )
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ )
+ .when(
+ len( arguments.menuID ),
+ function( c ) {
+ c.ne( "menuID", menuID );
+ }
+ )
+ .count() >
+ 0
+ ? false
+ : true;
}
/**
@@ -325,8 +350,8 @@ component
*
* @slug The slug to make unique
*/
- private function getUniqueSlugHash( required string slug ){
+ private function getUniqueSlugHash( required string slug ) {
return "#arguments.slug#-#lCase( left( hash( now() ), 5 ) )#";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/BaseMenuItem.cfc b/modules/contentbox/models/menu/item/BaseMenuItem.cfc
index 2efadf16a0..cf7be57a48 100644
--- a/modules/contentbox/models/menu/item/BaseMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/BaseMenuItem.cfc
@@ -14,139 +14,133 @@ component
cacheuse ="read-write"
discriminatorColumn="menuType"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="menuItemService"
- inject ="provider:menuItemService@contentbox"
+ name="menuItemService"
+ inject="provider:menuItemService@contentbox"
persistent="false";
- /* *********************************************************************
- ** PROPERTIES due to ACF Bug
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES due to ACF Bug
+ **********************************************************************/
property
- name ="createdDate"
- column ="createdDate"
- type ="date"
+ name="createdDate"
+ column="createdDate"
+ type="date"
ormtype="timestamp"
notnull="true"
- update ="false";
+ update="false";
property
- name ="modifiedDate"
- column ="modifiedDate"
- type ="date"
+ name="modifiedDate"
+ column="modifiedDate"
+ type="date"
ormtype="timestamp"
notnull="true";
property
- name ="isDeleted"
- column ="isDeleted"
+ name="isDeleted"
+ column="isDeleted"
ormtype="boolean"
notnull="true"
default="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="menuItemID"
- column ="menuItemID"
+ name="menuItemID"
+ column="menuItemID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="title"
- column ="title"
+ name="title"
+ column="title"
notnull="true"
ormtype="string"
- length ="200"
+ length="200"
default="";
property
- name ="label"
- column ="label"
+ name="label"
+ column="label"
notnull="false"
ormtype="string"
- length ="200"
+ length="200"
default="";
property
- name ="itemClass"
- column ="itemClass"
+ name="itemClass"
+ column="itemClass"
notnull="false"
ormtype="string"
- length ="200"
+ length="200"
default="";
property
- name ="data"
- column ="data"
+ name="data"
+ column="data"
notnull="false"
ormtype="string"
default="";
- property
- name ="active"
- column ="active"
- ormtype="boolean"
- default="true";
+ property name="active" column="active" ormtype="boolean" default="true";
property
- name ="menuType"
+ name="menuType"
column="menuType"
insert="false"
update="false";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 - Owning menu
property
- name ="menu"
- cfc ="contentbox.models.menu.Menu"
+ name="menu"
+ cfc="contentbox.models.menu.Menu"
fieldtype="many-to-one"
- fkcolumn ="FK_menuID"
- lazy ="true"
- notnull ="true";
+ fkcolumn="FK_menuID"
+ lazy="true"
+ notnull="true";
// M20 - Parent Menu item
property
- name ="parent"
- cfc ="BaseMenuItem"
+ name="parent"
+ cfc="BaseMenuItem"
fieldtype="many-to-one"
- fkcolumn ="FK_parentID"
- lazy ="true";
+ fkcolumn="FK_parentID"
+ lazy="true";
// O2M - Child Menu Item
property
- name ="children"
+ name="children"
singularName="child"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="extra"
- cfc ="BaseMenuItem"
- fkcolumn ="FK_parentID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fieldtype="one-to-many"
+ type="array"
+ lazy="extra"
+ cfc="BaseMenuItem"
+ fkcolumn="FK_parentID"
+ inverse="true"
+ cascade="all-delete-orphan";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "menuItemID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"active",
"data",
"itemClass",
@@ -155,22 +149,22 @@ component
"children",
"parentSnapshot:parent"
],
- defaultExcludes : [ "menu", "parent" ]
+ defaultExcludes: [ "menu", "parent"]
};
this.constraints = {
- "title" : { required : true, size : "1..200" },
- "label" : { required : false, size : "1..200" },
- "itemClass" : { required : false, size : "1..200" },
- "data" : { required : false, size : "1..255" }
+ "title" : { required: true, size: "1..200" },
+ "label" : { required: false, size: "1..200" },
+ "itemClass": { required: false, size: "1..200" },
+ "data" : { required: false, size: "1..255" }
};
- /* *********************************************************************
- ** CONSTRUCTOR
- ********************************************************************* */
+ /**********************************************************************
+ * ** CONSTRUCTOR
+ **********************************************************************/
- BaseMenuItem function init(){
- variables.active = true;
+ BaseMenuItem function init() {
+ variables.active = true;
variables.children = [];
super.init();
@@ -181,37 +175,37 @@ component
/**
* Build a parent snapshot
*/
- struct function getParentSnapshot(){
+ struct function getParentSnapshot() {
return ( hasParent() ? getParent().getInfoSnapshot() : {} );
}
/**
* Utility method to get a snapshot of this menu item
*/
- struct function getInfoSnapshot(){
+ struct function getInfoSnapshot() {
if ( isLoaded() ) {
return {
- "menuItemID" : getId(),
- "title" : getTitle(),
- "active" : getActive(),
- "menuType" : getMenuType()
+ "menuItemID": getId(),
+ "title" : getTitle(),
+ "active" : getActive(),
+ "menuType" : getMenuType()
};
}
return {};
}
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Get a handy, formatted string of attributes that are applicable for the current menu item
*/
- public string function getAttributesAsString(){
- var str = "";
+ public string function getAttributesAsString() {
+ var str = "";
var title = !isNull( getTitle() ) ? getTitle() : "";
- var cls = !isNull( getItemClass() ) ? getItemClass() : "";
- var data = !isNull( getData() ) ? getData() : "";
+ var cls = !isNull( getItemClass() ) ? getItemClass() : "";
+ var data = !isNull( getData() ) ? getData() : "";
// handle title
if ( len( title ) ) {
str &= " title=""#htmlEditFormat( title )#""";
@@ -255,8 +249,8 @@ component
*
* @options.hint Additional arguments to be used in the method
*/
- public boolean function canDisplay( required struct options = {} ){
+ public boolean function canDisplay( required struct options = {} ) {
return getActive();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/ContentMenuItem.cfc b/modules/contentbox/models/menu/item/ContentMenuItem.cfc
index 7c8c69bddb..2aaf203258 100644
--- a/modules/contentbox/models/menu/item/ContentMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/ContentMenuItem.cfc
@@ -12,61 +12,60 @@ component
extends ="contentbox.models.menu.item.BaseMenuItem"
discriminatorValue="Content"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="provider"
+ name="provider"
persistent="false"
- inject ="provider:contentbox.models.menu.providers.ContentProvider";
+ inject="provider:contentbox.models.menu.providers.ContentProvider";
+
property
- name ="contentService"
+ name="contentService"
persistent="false"
- inject ="provider:contentService@contentbox";
+ inject="provider:contentService@contentbox";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="contentSlug"
- column ="contentSlug"
+ name="contentSlug"
+ column="contentSlug"
notnull="false"
ormtype="string"
default="";
property
- name ="target"
- column ="target"
+ name="target"
+ column="target"
notnull="false"
ormtype="string"
default="";
property
- name ="urlClass"
- column ="urlClass"
+ name="urlClass"
+ column="urlClass"
notnull="false"
ormtype="string"
default="";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "contentSlug" ] = { required : false, size : "1..255" };
- this.constraints[ "target" ] = { required : false, size : "1..255" };
- this.constraints[ "urlClass" ] = { required : false, size : "1..255" };
+ this.constraints[ "contentSlug" ] = { required: false, size: "1..255" };
+ this.constraints[ "target" ] = { required: false, size: "1..255" };
+ this.constraints[ "urlClass" ] = { required: false, size: "1..255" };
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
- appendToMemento( [ "contentSlug", "target", "urlClass" ], "defaultIncludes" );
+ appendToMemento( [ "contentSlug", "target", "urlClass"], "defaultIncludes" );
return this;
}
@@ -76,14 +75,14 @@ component
*
* @options.hint Additional arguments to be used in the method
*/
- public boolean function canDisplay( required struct options = {} ){
+ public boolean function canDisplay( required struct options = {} ) {
var display = super.canDisplay( argumentCollection = arguments );
if ( display ) {
var content = contentService.findBySlug( slug = getContentSlug(), siteID = getMenu().getSiteID() );
- var type = content.getContentType();
+ var type = content.getContentType();
return content.isLoaded() && ( type == "Page" || type == "Entry" ) ? true : false;
}
return display;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/FreeMenuItem.cfc b/modules/contentbox/models/menu/item/FreeMenuItem.cfc
index b2a125857f..72dd4548b9 100644
--- a/modules/contentbox/models/menu/item/FreeMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/FreeMenuItem.cfc
@@ -12,22 +12,21 @@ component
extends ="contentbox.models.menu.item.BaseMenuItem"
discriminatorValue="Free"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="provider"
+ name="provider"
persistent="false"
- inject ="provider:contentbox.models.menu.providers.FreeProvider";
+ inject="provider:contentbox.models.menu.providers.FreeProvider";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
-}
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/JSMenuItem.cfc b/modules/contentbox/models/menu/item/JSMenuItem.cfc
index 06fce7b3e4..1732c276d7 100644
--- a/modules/contentbox/models/menu/item/JSMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/JSMenuItem.cfc
@@ -12,51 +12,49 @@ component
extends ="contentbox.models.menu.item.BaseMenuItem"
discriminatorValue="JS"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="provider"
+ name="provider"
persistent="false"
- inject ="provider:contentbox.models.menu.providers.JSProvider";
+ inject="provider:contentbox.models.menu.providers.JSProvider";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="js"
- column ="js"
+ name="js"
+ column="js"
notnull="false"
ormtype="string"
default="";
property
- name ="urlClass"
- column ="urlClass"
+ name="urlClass"
+ column="urlClass"
notnull="false"
ormtype="string"
default="";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "js" ] = { required : false, size : "1..255" };
- this.constraints[ "urlClass" ] = { required : false, size : "1..255" };
+ this.constraints[ "js" ] = { required: false, size: "1..255" };
+ this.constraints[ "urlClass" ] = { required: false, size: "1..255" };
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
- appendToMemento( [ "js", "urlClass" ], "defaultIncludes" );
+ appendToMemento( [ "js", "urlClass"], "defaultIncludes" );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/MediaMenuItem.cfc b/modules/contentbox/models/menu/item/MediaMenuItem.cfc
index 4bdba3c40b..2958ba13ec 100644
--- a/modules/contentbox/models/menu/item/MediaMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/MediaMenuItem.cfc
@@ -12,58 +12,56 @@ component
extends ="contentbox.models.menu.item.BaseMenuItem"
discriminatorValue="Media"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="provider"
+ name="provider"
persistent="false"
- inject ="provider:contentbox.models.menu.providers.MediaProvider";
+ inject="provider:contentbox.models.menu.providers.MediaProvider";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="mediaPath"
- column ="mediaPath"
+ name="mediaPath"
+ column="mediaPath"
notnull="false"
ormtype="string"
default="";
property
- name ="target"
- column ="target"
+ name="target"
+ column="target"
notnull="false"
ormtype="string"
default="";
property
- name ="urlClass"
- column ="urlClass"
+ name="urlClass"
+ column="urlClass"
notnull="false"
ormtype="string"
default="";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "mediaPath" ] = { required : false, size : "1..255" };
- this.constraints[ "target" ] = { required : false, size : "1..255" };
- this.constraints[ "urlClass" ] = { required : false, size : "1..255" };
+ this.constraints[ "mediaPath" ] = { required: false, size: "1..255" };
+ this.constraints[ "target" ] = { required: false, size: "1..255" };
+ this.constraints[ "urlClass" ] = { required: false, size: "1..255" };
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
- appendToMemento( [ "mediaPath", "target", "urlClass" ], "defaultIncludes" );
+ appendToMemento( [ "mediaPath", "target", "urlClass"], "defaultIncludes" );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/SubMenuItem.cfc b/modules/contentbox/models/menu/item/SubMenuItem.cfc
index 58048f52b7..a712777ee3 100644
--- a/modules/contentbox/models/menu/item/SubMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/SubMenuItem.cfc
@@ -12,40 +12,38 @@ component
extends ="contentbox.models.menu.item.BaseMenuItem"
discriminatorValue="SubMenu"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="provider"
+ name="provider"
persistent="false"
- inject ="provider:contentbox.models.menu.providers.SubMenuProvider";
+ inject="provider:contentbox.models.menu.providers.SubMenuProvider";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="menuSlug"
- column ="menuSlug"
+ name="menuSlug"
+ column="menuSlug"
notnull="false"
ormtype="string"
default="";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "menuSlug" ] = { required : false, size : "1..255" };
+ this.constraints[ "menuSlug" ] = { required: false, size: "1..255" };
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
- appendToMemento( [ "menuSlug" ], "defaultIncludes" );
+ appendToMemento( [ "menuSlug"], "defaultIncludes" );
return this;
}
@@ -55,7 +53,7 @@ component
*
* @options.hint Additional arguments to be used in the method
*/
- public boolean function canDisplay( required struct options = {} ){
+ public boolean function canDisplay( required struct options = {} ) {
var display = super.canDisplay( argumentCollection = arguments );
if ( display ) {
var slug = getMenuSlug();
@@ -64,4 +62,4 @@ component
return display;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/item/URLMenuItem.cfc b/modules/contentbox/models/menu/item/URLMenuItem.cfc
index 52db84f625..a0c2762a95 100644
--- a/modules/contentbox/models/menu/item/URLMenuItem.cfc
+++ b/modules/contentbox/models/menu/item/URLMenuItem.cfc
@@ -12,59 +12,57 @@ component
extends ="contentbox.models.menu.item.BaseMenuItem"
discriminatorValue="URL"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="provider"
+ name="provider"
persistent="false"
- inject ="provider:contentbox.models.menu.providers.URLProvider";
+ inject="provider:contentbox.models.menu.providers.URLProvider";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="url"
- column ="url"
+ name="url"
+ column="url"
notnull="false"
ormtype="string"
default="";
property
- name ="target"
- column ="target"
+ name="target"
+ column="target"
notnull="false"
ormtype="string"
default="";
property
- name ="urlClass"
- column ="urlClass"
+ name="urlClass"
+ column="urlClass"
notnull="false"
ormtype="string"
default="";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
-
- this.constraints[ "url" ] = { required : false, size : "1..255" };
- this.constraints[ "target" ] = { required : false, size : "1..255" };
- this.constraints[ "urlClass" ] = { required : false, size : "1..255" };
+ this.constraints[ "url" ] = { required: false, size: "1..255" };
+ this.constraints[ "target" ] = { required: false, size: "1..255" };
+ this.constraints[ "urlClass" ] = { required: false, size: "1..255" };
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
- appendToMemento( [ "target", "url", "urlClass" ], "defaultIncludes" );
+ appendToMemento( [ "target", "url", "urlClass"], "defaultIncludes" );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/BaseProvider.cfc b/modules/contentbox/models/menu/providers/BaseProvider.cfc
index 16f1596f05..73d05bc106 100644
--- a/modules/contentbox/models/menu/providers/BaseProvider.cfc
+++ b/modules/contentbox/models/menu/providers/BaseProvider.cfc
@@ -6,16 +6,15 @@
* Base Provider
*/
component accessors="true" {
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property name="renderer" inject="coldbox:renderer";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property name="name" type="string";
@@ -27,43 +26,43 @@ component accessors="true" {
property name="description" type="string";
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Gets the name of the menu item provider
*/
- public string function getName(){
+ public string function getName() {
return name;
}
/**
* Gets the entityName for the menu item provider
*/
- public string function getEntityName(){
+ public string function getEntityName() {
return entityName;
}
/**
* Gets the name of the menu item provider
*/
- public string function getType(){
+ public string function getType() {
return type;
}
/**
* Gets the iconCls of the menu item provider
*/
- public string function getIconClass(){
+ public string function getIconClass() {
return iconClass;
}
/**
* Gets the description of the menu item provider
*/
- public string function getDescription(){
+ public string function getDescription() {
return description;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/ContentProvider.cfc b/modules/contentbox/models/menu/providers/ContentProvider.cfc
index 6a7fa81310..032329de65 100644
--- a/modules/contentbox/models/menu/providers/ContentProvider.cfc
+++ b/modules/contentbox/models/menu/providers/ContentProvider.cfc
@@ -8,25 +8,26 @@
component
implements="contentbox.models.menu.providers.IMenuItemProvider"
extends ="contentbox.models.menu.providers.BaseProvider"
- accessors =true
+ accessors ="#true#"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property name="contentService" inject="id:contentService@contentbox";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
+
property name="requestService" inject="coldbox:requestService";
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- public ContentProvider function init(){
+ public ContentProvider function init() {
setName( "Content" );
setType( "Content" );
setIconClass( "fa fa-archive" );
@@ -41,33 +42,37 @@ component
* @menuItem The menu item object
* @options Additional arguments to be used in the method
*/
- string function getAdminTemplate( required any menuItem, required struct options = {} ){
- var prc = requestService.getContext().getPrivateCollection();
+ string function getAdminTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var prc = requestService.getContext().getPrivateCollection();
var title = "";
- var slug = "";
+ var slug = "";
prc.xehRelatedContentSelector = "#prc.cbAdminEntryPoint#.content.relatedContentSelector";
if ( !isNull( arguments.menuItem.getContentSlug() ) ) {
- var content = contentService.findBySlug(
- slug = arguments.menuItem.getContentSlug(),
- siteID = arguments.menuItem.getMenu().getSiteID()
- );
+ var content = contentService.findBySlug( slug = arguments.menuItem.getContentSlug(),
+ siteID = arguments
+ .menuItem
+ .getMenu()
+ .getSiteID() );
if ( !isNull( content ) ) {
title = content.getTitle();
- slug = arguments.menuItem.getContentSlug();
+ slug = arguments.menuItem.getContentSlug();
}
}
return variables.renderer.view(
- view = "menus/providers/content/admin",
- module = "contentbox-admin",
- args = {
- menuItem : arguments.menuItem,
- xehContentSelector : "#prc.cbAdminEntryPoint#.content.showRelatedContentSelector",
- title : title,
- slug : slug
- }
- );
+ view = "menus/providers/content/admin",
+ module = "contentbox-admin",
+ args = {
+ menuItem : arguments.menuItem,
+ xehContentSelector: "#prc.cbAdminEntryPoint#.content.showRelatedContentSelector",
+ title : title,
+ slug : slug
+ }
+ );
}
/**
@@ -76,21 +81,25 @@ component
* @menuItem The menu item object
* @options Additional arguments to be used in the method
*/
- string function getDisplayTemplate( required any menuItem, required struct options = {} ){
- var content = variables.contentService.findBySlug(
- slug = arguments.menuItem.getContentSlug(),
- siteID = arguments.menuItem.getMenu().getSiteID()
- );
+ string function getDisplayTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var content = variables.contentService.findBySlug( slug = arguments.menuItem.getContentSlug(),
+ siteID = arguments
+ .menuItem
+ .getMenu()
+ .getSiteID() );
return variables.renderer.externalView(
- view = "/contentbox/models/menu/views/content/display",
- module = "contentbox",
- args = {
- menuItem : arguments.menuItem,
- contentLink : variables.CBHelper.linkContent( content: content ),
- data : arguments.menuItem.getMemento()
- }
- );
+ view = "/contentbox/models/menu/views/content/display",
+ module = "contentbox",
+ args = {
+ menuItem : arguments.menuItem,
+ contentLink: variables.CBHelper.linkContent( content = content ),
+ data : arguments.menuItem.getMemento()
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/FreeProvider.cfc b/modules/contentbox/models/menu/providers/FreeProvider.cfc
index 12ee6c77f7..c5bb2909b9 100644
--- a/modules/contentbox/models/menu/providers/FreeProvider.cfc
+++ b/modules/contentbox/models/menu/providers/FreeProvider.cfc
@@ -8,17 +8,17 @@
component
implements="contentbox.models.menu.providers.IMenuItemProvider"
extends ="contentbox.models.menu.providers.BaseProvider"
- accessors =true
+ accessors ="#true#"
{
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- public FreeProvider function init(){
+ public FreeProvider function init() {
setName( "Free" );
setType( "Free" );
setIconClass( "fa fa-eye" );
@@ -33,7 +33,10 @@ component
* @menuItem.hint The menu item object
* @options.hint Additional arguments to be used in the method
*/
- public string function getAdminTemplate( required any menuItem, required struct options = {} ){
+ public string function getAdminTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
return "";
}
@@ -43,16 +46,19 @@ component
* @menuItem.hint The menu item object
* @options.hint Additional arguments to be used in the method
*/
- public string function getDisplayTemplate( required any menuItem, required struct options = {} ){
+ public string function getDisplayTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
var viewArgs = {
- menuItem : arguments.menuItem,
- data : arguments.menuItem.getMemento()
+ menuItem: arguments.menuItem,
+ data : arguments.menuItem.getMemento()
};
return variables.renderer.externalView(
- view = "/contentbox/models/menu/views/free/display",
- module = "contentbox",
- args = viewArgs
- );
+ view = "/contentbox/models/menu/views/free/display",
+ module = "contentbox",
+ args = viewArgs
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/IMenuItemProvider.cfc b/modules/contentbox/models/menu/providers/IMenuItemProvider.cfc
index da81733144..43b9156aad 100644
--- a/modules/contentbox/models/menu/providers/IMenuItemProvider.cfc
+++ b/modules/contentbox/models/menu/providers/IMenuItemProvider.cfc
@@ -18,5 +18,4 @@ interface {
public string function getAdminTemplate( required any menuItem, required struct options );
public string function getDisplayTemplate( required any menuItem, required struct options );
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/JSProvider.cfc b/modules/contentbox/models/menu/providers/JSProvider.cfc
index 484949b1d6..007f1b3d9c 100644
--- a/modules/contentbox/models/menu/providers/JSProvider.cfc
+++ b/modules/contentbox/models/menu/providers/JSProvider.cfc
@@ -8,17 +8,17 @@
component
implements="contentbox.models.menu.providers.IMenuItemProvider"
extends ="contentbox.models.menu.providers.BaseProvider"
- accessors =true
+ accessors ="#true#"
{
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- public JSProvider function init(){
+ public JSProvider function init() {
setName( "JS" );
setType( "JS" );
setIconClass( "fa fa-code" );
@@ -26,19 +26,23 @@ component
setDescription( "A menu item which executes JavaScript code" );
return this;
}
+
/**
* 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
*/
- public string function getAdminTemplate( required any menuItem, required struct options = {} ){
- var viewArgs = { menuItem : arguments.menuItem };
+ public string function getAdminTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var viewArgs = { menuItem: arguments.menuItem };
return variables.renderer.view(
- view = "menus/providers/js/admin",
- module = "contentbox-admin",
- args = viewArgs
- );
+ view = "menus/providers/js/admin",
+ module = "contentbox-admin",
+ args = viewArgs
+ );
}
/**
@@ -47,13 +51,16 @@ component
* @menuItem.hint The menu item object
* @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 };
+ public string function getDisplayTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var viewArgs = { menuItem: arguments.menuItem };
return variables.renderer.externalView(
- view = "/contentbox/models/menu/views/js/display",
- module = "contentbox",
- args = viewArgs
- );
+ view = "/contentbox/models/menu/views/js/display",
+ module = "contentbox",
+ args = viewArgs
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/MediaProvider.cfc b/modules/contentbox/models/menu/providers/MediaProvider.cfc
index 6c4d4ac035..022df03f16 100644
--- a/modules/contentbox/models/menu/providers/MediaProvider.cfc
+++ b/modules/contentbox/models/menu/providers/MediaProvider.cfc
@@ -8,23 +8,22 @@
component
implements="contentbox.models.menu.providers.IMenuItemProvider"
extends ="contentbox.models.menu.providers.BaseProvider"
- accessors =true
+ accessors ="#true#"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property name="requestService" inject="coldbox:requestService";
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- public MediaProvider function init(){
+ public MediaProvider function init() {
setName( "Media" );
setType( "Media" );
setIconClass( "fas fa-photo-video" );
@@ -32,36 +31,44 @@ component
setDescription( "A menu item to a media item" );
return this;
}
+
/**
* 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
*/
- public string function getAdminTemplate( required any menuItem, required struct options = {} ){
+ public string function getAdminTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
var viewArgs = {
- menuItem : arguments.menuItem,
- xehMediaSelector : "#requestService.getContext().buildLink( to = "cbadmin.menus.filebrowser" )#"
+ menuItem : arguments.menuItem,
+ xehMediaSelector: "#requestService.getContext().buildLink( to = "cbadmin.menus.filebrowser" )#"
};
return variables.renderer.view(
- view = "menus/providers/media/admin",
- module = "contentbox-admin",
- args = viewArgs
- );
+ view = "menus/providers/media/admin",
+ module = "contentbox-admin",
+ args = viewArgs
+ );
}
+
/**
* 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
*/
- public string function getDisplayTemplate( required any menuItem, required struct options = {} ){
- var viewArgs = { menuItem : arguments.menuItem };
+ public string function getDisplayTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var viewArgs = { menuItem: arguments.menuItem };
return variables.renderer.externalView(
- view = "/contentbox/models/menu/views/media/display",
- module = "contentbox",
- args = viewArgs
- );
+ view = "/contentbox/models/menu/views/media/display",
+ module = "contentbox",
+ args = viewArgs
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/SubMenuProvider.cfc b/modules/contentbox/models/menu/providers/SubMenuProvider.cfc
index 2dfd99c89b..ff578da98c 100644
--- a/modules/contentbox/models/menu/providers/SubMenuProvider.cfc
+++ b/modules/contentbox/models/menu/providers/SubMenuProvider.cfc
@@ -8,24 +8,24 @@
component
implements="contentbox.models.menu.providers.IMenuItemProvider"
extends ="contentbox.models.menu.providers.BaseProvider"
- accessors =true
+ accessors ="#true#"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property name="menuService" inject="id:menuService@contentbox";
+
property name="requestService" inject="coldbox:requestService";
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- public SubMenuProvider function init(){
+ public SubMenuProvider function init() {
setName( "SubMenu" );
setType( "SubMenu" );
setIconClass( "fa fa-bars" );
@@ -33,15 +33,19 @@ component
setDescription( "A menu item which encapsulates another menu" );
return this;
}
+
/**
* 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
*/
- public string function getAdminTemplate( required any menuItem, required struct options = {} ){
- var rc = requestService.getContext().getCollection();
- var criteria = menuService.newCriteria();
+ public string function getAdminTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var rc = requestService.getContext().getCollection();
+ var criteria = menuService.newCriteria();
var existingSlug = "";
if ( structKeyExists( rc, "menuID" ) && len( rc.menuID ) ) {
criteria.ne( "menuID", rc.menuID );
@@ -49,31 +53,35 @@ component
if ( !isNull( arguments.menuItem.getMenuSlug() ) ) {
existingSlug = arguments.menuItem.getMenuSlug();
}
- var menus = criteria.list( sortOrder = "title ASC" );
- var viewArgs = { menus : menus, existingSlug : existingSlug };
+ var menus = criteria.list( sortOrder = "title ASC" );
+ var viewArgs = { menus: menus, existingSlug: existingSlug };
return variables.renderer.view(
- view = "menus/providers/submenu/admin",
- module = "contentbox-admin",
- args = viewArgs
- );
+ view = "menus/providers/submenu/admin",
+ module = "contentbox-admin",
+ args = viewArgs
+ );
}
+
/**
* 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
*/
- public string function getDisplayTemplate( required any menuItem, required struct options = {} ){
+ public string function getDisplayTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
var viewArgs = {
- menuItem : arguments.menuItem,
- data : arguments.menuItem.getMemento(),
- slugCache : arguments.options.slugCache
+ menuItem : arguments.menuItem,
+ data : arguments.menuItem.getMemento(),
+ slugCache: arguments.options.slugCache
};
return variables.renderer.externalView(
- view = "/contentbox/models/menu/views/submenu/display",
- module = "contentbox",
- args = viewArgs
- );
+ view = "/contentbox/models/menu/views/submenu/display",
+ module = "contentbox",
+ args = viewArgs
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/providers/URLProvider.cfc b/modules/contentbox/models/menu/providers/URLProvider.cfc
index ad516c251a..8dbfbafe43 100644
--- a/modules/contentbox/models/menu/providers/URLProvider.cfc
+++ b/modules/contentbox/models/menu/providers/URLProvider.cfc
@@ -11,14 +11,14 @@ component
accessors ="true"
{
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- public URLProvider function init(){
+ public URLProvider function init() {
setName( "URL" );
setType( "URL" );
setIconClass( "fa fa-link" );
@@ -33,13 +33,16 @@ component
* @menuItem.hint The menu item object
* @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 };
+ public string function getAdminTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
+ var viewArgs = { menuItem: arguments.menuItem };
return variables.renderer.view(
- view = "menus/providers/url/admin",
- module = "contentbox-admin",
- args = viewArgs
- );
+ view = "menus/providers/url/admin",
+ module = "contentbox-admin",
+ args = viewArgs
+ );
}
/**
@@ -48,16 +51,19 @@ component
* @menuItem.hint The menu item object
* @options.hint Additional arguments to be used in the method
*/
- public string function getDisplayTemplate( required any menuItem, required struct options = {} ){
+ public string function getDisplayTemplate(
+ required any menuItem,
+ required struct options = {}
+ ) {
var viewArgs = {
- menuItem : arguments.menuItem,
- data : arguments.menuItem.getMemento()
+ menuItem: arguments.menuItem,
+ data : arguments.menuItem.getMemento()
};
return variables.renderer.externalView(
- view = "/contentbox/models/menu/views/url/display",
- module = "contentbox",
- args = viewArgs
- );
+ view = "/contentbox/models/menu/views/url/display",
+ module = "contentbox",
+ args = viewArgs
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/views/content/display.cfm b/modules/contentbox/models/menu/views/content/display.cfm
index 58c99e8a87..535e2054ba 100644
--- a/modules/contentbox/models/menu/views/content/display.cfm
+++ b/modules/contentbox/models/menu/views/content/display.cfm
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/views/free/display.cfm b/modules/contentbox/models/menu/views/free/display.cfm
index d6db7664f8..c3dc4d5a47 100644
--- a/modules/contentbox/models/menu/views/free/display.cfm
+++ b/modules/contentbox/models/menu/views/free/display.cfm
@@ -1,3 +1,3 @@
- #args.menuItem.getLabel()#
+ #args.menuItem.getLabel()#
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/views/js/display.cfm b/modules/contentbox/models/menu/views/js/display.cfm
index 1a969eda69..fe3e1a7009 100644
--- a/modules/contentbox/models/menu/views/js/display.cfm
+++ b/modules/contentbox/models/menu/views/js/display.cfm
@@ -1,9 +1,9 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/views/media/display.cfm b/modules/contentbox/models/menu/views/media/display.cfm
index af80bb4e52..a0204719e1 100644
--- a/modules/contentbox/models/menu/views/media/display.cfm
+++ b/modules/contentbox/models/menu/views/media/display.cfm
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/views/submenu/display.cfm b/modules/contentbox/models/menu/views/submenu/display.cfm
index 276d00a553..6fa775cb82 100644
--- a/modules/contentbox/models/menu/views/submenu/display.cfm
+++ b/modules/contentbox/models/menu/views/submenu/display.cfm
@@ -1,4 +1,7 @@
- #args.menuItem.getLabel()#
- #cb.menu( slug="#args.data.menuSlug#", type="html", slugCache=args.slugCache )#
+ #args.menuItem.getLabel()##cb.menu(
+ slug = "#args.data.menuSlug#",
+ type = "html",
+ slugCache = args.slugCache
+ )#
\ No newline at end of file
diff --git a/modules/contentbox/models/menu/views/url/display.cfm b/modules/contentbox/models/menu/views/url/display.cfm
index 7c5dbc1a3b..3d66b7da5d 100644
--- a/modules/contentbox/models/menu/views/url/display.cfm
+++ b/modules/contentbox/models/menu/views/url/display.cfm
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file
diff --git a/modules/contentbox/models/modules/Module.cfc b/modules/contentbox/models/modules/Module.cfc
index 8f68daffa9..4c29b4a735 100644
--- a/modules/contentbox/models/modules/Module.cfc
+++ b/modules/contentbox/models/modules/Module.cfc
@@ -13,101 +13,99 @@ component
cachename ="cbModule"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="moduleID"
- column ="moduleID"
+ name="moduleID"
+ column="moduleID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="name"
- column ="name"
+ name="name"
+ column="name"
notnull="true"
- length ="255"
- index ="idx_moduleName";
+ length="255"
+ index="idx_moduleName";
property
- name ="title"
- column ="title"
+ name="title"
+ column="title"
notnull="false"
- length ="255"
+ length="255"
default="";
property
- name ="version"
- column ="version"
+ name="version"
+ column="version"
notnull="false"
- length ="255"
+ length="255"
default="0";
property
- name ="entryPoint"
- column ="entryPoint"
+ name="entryPoint"
+ column="entryPoint"
notnull="false"
- length ="255"
+ length="255"
default=""
- index ="idx_entryPoint";
+ index="idx_entryPoint";
property
- name ="author"
- column ="author"
+ name="author"
+ column="author"
notnull="false"
- length ="255"
+ length="255"
default="";
property
- name ="webURL"
- column ="webURL"
+ name="webURL"
+ column="webURL"
notnull="false"
- length ="500"
+ length="500"
default="";
property
- name ="forgeBoxSlug"
- column ="forgeBoxSlug"
+ name="forgeBoxSlug"
+ column="forgeBoxSlug"
notnull="false"
- length ="255"
+ length="255"
default="";
property
- name ="description"
- column ="description"
+ name="description"
+ column="description"
notnull="false"
ormtype="text"
- length ="8000"
+ length="8000"
default="";
property
- name ="isActive"
- column ="isActive"
+ name="isActive"
+ column="isActive"
notnull="true"
ormtype="boolean"
default="false"
- index ="idx_activeModule";
+ index="idx_activeModule";
property
- name ="moduleType"
- column ="moduleType"
- default ="core"
+ name="moduleType"
+ column="moduleType"
+ default="core"
dbdefault="'unknown'"
- index ="idx_moduleType";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ index="idx_moduleType";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "moduleID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"author",
"description",
"entryPoint",
@@ -119,21 +117,21 @@ component
"version",
"webURL"
],
- defaultExcludes : [ "" ]
+ defaultExcludes: [ ""]
};
this.constraints = {
- "name" : { required : true, size : "1..255" },
- "title" : { required : true, size : "1..255" },
- "version" : { required : false, size : "1..255" },
- "entryPoint" : { required : false, size : "1..255" },
- "author" : { required : false, size : "1..255" },
- "webURL" : { required : false, size : "1..500" },
- "forgeBoxSlug" : { required : false, size : "1..255" }
+ "name" : { required: true, size: "1..255" },
+ "title" : { required: true, size: "1..255" },
+ "version" : { required: false, size: "1..255" },
+ "entryPoint" : { required: false, size: "1..255" },
+ "author" : { required: false, size: "1..255" },
+ "webURL" : { required: false, size: "1..500" },
+ "forgeBoxSlug": { required: false, size: "1..255" }
};
- function init(){
- variables.isActive = false;
+ function init() {
+ variables.isActive = false;
variables.moduleType = "core";
super.init();
@@ -141,4 +139,4 @@ component
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/modules/ModuleService.cfc b/modules/contentbox/models/modules/ModuleService.cfc
index 9c8b09c503..dc1f432600 100644
--- a/modules/contentbox/models/modules/ModuleService.cfc
+++ b/modules/contentbox/models/modules/ModuleService.cfc
@@ -5,19 +5,20 @@
* ---
* Manage ContentBox Modules
*/
-component
- extends ="cborm.models.VirtualEntityService"
- accessors="true"
- singleton
- threadsafe
-{
-
+component extends ="cborm.models.VirtualEntityService" accessors="true" singleton threadsafe {
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="widgetService" inject="provider:widgetService@contentbox";
+
property name="contentBoxSettings" inject="coldbox:moduleConfig:contentbox";
- property name="customModuleSettings" inject="coldbox:moduleConfig:contentbox-custom";
+
+ property
+ name="customModuleSettings"
+ inject="coldbox:moduleConfig:contentbox-custom";
+
property name="coldboxModuleService" inject="coldbox:moduleService";
+
property name="log" inject="logbox:logger:{this}";
/**
@@ -60,27 +61,26 @@ component
*/
property name="moduleMap" type="struct";
-
/**
* Constructor
*/
- ModuleService function init(){
+ ModuleService function init() {
// init it
super.init( entityName = "cbModule" );
- variables.customModulesPath = "";
+ variables.customModulesPath = "";
variables.customModulesInvocationPath = "";
- variables.coreModulesPath = "";
- variables.coreModulesInvocationPath = "";
- variables.moduleWidgetCache = {};
- variables.moduleRegistry = {};
- variables.moduleConfigCache = {};
+ variables.coreModulesPath = "";
+ variables.coreModulesInvocationPath = "";
+ variables.moduleWidgetCache = {};
+ variables.moduleRegistry = {};
+ variables.moduleConfigCache = {};
/**
* Stores all module information when loaded:
* {
- * type : "The module type : core or custom",
- * path : The absolute path,
- * invocationPath : The invocation path
+ * type : "The module type : core or custom",
+ * path : The absolute path,
+ * invocationPath : The invocation path
* }
*/
variables.moduleMap = {};
@@ -91,17 +91,17 @@ component
/**
* Executes after DI completion
*/
- function onDIComplete(){
+ function onDIComplete() {
// Setup Core Modules
- variables.coreModulesPath = variables.contentBoxSettings.path & "/modules_user";
+ variables.coreModulesPath = variables.contentBoxSettings.path & "/modules_user";
variables.coreModulesInvocationPath = variables.contentBoxSettings.invocationPath & ".modules_user";
// Setup Custom Modules
- variables.customModulesPath = variables.customModuleSettings.path & "/_modules";
+ variables.customModulesPath = variables.customModuleSettings.path & "/_modules";
variables.customModulesInvocationPath = variables.customModuleSettings.invocationPath & "._modules";
// Module Registry + Config Cache References
- variables.moduleRegistry = variables.coldboxModuleService.getModuleRegistry();
+ variables.moduleRegistry = variables.coldboxModuleService.getModuleRegistry();
variables.moduleConfigCache = variables.coldboxModuleService.getModuleConfigCache();
}
@@ -113,7 +113,7 @@ component
*
* @return The module populated
*/
- any function populateModule( any module, any config ){
+ any function populateModule( any module, any config ) {
arguments.module.setTitle( arguments.config.title ?: "" );
arguments.module.setAuthor( arguments.config.author ?: "" );
arguments.module.setWebURL( arguments.config.webURL ?: "" );
@@ -131,9 +131,9 @@ component
*
* @return The persisted module or a new module object representing not found.
*/
- Module function findModuleByEntryPoint( required entryPoint ){
- var module = findWhere( { entryPoint : arguments.entryPoint } );
- return ( isNull( module ) ? new () : module );
+ Module function findModuleByEntryPoint( required entryPoint ) {
+ var module = findWhere( { entryPoint: arguments.entryPoint } );
+ return ( isNull( module ) ? new() : module );
}
/**
@@ -144,12 +144,12 @@ component
*
* @return struct:{ count:numeric, modules:array of objects }
*/
- struct function findModules( isActive = "any", moduleType ){
- var results = {};
+ struct function findModules( isActive = "any", moduleType ) {
+ var results = {};
var criteria = newCriteria();
// isApproved filter
- if ( !isNull( arguments.isActive ) AND arguments.isActive NEQ "any" ) {
+ if ( !isNull( arguments.isActive ) && arguments.isActive NEQ "any" ) {
criteria.isEq( "isActive", javacast( "Boolean", arguments.isActive ) );
}
@@ -159,7 +159,7 @@ component
}
// run criteria query and projections count
- results.count = criteria.count();
+ results.count = criteria.count();
results.modules = criteria.list( sortOrder = "title", asQuery = false );
return results;
@@ -172,14 +172,16 @@ component
*
* @return The invocation path or empty if not found
*/
- string function getModuleWidgetInvocationPath( required string widgetName ){
+ string function getModuleWidgetInvocationPath( required string widgetName ) {
var path = "";
// if widget name is in module widget cache, return its invocation path
if ( structKeyExists( variables.moduleWidgetCache, arguments.widgetName ) ) {
path = variables.moduleWidgetCache[ arguments.widgetName ].invocationPath;
} else {
- log.error( "Could not find #arguments.widgetname# widget in the module." );
+ log.error(
+ "Could not find #arguments.widgetname# widget in the module."
+ );
}
return path;
}
@@ -190,24 +192,27 @@ component
* @name The name of the module to register
* @type The type of module: core or custom
*/
- Module function registerNewModule( required name, required type ){
- var thisPath = variables[ arguments.type & "ModulesPath" ];
+ Module function registerNewModule( required name, required type ) {
+ var thisPath = variables[ arguments.type & "ModulesPath" ];
var thisInvocationPath = variables[ arguments.type & "ModulesInvocationPath" ];
if ( fileExists( thisPath & "/#arguments.name#/ModuleConfig.cfc" ) ) {
- var oConfig = createObject( "component", thisInvocationPath & ".#arguments.name#.ModuleConfig" );
- var oModule = new ( { name : arguments.name, moduleType : arguments.type } );
+ var oConfig = createObject(
+ "component",
+ thisInvocationPath & ".#arguments.name#.ModuleConfig"
+ );
+ var oModule = new( { name: arguments.name, moduleType: arguments.type } );
save( populateModule( oModule, oConfig ) );
return oModule;
} else {
log.error(
- "Cannot register new module #arguments.name# as it is not a valid ContentBox Module. No ModuleConfig.cfc found."
- );
+ "Cannot register new module #arguments.name# as it is not a valid ContentBox Module. No ModuleConfig.cfc found."
+ );
}
- return new ( { name : arguments.name } );
+ return new( { name: arguments.name } );
}
/**
@@ -215,9 +220,9 @@ component
*
* @name The module to deactivate
*/
- ModuleService function deactivateModule( required name ){
+ ModuleService function deactivateModule( required name ) {
// Get Module Record
- var oModule = findWhere( { name : arguments.name } );
+ var oModule = findWhere( { name: arguments.name } );
// deactivate record
oModule.setIsActive( false );
@@ -230,8 +235,13 @@ component
if ( structKeyExists( config, "onDeactivate" ) ) {
try {
config.onDeactivate();
- } catch ( Any e ) {
- log.error( "Error deactivating module: #arguments.name# with #e.message & e.detail#", e );
+ } catch (Any e) {
+ log.error(
+ "Error deactivating module: #arguments.name# with #e.message & e.detail#",
+ e
+ );
+
+
// dont' throw. just log and continue deactivating modules.
}
}
@@ -250,26 +260,13 @@ component
return this;
}
- /**
- * Detach coldbox module configuration registrations
- *
- * @name The name of the module to detach
- */
- private ModuleService function detachColdBoxModuleRegistration( required name ){
- // Verify in module registry
- if ( structKeyExists( variables.moduleRegistry, arguments.name ) ) {
- structDelete( variables.moduleRegistry, arguments.name );
- }
- return this;
- }
-
/**
* Activate a module from ContentBox
*
* @name The name of the module to activate
*/
- ModuleService function activateModule( required name ){
- var oModule = findWhere( { name : arguments.name } );
+ ModuleService function activateModule( required name ) {
+ var oModule = findWhere( { name: arguments.name } );
var sModuleMap = variables.moduleMap[ arguments.name ];
// Set module as active
@@ -287,7 +284,7 @@ component
if ( structKeyExists( oConfig, "onActivate" ) ) {
try {
oConfig.onActivate();
- } catch ( Any e ) {
+ } catch (Any e) {
// deactivate module, it did not activate correctly
oModule.setIsActive( false );
// deactivate from ColdBox as it did not activate correctly
@@ -312,12 +309,15 @@ component
*
* @name The name of the module to delete
*/
- ModuleService function deleteModule( required name ){
+ ModuleService function deleteModule( required name ) {
var moduleEntry = variables.moduleMap[ arguments.name ];
// 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" );
+ var oConfig = createObject(
+ "component",
+ moduleEntry.invocationPath & ".#arguments.name#.ModuleConfig"
+ );
if ( structKeyExists( oConfig, "onDelete" ) ) {
oConfig.onDelete();
}
@@ -335,7 +335,7 @@ component
/**
* Reset all modules by deactivating all of them and cleaning our db history
*/
- ModuleService function resetModules(){
+ ModuleService function resetModules() {
var aModules = list( asQuery = false );
transaction {
@@ -356,28 +356,29 @@ component
return this;
}
-
-
/**
* Startup the service. This iterates through all modules on disk and if it finds a module that it has not been
* registered, it will register it. If it loads a module that is registered and marked as active it will activate it.
*/
- ModuleService function startup(){
+ ModuleService function startup() {
// Get all modules
var aModules = getAll();
// Register ColdBox Module Closure
- var registerColdBoxModule = function( name, moduleType, invocationPath, path ){
+ var registerColdBoxModule = function( name, moduleType, invocationPath, path ) {
// var oModule = findWhere( { name : arguments.name } );
- var oModule = aModules.reduce( function( results, thisModule ){
- return ( thisModule.getName() == name ? thisModule : results );
- }, {} );
+ var oModule = aModules.reduce(
+ function( results, thisModule ) {
+ return ( thisModule.getName() == name ? thisModule : results );
+ },
+ {}
+ );
// Register type lookup for faster finding, instead of querying the db.
variables.moduleMap[ arguments.name ] = {
- type : arguments.moduleType,
- path : arguments.path,
- invocationPath : arguments.invocationPath
+ type : arguments.moduleType,
+ path : arguments.path,
+ invocationPath: arguments.invocationPath
};
// check if module already in database records or new
@@ -388,12 +389,10 @@ 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() && !structKeyExists( variables.moduleRegistry, arguments.name ) ) {
// Register with ColdBox now
- variables.coldboxModuleService.registerModule(
- moduleName = arguments.name,
- invocationPath = arguments.invocationPath
- );
+ variables.coldboxModuleService.registerModule( moduleName = arguments.name,
+ invocationPath = arguments.invocationPath );
// Module registered, move to activation
return true;
}
@@ -403,49 +402,68 @@ component
};
// Register and Activate Core Modules First
- getModulesOnDisk( variables.coreModulesPath )
- .filter( function( name ){
- return registerColdBoxModule(
- arguments.name,
- "core",
- variables.coreModulesInvocationPath,
- variables.coreModulesPath
- );
- } )
- .each( function( name ){
- variables.coldboxModuleService.activateModule( arguments.name );
- } );
+ getModulesOnDisk( variables.coreModulesPath ).filter(
+ function( name ) {
+ return registerColdBoxModule(
+ arguments.name,
+ "core",
+ variables.coreModulesInvocationPath,
+ variables.coreModulesPath
+ );
+ }
+ ).each(
+ function( name ) {
+ variables.coldboxModuleService.activateModule( arguments.name );
+ }
+ );
// Register and Activate Custom Modules
- getModulesOnDisk( variables.customModulesPath )
- .filter( function( name ){
- return registerColdBoxModule(
- arguments.name,
- "custom",
- variables.customModulesInvocationPath,
- variables.customModulesPath
- );
- } )
- .each( function( name ){
- variables.coldboxModuleService.activateModule( arguments.name );
- } );
+ getModulesOnDisk( variables.customModulesPath ).filter(
+ function( name ) {
+ return registerColdBoxModule(
+ arguments.name,
+ "custom",
+ variables.customModulesInvocationPath,
+ variables.customModulesPath
+ );
+ }
+ ).each(
+ function( name ) {
+ variables.coldboxModuleService.activateModule( arguments.name );
+ }
+ );
// build widget cache
buildModuleWidgetsCache(
- aModules.filter( function( thisModule ){
- return arguments.thisModule.getIsActive();
- } )
+ aModules.filter(
+ function( thisModule ) {
+ return arguments.thisModule.getIsActive();
+ }
+ )
);
return this;
}
+ /**
+ * Detach coldbox module configuration registrations
+ *
+ * @name The name of the module to detach
+ */
+ private ModuleService function detachColdBoxModuleRegistration( required name ) {
+ // Verify in module registry
+ if ( structKeyExists( variables.moduleRegistry, arguments.name ) ) {
+ structDelete( variables.moduleRegistry, arguments.name );
+ }
+ return this;
+ }
+
/**
* Iterates over all registered, active modules and sets any found widgets into a cache in moduleservice
*
* @modules Optional passed array to use to build the module cache with, else query the database
*/
- private ModuleService function buildModuleWidgetsCache( array modules ){
+ private ModuleService function buildModuleWidgetsCache( array modules ) {
// Init Module Widget Cache
variables.moduleWidgetCache = {};
@@ -455,41 +473,59 @@ component
}
// Process Module Widgets
- arguments.modules
- .filter( function( thisModule ){
- // Active and On Disk Module?
- if ( variables.moduleMap.keyExists( thisModule.getName() ) ) {
- return true;
- }
-
- // 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" );
+ arguments
+ .modules
+ .filter(
+ function( thisModule ) {
+ if ( variables.moduleMap.keyExists( thisModule.getName() ) ) {
+ return true;
+ }
+
+ if ( log.canWarn() ) {
+ log.warn(
+ "Orphaned module discovered: #thisModule.getName()#, deactiving it from the database"
+ );
+ }
+ deactivateModule( thisModule.getName() );
+ return false;
}
- deactivateModule( thisModule.getName() );
- return false;
- } )
- .each( function( thisModule ){
- // Module reference maps pointer
- var moduleRecord = variables.moduleMap[ thisModule.getName() ];
- // Widgets path + local Reference
- var thisWidgetsPath = moduleRecord.path & "/" & thisModule.getName() & "/widgets";
-
- // check that module widgets folder exists on disk, if so, iterate and register
- if ( directoryExists( thisWidgetsPath ) ) {
- directoryList( thisWidgetsPath, false, "name", "*.cfc" ).each( function( thisWidget ){
- var widgetName = reReplaceNoCase( thisWidget, ".cfc", "", "all" );
- // Store Record
- variables.moduleWidgetCache[ widgetName & "@" & thisModule.getName() ] = {
- name : widgetName,
- invocationPath : moduleRecord.invocationPath & ".#thisModule.getName()#.widgets.#widgetName#",
- path : thisWidgetsPath & "/" & thisWidget,
- module : thisModule.getName()
- };
- } );
+ )
+ // Active and On Disk Module?
+
+ // Deactivate it, not fond in registry, might be an orphaned record
+
+ .each(
+ function( thisModule ) {
+ var moduleRecord = variables.moduleMap[ thisModule.getName() ];
+
+ var thisWidgetsPath = moduleRecord.path & "/" & thisModule.getName() & "/widgets";
+
+ if ( directoryExists( thisWidgetsPath ) ) {
+ directoryList(
+ thisWidgetsPath,
+ false,
+ "name",
+ "*.cfc"
+ ).each(
+ function( thisWidget ) {
+ var widgetName = reReplaceNoCase(
+ thisWidget,
+ ".cfc",
+ "",
+ "all"
+ );
+
+ variables.moduleWidgetCache[ widgetName & "@" & thisModule.getName() ] = {
+ name : widgetName,
+ invocationPath: moduleRecord.invocationPath & ".#thisModule.getName()#.widgets.#widgetName#",
+ path : thisWidgetsPath & "/" & thisWidget,
+ module : thisModule.getName()
+ };
+ }
+ );
+ }
}
- // end if widgets found
- } );
+ );
// Force Reload all widgets
variables.widgetService.getWidgets( reload = true );
@@ -504,7 +540,7 @@ component
*
* @return An array of names found on disk
*/
- private array function getModulesOnDisk( required path ){
+ private array function getModulesOnDisk( required path ) {
// path, recurse, listInfo, filter, sort, type
return directoryList(
arguments.path,
@@ -513,9 +549,11 @@ component
"",
"name asc",
"dir"
- ).filter( function( name ){
- return ( left( name, 1 ) neq "." );
- } );
+ ).filter(
+ function( name ) {
+ return ( left( name, 1 ) NEQ "." );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/modules/custom/ModuleConfigBase.cfc b/modules/contentbox/models/modules/custom/ModuleConfigBase.cfc
index 98ca6802b6..5c3759f508 100644
--- a/modules/contentbox/models/modules/custom/ModuleConfigBase.cfc
+++ b/modules/contentbox/models/modules/custom/ModuleConfigBase.cfc
@@ -9,32 +9,31 @@
* - modules - custom modules
*/
component {
-
// Module Properties
- this.title = "ContentBox Custom Module";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.description = "This module is where all custom user assets can be placed and version controlled";
- this.viewParentLookup = true;
+ this.title = "ContentBox Custom Module";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.description = "This module is where all custom user assets can be placed and version controlled";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
// URL Entry Point
- this.entryPoint = "cbCustom";
+ this.entryPoint = "cbCustom";
// Model Namespace
- this.modelNamespace = "contentbox-custom";
+ this.modelNamespace = "contentbox-custom";
// CF Mapping
- this.cfmapping = "contentbox-custom";
+ this.cfmapping = "contentbox-custom";
// ContentBox must be loaded first
- this.dependencies = [ "contentbox" ];
+ this.dependencies = [ "contentbox"];
/**
* Configure Module
*/
- function configure(){
+ function configure() {
// contentbox settings
settings = {};
// CB Module Conventions
- conventions = { layoutsLocation : "_themes", viewsLocation : "_themes" };
+ conventions = { layoutsLocation: "_themes", viewsLocation: "_themes" };
// Parent Affected Settings
parentSettings = {};
@@ -42,7 +41,7 @@ component {
// interceptor settings
interceptorSettings = {
// ContentBox Custom Events
- customInterceptionPoints : []
+ customInterceptionPoints: []
};
// interceptors
@@ -52,21 +51,24 @@ component {
/**
* Development tier
*/
- function development(){
+ function development() {
+
}
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
+
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
+
}
- /************************************** PRIVATE *********************************************/
-}
+ /************************************** PRIVATE *********************************************/
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/rss/RSSCacheCleanup.cfc b/modules/contentbox/models/rss/RSSCacheCleanup.cfc
index 0483b28f0e..97fc76f192 100644
--- a/modules/contentbox/models/rss/RSSCacheCleanup.cfc
+++ b/modules/contentbox/models/rss/RSSCacheCleanup.cfc
@@ -1,45 +1,47 @@
-/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* This interceptor monitors new comments and new entries to clear RSS cache entries
-*/
+/**
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * This interceptor monitors new comments and new entries to clear RSS cache entries
+ */
component extends="coldbox.system.Interceptor" {
// Listen when entries are saved
- function cbadmin_postEntrySave( event, data ){
+ function cbadmin_postEntrySave( event, data ) {
getInstance( "rssService@contentbox" ).clearCaches();
}
// Listen when entries are removed
- function cbadmin_postEntryRemove( event, data ){
+ function cbadmin_postEntryRemove( event, data ) {
getInstance( "rssService@contentbox" ).clearCaches();
}
// Listen when comments are made
- function cbui_onCommentPost( event, data ){
- getInstance( "rssService@contentbox" ).clearCaches(
- comments = true,
- slug = arguments.data.comment.getRelatedContent().getSlug()
- );
+ function cbui_onCommentPost( event, data ) {
+ getInstance( "rssService@contentbox" ).clearCaches( comments = true,
+ slug = arguments
+ .data
+ .comment
+ .getRelatedContent()
+ .getSlug() );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/rss/RSSService.cfc b/modules/contentbox/models/rss/RSSService.cfc
index 96ceba7852..a3e81104e2 100755
--- a/modules/contentbox/models/rss/RSSService.cfc
+++ b/modules/contentbox/models/rss/RSSService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -7,443 +7,463 @@
*/
component singleton {
- // DI
- property name="entryService" inject="entryService@contentbox";
- property name="pageService" inject="pageService@contentbox";
- property name="contentService" inject="contentService@contentbox";
- property name="commentService" inject="commentService@contentbox";
- property name="CBHelper" inject="CBHelper@contentbox";
- property name="feedGenerator" inject="feedGenerator@cbfeeds";
- property name="log" inject="logbox:logger:{this}";
-
- /**
- * Constructor
- *
- * @settingService.inject id:settingService@contentbox
- * @cacheBox.inject cachebox
- */
- RSSService function init( required settingService, required cacheBox ){
- // Dependencies
- variables.settingService = arguments.settingService;
- variables.cacheBox = arguments.cacheBox;
- // Get all settings
- var settings = settingService.getAllSettings();
- // setup the user selected cache provider
- variables.cache = cacheBox.getCache( settings.cb_rss_cacheName );
-
- return this;
- }
-
- /************************************** PUBLIC *********************************************/
-
- /**
- * Clean RSS caches asynchronously
- *
- * @comments Clear comment caches or not, defaults to false
- * @slug The content slug to clear on
- */
- RSSService function clearCaches( boolean comments = false, string slug = "" ){
- var cacheKey = "";
-
- // compose cache key
- if ( arguments.comments ) {
- cacheKey = "cb-feeds-#cgi.HTTP_HOST#-content-comments-";
- } else {
- cacheKey = "cb-feeds-#cgi.HTTP_HOST#-content";
- }
-
- // clear by snippet
- variables.cache.clearByKeySnippet( keySnippet = cacheKey, async = false );
-
- // log
- if ( variables.log.canInfo() ) {
- variables.log.info(
- "Sent clear command using the following content key: #cacheKey# from provider: #variables.cache.getName()#"
- );
- }
-
- return this;
- }
-
- /**
- * Clean All RSS caches NOW BABY, NOW!
- */
- RSSService function clearAllCaches( boolean async = false ){
- variables.cache.clearByKeySnippet( keySnippet = "cb-feeds", async = arguments.async );
- return this;
- }
-
- /**
- * 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
- * @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
- */
- function getRSS(
- string slug = "",
- boolean comments = false,
- category = "",
- contentType = "",
- string siteID = ""
- ){
- var settings = settingService.getAllSettings();
- var rssFeed = "";
- var cacheKey = "";
-
- // Comments cache Key
- if ( arguments.comments ) {
- cacheKey = "cb-feeds-#cgi.HTTP_HOST#-content-comments-#arguments.slug#";
- }
- // Entries cache Key
- else {
- cacheKey = "cb-feeds-#cgi.HTTP_HOST#-content-#hash( arguments.category & arguments.contentType )#";
- }
-
- // Retrieve via caching? and caching active
- if ( settings.cb_rss_caching ) {
- var rssFeed = variables.cache.get( cacheKey );
- if ( !isNull( rssFeed ) ) {
- return rssFeed;
- }
- }
-
- // Content Type
- switch ( arguments.contentType ) {
- // Pages
- case "page": {
- // Building comment feed or content feed
- if ( arguments.comments ) {
- arguments.contentType = "Page";
- rssfeed = buildCommentFeed( argumentCollection = arguments );
- } else {
- rssfeed = buildPageFeed( argumentCollection = arguments );
- }
- break;
- }
- // Blog
- case "entry": {
- // Building comment feed or content feed
- if ( arguments.comments ) {
- arguments.contentType = "Entry";
- rssfeed = buildCommentFeed( argumentCollection = arguments );
- } else {
- rssfeed = buildEntryFeed( argumentCollection = arguments );
- }
- break;
- }
- // Default Site
- default: {
- // Building comment feed or content feed
- if ( arguments.comments ) {
- rssfeed = buildCommentFeed( argumentCollection = arguments );
- } else {
- rssfeed = buildContentFeed( argumentCollection = arguments );
- }
- break;
- }
- }
- // end content type switch
-
- // Cache it with settings
- if ( settings.cb_rss_caching ) {
- variables.cache.set(
- cacheKey,
- rssFeed,
- settings.cb_rss_cachingTimeout,
- settings.cb_rss_cachingTimeoutIdle
- );
- }
-
- return rssFeed;
- }
-
- /************************************** PRIVATE *********************************************/
-
- /**
- * Build entries feeds
- *
- * @category The category to filter on
- * @siteID The site to filter on
- */
- private function buildEntryFeed( string category = "", string siteID = "" ){
- var settings = settingService.getAllSettings();
- var entryResults = entryService.findPublishedContent(
- category: arguments.category,
- max : settings.cb_rss_maxEntries,
- siteID : arguments.siteID
- );
- var myArray = [];
- var feedStruct = {};
- var columnMap = {};
- var qEntries = entityToQuery( entryResults.content );
-
- // max checks
- if ( settings.cb_rss_maxEntries lt entryResults.count ) {
- entryResults.count = settings.cb_rss_maxEntries;
- }
-
- // Create the column maps
- columnMap.title = "title";
- columnMap.description = "content";
- columnMap.pubDate = "publishedDate";
- columnMap.link = "link";
- columnMap.author = "author";
- columnMap.category_tag = "categories";
-
- // Add necessary columns to query
- queryAddColumn( qEntries, "link", myArray );
- queryAddColumn( qEntries, "linkComments", myArray );
- queryAddColumn( qEntries, "author", myArray );
- queryAddColumn( qEntries, "categories", myArray );
- queryAddColumn( qEntries, "content", myArray );
- queryAddColumn( qEntries, "guid_permalink", myArray );
- queryAddColumn( qEntries, "guid_string", myArray );
-
- // Attach permalinks
- for ( var i = 1; i lte entryResults.count; i++ ) {
- // build URL to entry
- qEntries.link[ i ] = variables.CBHelper.linkEntry( qEntries.slug[ i ] );
- qEntries.guid_permalink[ i ] = false;
- 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();
- if ( entryResults.content[ i ].hasExcerpt() ) {
- qEntries.content[ i ] = entryResults.content[ i ].renderExcerpt();
- } else {
- qEntries.content[ i ] = entryResults.content[ i ].renderContent();
- }
- qEntries.content[ i ] = cleanupContent( qEntries.content[ i ] );
- }
-
- // Generate feed items
- feedStruct.title = "Blog " & settings.cb_rss_title;
- feedStruct.generator = settings.cb_rss_generator;
- feedStruct.copyright = settings.cb_rss_copyright;
- feedStruct.description = settings.cb_rss_description;
- if ( len( settings.cb_rss_webmaster ) ) feedStruct.webmaster = settings.cb_rss_webmaster;
- feedStruct.pubDate = now();
- feedStruct.lastbuilddate = now();
- feedStruct.link = variables.CBHelper.linkHome();
- feedStruct.items = qEntries;
-
- return variables.feedGenerator.createFeed( feedStruct, columnMap );
- }
-
- /**
- * Build pages feeds
- *
- * @category The category to filter on
- * @siteID The site to filter on
- */
- private function buildPageFeed( string category = "", string siteID = "" ){
- var settings = settingService.getAllSettings();
- var pageResults = variables.pageService.findPublishedContent(
- category: arguments.category,
- max : settings.cb_rss_maxEntries,
- siteID : arguments.siteID
- );
- var myArray = [];
- var feedStruct = {};
- var columnMap = {};
- var qPages = entityToQuery( pageResults.content );
-
- // max checks
- if ( settings.cb_rss_maxEntries lt pageResults.count ) {
- pageResults.count = settings.cb_rss_maxEntries;
- }
-
- // Create the column maps
- columnMap.title = "title";
- columnMap.description = "content";
- columnMap.pubDate = "publishedDate";
- columnMap.link = "link";
- columnMap.author = "author";
- columnMap.category_tag = "categories";
-
- // Add necessary columns to query
- queryAddColumn( qPages, "link", myArray );
- queryAddColumn( qPages, "linkComments", myArray );
- queryAddColumn( qPages, "author", myArray );
- queryAddColumn( qPages, "categories", myArray );
- queryAddColumn( qPages, "content", myArray );
- queryAddColumn( qPages, "guid_permalink", myArray );
- queryAddColumn( qPages, "guid_string", myArray );
-
- // Attach permalinks
- for ( var i = 1; i lte pageResults.count; i++ ) {
- // build URL to entry
- qPages.link[ i ] = variables.CBHelper.linkPage( qPages.slug );
- qPages.author[ i ] = "#pageResults.content[ i ].getAuthorEmail()# (#pageResults.content[ i ].getAuthorName()#)";
- qPages.linkComments[ i ] = variables.CBHelper.linkComments( pageResults.content[ i ] );
- qPages.categories[ i ] = pageResults.content[ i ].getCategoriesList();
- qPages.guid_permalink[ i ] = false;
- qPages.guid_string[ i ] = variables.CBHelper.linkPage( qPages.slug );
- if ( pageResults.content[ i ].hasExcerpt() ) {
- qPages.content[ i ] = pageResults.content[ i ].renderExcerpt();
- } else {
- qPages.content[ i ] = pageResults.content[ i ].renderContent();
- }
- qPages.content[ i ] = cleanupContent( qPages.content[ i ] );
- }
-
- // Generate feed items
- feedStruct.title = "Page " & settings.cb_rss_title;
- feedStruct.generator = settings.cb_rss_generator;
- feedStruct.copyright = settings.cb_rss_copyright;
- feedStruct.description = settings.cb_rss_description;
- if ( len( settings.cb_rss_webmaster ) ) feedStruct.webmaster = settings.cb_rss_webmaster;
- feedStruct.pubDate = now();
- feedStruct.lastbuilddate = now();
- feedStruct.link = CBHelper.linkHome();
- feedStruct.items = qPages;
-
- return variables.feedGenerator.createFeed( feedStruct, columnMap );
- }
-
- /**
- * Build content feeds
- *
- * @category The category to filter on
- * @siteID The site to filter on
- */
- private function buildContentFeed( string category = "", string siteID = "" ){
- var settings = variables.settingService.getAllSettings();
- var contentResults = variables.contentService.findPublishedContent(
- category: arguments.category,
- max : settings.cb_rss_maxEntries,
- siteID : arguments.siteID
- );
- var myArray = [];
- var feedStruct = {};
- var columnMap = {};
- var qContent = entityToQuery( contentResults.content );
-
- // max checks
- if ( settings.cb_rss_maxEntries lt contentResults.count ) {
- contentResults.count = settings.cb_rss_maxEntries;
- }
-
- // Create the column maps
- columnMap.title = "title";
- columnMap.description = "content";
- columnMap.pubDate = "publishedDate";
- columnMap.link = "link";
- columnMap.author = "author";
- columnMap.category_tag = "categories";
-
- // Add necessary columns to query
- queryAddColumn( qContent, "link", myArray );
- queryAddColumn( qContent, "linkComments", myArray );
- queryAddColumn( qContent, "author", myArray );
- queryAddColumn( qContent, "categories", myArray );
- queryAddColumn( qContent, "content", myArray );
- queryAddColumn( qContent, "guid_permalink", myArray );
- queryAddColumn( qContent, "guid_string", myArray );
-
- // 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";
-
- // build URL to entry
- qContent.link[ i ] = CBHelper.linkContent( contentResults.content[ i ] );
- qContent.author[ i ] = "#authorEmail# (#authorName#)";
- qContent.linkComments[ i ] = CBHelper.linkComments( contentResults.content[ i ] );
- qContent.categories[ i ] = contentResults.content[ i ].getCategoriesList();
- qContent.content[ i ] = cleanupContent( contentResults.content[ i ].renderContent() );
- qContent.guid_permalink[ i ] = false;
- qContent.guid_string[ i ] = CBHelper.linkContent( contentResults.content[ i ] );
- }
-
- // Generate feed items
- feedStruct.title = "Content " & settings.cb_rss_title;
- feedStruct.generator = settings.cb_rss_generator;
- feedStruct.copyright = settings.cb_rss_copyright;
- feedStruct.description = settings.cb_rss_description;
- if ( len( settings.cb_rss_webmaster ) ) feedStruct.webmaster = settings.cb_rss_webmaster;
- feedStruct.pubDate = now();
- feedStruct.lastbuilddate = now();
- feedStruct.link = CBHelper.linkHome();
- feedStruct.items = qContent;
-
- return variables.feedGenerator.createFeed( feedStruct, columnMap );
- }
-
- /**
- * Build comment feeds according to filtering elements
- *
- * @slug The content slug to filter on
- * @contentType The content type discriminator to filter on
- * @siteID The site to filter on
- */
- private function buildCommentFeed(
- string slug = "",
- string contentType = "",
- string siteID = ""
- ){
- var settings = variables.settingService.getAllSettings();
- var commentResults = variables.commentService.findAllApproved(
- contentID : variables.contentService.getIDBySlug( arguments.slug ),
- contentType: arguments.contentType,
- max : settings.cb_rss_maxComments,
- siteID : arguments.siteID
- );
- var myArray = [];
- var feedStruct = {};
- var columnMap = {};
- var qComments = entityToQuery( commentResults.comments );
-
- // Create the column maps
- columnMap.title = "title";
- columnMap.description = "content";
- columnMap.pubDate = "createddate";
- columnMap.link = "link";
- columnMap.author = "rssAuthor";
- columnMap.category_tag = "categories";
-
- // Add necessary columns to query
- queryAddColumn( qComments, "title", myArray );
- queryAddColumn( qComments, "linkComments", myArray );
- queryAddColumn( qComments, "rssAuthor", myArray );
- queryAddColumn( qComments, "guid_permalink", myArray );
- queryAddColumn( qComments, "guid_string", myArray );
-
- // Attach permalinks
- for ( var i = 1; i lte commentResults.count; i++ ) {
- // build URL to entry
- qComments.title[ i ] = "Comment by #qComments.author[ i ]# on #commentResults.comments[ i ].getParentTitle()#";
- qComments.rssAuthor[ i ] = "#qComments.authorEmail# (#qComments.author#)";
- qComments.linkComments[ i ] = CBHelper.linkComment( commentResults.comments[ i ] );
- qComments.content[ i ] = cleanupContent( qComments.content[ i ] );
- qComments.guid_permalink[ i ] = false;
- qComments.guid_string[ i ] = CBHelper.linkComment( commentResults.comments[ i ] );
- }
-
- // Generate feed items
- feedStruct.title = "Comments " & settings.cb_rss_title;
- feedStruct.generator = settings.cb_rss_generator;
- feedStruct.copyright = settings.cb_rss_copyright;
- feedStruct.description = settings.cb_rss_description;
- if ( len( settings.cb_rss_webmaster ) ) feedStruct.webmaster = settings.cb_rss_webmaster;
- feedStruct.pubDate = now();
- feedStruct.lastbuilddate = now();
- feedStruct.link = CBHelper.linkHome();
- feedStruct.items = qComments;
-
- return variables.feedGenerator.createFeed( feedStruct, columnMap );
- }
-
- /**
- * Cleanup HTML to normal strings to avoid parsing issues
- */
- private function cleanupContent( required content ){
- return reReplaceNoCase( arguments.content, "<[^>]*>", "", "all" );
- }
+ // DI
+ property name="entryService" inject="entryService@contentbox";
+
+ property name="pageService" inject="pageService@contentbox";
+
+ property name="contentService" inject="contentService@contentbox";
+
+ property name="commentService" inject="commentService@contentbox";
+
+ property name="CBHelper" inject="CBHelper@contentbox";
+
+ property name="feedGenerator" inject="feedGenerator@cbfeeds";
+
+ property name="log" inject="logbox:logger:{this}";
+
+ /**
+ * Constructor
+ *
+ * @settingService.inject id:settingService@contentbox
+ * @cacheBox.inject cachebox
+ */
+ RSSService function init(required settingService, required cacheBox) {
+ // Dependencies
+ variables.settingService = arguments.settingService;
+ variables.cacheBox = arguments.cacheBox;
+ // Get all settings
+ var settings = settingService.getAllSettings();
+ // setup the user selected cache provider
+ variables.cache = cacheBox.getCache(settings.cb_rss_cacheName);
+
+ return this;
+ }
+
+ /************************************** PUBLIC *********************************************/
+
+ /**
+ * Clean RSS caches asynchronously
+ *
+ * @comments Clear comment caches or not, defaults to false
+ * @slug The content slug to clear on
+ */
+ RSSService function clearCaches(boolean comments = false, string slug = '') {
+ var cacheKey = '';
+
+ // compose cache key
+ if (arguments.comments) {
+ cacheKey = 'cb-feeds-#cgi.HTTP_HOST#-content-comments-';
+ } else {
+ cacheKey = 'cb-feeds-#cgi.HTTP_HOST#-content';
+ }
+
+ // clear by snippet
+ variables.cache.clearByKeySnippet(keySnippet = cacheKey, async = false);
+
+ // log
+ if (variables.log.canInfo()) {
+ variables.log.info(
+ 'Sent clear command using the following content key: #cacheKey# from provider: #variables.cache.getName()#'
+ );
+ }
+
+ return this;
+ }
+
+ /**
+ * Clean All RSS caches NOW BABY, NOW!
+ */
+ RSSService function clearAllCaches(boolean async = false) {
+ variables.cache.clearByKeySnippet(keySnippet = 'cb-feeds', async = arguments.async);
+ return this;
+ }
+
+ /**
+ * 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
+ * @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
+ */
+ function getRSS(
+ string slug = '',
+ boolean comments = false,
+ category = '',
+ contentType = '',
+ string siteID = ''
+ ) {
+ var settings = settingService.getAllSettings();
+ var rssFeed = '';
+ var cacheKey = '';
+
+ // Comments cache Key
+ if (arguments.comments) {
+ cacheKey = 'cb-feeds-#cgi.HTTP_HOST#-content-comments-#arguments.slug#';
+ } else {
+ // Entries cache Key
+ cacheKey = 'cb-feeds-#cgi.HTTP_HOST#-content-#hash(arguments.category & arguments.contentType)#';
+ }
+
+ // Retrieve via caching? and caching active
+ if (settings.cb_rss_caching) {
+ var rssFeed = variables.cache.get(cacheKey);
+ if (!isNull(rssFeed)) {
+ return rssFeed;
+ }
+ }
+
+ // Content Type
+ switch (arguments.contentType) {
+ // Pages
+ case 'page': {
+ // Building comment feed or content feed
+ if (arguments.comments) {
+ arguments.contentType = 'Page';
+ rssfeed = buildCommentFeed(argumentCollection = arguments);
+ } else {
+ rssfeed = buildPageFeed(argumentCollection = arguments);
+ }
+ break;
+ }
+ // Blog
+ case 'entry': {
+ // Building comment feed or content feed
+ if (arguments.comments) {
+ arguments.contentType = 'Entry';
+ rssfeed = buildCommentFeed(argumentCollection = arguments);
+ } else {
+ rssfeed = buildEntryFeed(argumentCollection = arguments);
+ }
+ break;
+ }
+ // Default Site
+ default: {
+ // Building comment feed or content feed
+ if (arguments.comments) {
+ rssfeed = buildCommentFeed(argumentCollection = arguments);
+ } else {
+ rssfeed = buildContentFeed(argumentCollection = arguments);
+ }
+ break;
+ }
+ }
+ // end content type switch
+
+ // Cache it with settings
+ if (settings.cb_rss_caching) {
+ variables.cache.set(
+ cacheKey,
+ rssFeed,
+ settings.cb_rss_cachingTimeout,
+ settings.cb_rss_cachingTimeoutIdle
+ );
+ }
+
+ return rssFeed;
+ }
+
+ /************************************** PRIVATE *********************************************/
+
+ /**
+ * Build entries feeds
+ *
+ * @category The category to filter on
+ * @siteID The site to filter on
+ */
+ private function buildEntryFeed(string category = '', string siteID = '') {
+ var settings = settingService.getAllSettings();
+ var entryResults = entryService.findPublishedContent(
+ category = arguments.category,
+ max = settings.cb_rss_maxEntries,
+ siteID = arguments.siteID
+ );
+ var myArray = [];
+ var feedStruct = {};
+ var columnMap = {};
+ var qEntries = entityToQuery(entryResults.content);
+
+ // max checks
+ if (settings.cb_rss_maxEntries LT entryResults.count) {
+ entryResults.count = settings.cb_rss_maxEntries;
+ }
+
+ // Create the column maps
+ columnMap.title = 'title';
+ columnMap.description = 'content';
+ columnMap.pubDate = 'publishedDate';
+ columnMap.link = 'link';
+ columnMap.author = 'author';
+ columnMap.category_tag = 'categories';
+
+ // Add necessary columns to query
+ queryAddColumn(qEntries, 'link', myArray);
+ queryAddColumn(qEntries, 'linkComments', myArray);
+ queryAddColumn(qEntries, 'author', myArray);
+ queryAddColumn(qEntries, 'categories', myArray);
+ queryAddColumn(qEntries, 'content', myArray);
+ queryAddColumn(qEntries, 'guid_permalink', myArray);
+ queryAddColumn(qEntries, 'guid_string', myArray);
+
+ // Attach permalinks
+ for (var i = 1; i LTE entryResults.count; i++) {
+ var entrySlug = entryResults.content[i].getSlug();
+ // build URL to entry
+ qEntries.link[i] = variables.CBHelper.linkEntry(entrySlug);
+ qEntries.guid_permalink[i] = false;
+ qEntries.guid_string[i] = variables.CBHelper.linkEntry(entrySlug);
+
+ 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();
+ if (entryResults.content[i].hasExcerpt()) {
+ qEntries.content[i] = entryResults.content[i].renderExcerpt();
+ } else {
+ qEntries.content[i] = entryResults.content[i].renderContent();
+ }
+ qEntries.content[i] = cleanupContent(qEntries.content[i]);
+ }
+
+ // Generate feed items
+ feedStruct.title = 'Blog ' & settings.cb_rss_title;
+ feedStruct.generator = settings.cb_rss_generator;
+ feedStruct.copyright = settings.cb_rss_copyright;
+ feedStruct.description = settings.cb_rss_description;
+ if (len(settings.cb_rss_webmaster)) {
+ feedStruct.webmaster = settings.cb_rss_webmaster;
+ }
+ feedStruct.pubDate = now();
+ feedStruct.lastbuilddate = now();
+ feedStruct.link = variables.CBHelper.linkHome();
+ feedStruct.items = qEntries;
+
+ return variables.feedGenerator.createFeed(feedStruct, columnMap);
+ }
+
+ /**
+ * Build pages feeds
+ *
+ * @category The category to filter on
+ * @siteID The site to filter on
+ */
+ private function buildPageFeed(string category = '', string siteID = '') {
+ var settings = settingService.getAllSettings();
+ var pageResults = variables.pageService.findPublishedContent(
+ category = arguments.category,
+ max = settings.cb_rss_maxEntries,
+ siteID = arguments.siteID
+ );
+ var myArray = [];
+ var feedStruct = {};
+ var columnMap = {};
+ var qPages = entityToQuery(pageResults.content);
+
+ // max checks
+ if (settings.cb_rss_maxEntries LT pageResults.count) {
+ pageResults.count = settings.cb_rss_maxEntries;
+ }
+
+ // Create the column maps
+ columnMap.title = 'title';
+ columnMap.description = 'content';
+ columnMap.pubDate = 'publishedDate';
+ columnMap.link = 'link';
+ columnMap.author = 'author';
+ columnMap.category_tag = 'categories';
+
+ // Add necessary columns to query
+ queryAddColumn(qPages, 'link', myArray);
+ queryAddColumn(qPages, 'linkComments', myArray);
+ queryAddColumn(qPages, 'author', myArray);
+ queryAddColumn(qPages, 'categories', myArray);
+ queryAddColumn(qPages, 'content', myArray);
+ queryAddColumn(qPages, 'guid_permalink', myArray);
+ queryAddColumn(qPages, 'guid_string', myArray);
+
+ // Attach permalinks
+ for (var i = 1; i LTE pageResults.count; i++) {
+ var pageSlug = pageResults.content[i].getSlug();
+ // build URL to entry
+ qPages.link[i] = variables.CBHelper.linkPage(pageSlug);
+ qPages.author[i] = '#pageResults.content[i].getAuthorEmail()# (#pageResults.content[i].getAuthorName()#)';
+ qPages.linkComments[i] = variables.CBHelper.linkComments(pageResults.content[i]);
+ qPages.categories[i] = pageResults.content[i].getCategoriesList();
+ qPages.guid_permalink[i] = false;
+ qPages.guid_string[i] = variables.CBHelper.linkPage(pageSlug);
+ if (pageResults.content[i].hasExcerpt()) {
+ qPages.content[i] = pageResults.content[i].renderExcerpt();
+ } else {
+ qPages.content[i] = pageResults.content[i].renderContent();
+ }
+ qPages.content[i] = cleanupContent(qPages.content[i]);
+ }
+
+ // Generate feed items
+ feedStruct.title = 'Page ' & settings.cb_rss_title;
+ feedStruct.generator = settings.cb_rss_generator;
+ feedStruct.copyright = settings.cb_rss_copyright;
+ feedStruct.description = settings.cb_rss_description;
+ if (len(settings.cb_rss_webmaster)) {
+ feedStruct.webmaster = settings.cb_rss_webmaster;
+ }
+ feedStruct.pubDate = now();
+ feedStruct.lastbuilddate = now();
+ feedStruct.link = CBHelper.linkHome();
+ feedStruct.items = qPages;
+
+ return variables.feedGenerator.createFeed(feedStruct, columnMap);
+ }
+
+ /**
+ * Build content feeds
+ *
+ * @category The category to filter on
+ * @siteID The site to filter on
+ */
+ private function buildContentFeed(string category = '', string siteID = '') {
+ var settings = variables.settingService.getAllSettings();
+ var contentResults = variables.contentService.findPublishedContent(
+ category = arguments.category,
+ max = settings.cb_rss_maxEntries,
+ siteID = arguments.siteID
+ );
+ var myArray = [];
+ var feedStruct = {};
+ var columnMap = {};
+ var qContent = entityToQuery(contentResults.content);
+
+ // max checks
+ if (settings.cb_rss_maxEntries LT contentResults.count) {
+ contentResults.count = settings.cb_rss_maxEntries;
+ }
+
+ // Create the column maps
+ columnMap.title = 'title';
+ columnMap.description = 'content';
+ columnMap.pubDate = 'publishedDate';
+ columnMap.link = 'link';
+ columnMap.author = 'author';
+ columnMap.category_tag = 'categories';
+
+ // Add necessary columns to query
+ queryAddColumn(qContent, 'link', myArray);
+ queryAddColumn(qContent, 'linkComments', myArray);
+ queryAddColumn(qContent, 'author', myArray);
+ queryAddColumn(qContent, 'categories', myArray);
+ queryAddColumn(qContent, 'content', myArray);
+ queryAddColumn(qContent, 'guid_permalink', myArray);
+ queryAddColumn(qContent, 'guid_string', myArray);
+
+ // 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';
+
+ // build URL to entry
+ qContent.link[i] = CBHelper.linkContent(contentResults.content[i]);
+ qContent.author[i] = '#authorEmail# (#authorName#)';
+ qContent.linkComments[i] = CBHelper.linkComments(contentResults.content[i]);
+ qContent.categories[i] = contentResults.content[i].getCategoriesList();
+ qContent.content[i] = cleanupContent(contentResults.content[i].renderContent());
+ qContent.guid_permalink[i] = false;
+ qContent.guid_string[i] = CBHelper.linkContent(contentResults.content[i]);
+ }
+
+ // Generate feed items
+ feedStruct.title = 'Content ' & settings.cb_rss_title;
+ feedStruct.generator = settings.cb_rss_generator;
+ feedStruct.copyright = settings.cb_rss_copyright;
+ feedStruct.description = settings.cb_rss_description;
+ if (len(settings.cb_rss_webmaster)) {
+ feedStruct.webmaster = settings.cb_rss_webmaster;
+ }
+ feedStruct.pubDate = now();
+ feedStruct.lastbuilddate = now();
+ feedStruct.link = CBHelper.linkHome();
+ feedStruct.items = qContent;
+
+ return variables.feedGenerator.createFeed(feedStruct, columnMap);
+ }
+
+ /**
+ * Build comment feeds according to filtering elements
+ *
+ * @slug The content slug to filter on
+ * @contentType The content type discriminator to filter on
+ * @siteID The site to filter on
+ */
+ private function buildCommentFeed(string slug = '', string contentType = '', string siteID = '') {
+ var settings = variables.settingService.getAllSettings();
+ var commentResults = variables.commentService.findAllApproved(
+ contentID = variables.contentService.getIDBySlug(arguments.slug),
+ contentType = arguments.contentType,
+ max = settings.cb_rss_maxComments,
+ siteID = arguments.siteID
+ );
+ var myArray = [];
+ var feedStruct = {};
+ var columnMap = {};
+ var qComments = entityToQuery(commentResults.comments);
+
+ // Create the column maps
+ columnMap.title = 'title';
+ columnMap.description = 'content';
+ columnMap.pubDate = 'createddate';
+ columnMap.link = 'link';
+ columnMap.author = 'rssAuthor';
+ columnMap.category_tag = 'categories';
+
+ // Add necessary columns to query
+ queryAddColumn(qComments, 'title', myArray);
+ queryAddColumn(qComments, 'linkComments', myArray);
+ queryAddColumn(qComments, 'rssAuthor', myArray);
+ queryAddColumn(qComments, 'guid_permalink', myArray);
+ queryAddColumn(qComments, 'guid_string', myArray);
+
+ // Attach permalinks
+ for (var i = 1; i LTE commentResults.count; i++) {
+ // build URL to entry
+ qComments.title[i] = 'Comment by #qComments.author[i]# on #commentResults.comments[i].getParentTitle()#';
+ qComments.rssAuthor[i] = '#qComments.authorEmail# (#qComments.author#)';
+ qComments.linkComments[i] = CBHelper.linkComment(commentResults.comments[i]);
+ qComments.content[i] = cleanupContent(qComments.content[i]);
+ qComments.guid_permalink[i] = false;
+ qComments.guid_string[i] = CBHelper.linkComment(commentResults.comments[i]);
+ }
+
+ // Generate feed items
+ feedStruct.title = 'Comments ' & settings.cb_rss_title;
+ feedStruct.generator = settings.cb_rss_generator;
+ feedStruct.copyright = settings.cb_rss_copyright;
+ feedStruct.description = settings.cb_rss_description;
+ if (len(settings.cb_rss_webmaster)) {
+ feedStruct.webmaster = settings.cb_rss_webmaster;
+ }
+ feedStruct.pubDate = now();
+ feedStruct.lastbuilddate = now();
+ feedStruct.link = CBHelper.linkHome();
+ feedStruct.items = qComments;
+
+ return variables.feedGenerator.createFeed(feedStruct, columnMap);
+ }
+
+ /**
+ * Cleanup HTML to normal strings to avoid parsing issues
+ */
+ private function cleanupContent(required content) {
+ return reReplaceNoCase(
+ arguments.content,
+ '<[^>]*>',
+ '',
+ 'all'
+ );
+ }
}
diff --git a/modules/contentbox/models/search/DBSearch.cfc b/modules/contentbox/models/search/DBSearch.cfc
index 7a275f72b3..2cfb77a3fc 100644
--- a/modules/contentbox/models/search/DBSearch.cfc
+++ b/modules/contentbox/models/search/DBSearch.cfc
@@ -8,16 +8,17 @@
* @see contentbox.models.search.ISearchAdapter
*/
component accessors="true" singleton {
-
// DI
property name="contentService" inject="contentService@contentbox";
+
property name="cb" inject="cbHelper@contentbox";
+
property name="wirebox" inject="wirebox";
/**
* Constructor
*/
- DBSearch function init(){
+ DBSearch function init() {
return this;
}
@@ -36,32 +37,36 @@ component accessors="true" singleton {
numeric max = 0,
numeric offset = 0,
string siteID = ""
- ){
+ ) {
// get new search results object
var searchResults = variables.wirebox.getInstance( "SearchResults@contentbox" );
- var sTime = getTickCount();
+ var sTime = getTickCount();
try {
var results = variables.contentService.searchContent(
- offset : arguments.offset,
- max : arguments.max,
- searchTerm : arguments.searchTerm,
- showInSearch: true,
- contentTypes: "Page,Entry",
- siteID : arguments.siteID
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ searchTerm = arguments.searchTerm,
+ showInSearch = true,
+ contentTypes = "Page,Entry",
+ siteID = arguments.siteID
+ );
// populate the search results
- searchResults.populate( {
- results : results.content,
- total : results.count,
- searchTime : getTickCount() - sTime,
- searchTerm : arguments.searchTerm,
- error : false
- } );
- } catch ( Any e ) {
+ searchResults.populate(
+ {
+ results : results.content,
+ total : results.count,
+ searchTime: getTickCount() - sTime,
+ searchTerm: arguments.searchTerm,
+ error : false
+ }
+ );
+ } catch (Any e) {
searchResults.setError( true );
- searchResults.setErrorMessages( [ "Error executing content search: #e.detail# #e.message#" ] );
+ searchResults.setErrorMessages(
+ [ "Error executing content search: #e.detail# #e.message#"]
+ );
}
return searchResults;
@@ -72,7 +77,8 @@ component accessors="true" singleton {
*
* @return contentbox.models.search.ISearchAdapter
*/
- DBSearch function refresh(){
+ DBSearch function refresh() {
+
}
/**
@@ -84,7 +90,7 @@ component accessors="true" singleton {
required string searchTerm,
numeric max = 0,
numeric offset = 0
- ){
+ ) {
var searchResults = search( argumentCollection = arguments );
return renderSearchWithResults( searchResults );
}
@@ -94,63 +100,66 @@ component accessors="true" singleton {
*
* @searchResults The search results object
*/
- any function renderSearchWithResults( required SearchResults searchResults ){
- var results = "";
+ any function renderSearchWithResults( required SearchResults searchResults ) {
+ var results = "";
var searchItems = arguments.searchResults.getResults();
- var total = arguments.searchResults.getTotal();
- var searchTerm = arguments.searchResults.getSearchTerm();
-
+ var total = arguments.searchResults.getTotal();
+ var searchTerm = arguments.searchResults.getSearchTerm();
// cfformat-ignore-start
savecontent variable="results" {
+// Render out the results or error if the results had errors
+if ( arguments.searchResults.getError() ) {
+writeOutput(
+"
+
+
Error Running Search
+
+#arrayToList( arguments.searchResults.getErrorMessages(), " " )#
+
+
+"
+);
+} else {
+writeOutput(
+"
+
+
+Found #total# results in #arguments.searchResults.getSearchTime()# ms!
+
+"
+);
+}
- // Render out the results or error if the results had errors
- if( arguments.searchResults.getError() ){
- writeOutput( "
-
-
Error Running Search
-
- #arrayToList(
- arguments.searchResults.getErrorMessages(),
- " "
- )#
-
-
- " );
- } else {
- writeOutput( "
-
-
- Found #total# results in #arguments.searchResults.getSearchTime()# ms!
-
- " );
- }
-
- // Render out the items
- for ( var item in searchItems ) {
- writeOutput("
-
-
-
-
#highlightSearchTerm( searchTerm, stripHTML( item.renderContent() ) )#
-
#item.getContentType()# : #cb.linkContent( item )#
-
- ");
-
- if ( item.hasCategories() ) {
- writeOutput( "
Categories: " );
- for ( var categoryItem in #item.getCategoriesList()# ) {
- writeOutput( " #categoryItem# " );
- }
- writeOutput( "
" );
- }
+// Render out the items
+for ( var item in searchItems ) {
+writeOutput(
+"
+
+
+
+
#highlightSearchTerm( searchTerm, stripHTML( item.renderContent() ) )#
+
#item.getContentType()# : #cb.linkContent( item )#
+
+"
+);
+
+if ( item.hasCategories() ) {
+writeOutput( "
Categories: " );
+for ( var categoryItem in item.getCategoriesList() ) {
+writeOutput(
+" #categoryItem# "
+);
+}
+writeOutput( "
" );
+}
- writeOutput( "
" );
- };
+writeOutput( "
" );
+}
- writeOutput( "
" );
- }
+writeOutput( "
" );
+}
// cfformat-ignore-end
return results;
@@ -159,8 +168,13 @@ component accessors="true" singleton {
/**
* utility to strip HTML
*/
- private function stripHTML( stringTarget ){
- return reReplaceNoCase( arguments.stringTarget, "<[^>]*>", "", "ALL" );
+ private function stripHTML( stringTarget ) {
+ return reReplaceNoCase(
+ arguments.stringTarget,
+ "<[^>]*>",
+ "",
+ "ALL"
+ );
}
/**
@@ -169,23 +183,27 @@ component accessors="true" singleton {
* @term The search term
* @content The content searched
*/
- private function highlightSearchTerm( required term, required content ){
- var match = findNoCase( arguments.term, arguments.content );
- var end = 0;
+ private function highlightSearchTerm( required term, required content ) {
+ var match = findNoCase( arguments.term, arguments.content );
+ var end = 0;
var excerpt = "";
- if ( match lte 250 ) {
+ if ( match LTE 250 ) {
match = 1;
}
end = match + len( arguments.term ) + 500;
- if ( len( arguments.content ) gt 500 ) {
- if ( match gt 1 ) {
- excerpt = "..." & mid( arguments.content, match - 250, end - match );
+ if ( len( arguments.content ) GT 500 ) {
+ if ( match GT 1 ) {
+ excerpt = "..." & mid(
+ arguments.content,
+ match - 250,
+ end - match
+ );
} else {
excerpt = left( arguments.content, end );
}
- if ( len( arguments.content ) gt end ) {
+ if ( len( arguments.content ) GT end ) {
excerpt = excerpt & "...";
}
} else {
@@ -199,7 +217,8 @@ component accessors="true" singleton {
"\1 ",
"all"
);
- } catch ( Any e ) {
+ } catch (Any e) {
+
}
// remove images
@@ -210,4 +229,4 @@ component accessors="true" singleton {
return excerpt;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/search/ISearchAdapter.cfc b/modules/contentbox/models/search/ISearchAdapter.cfc
index fa951293d7..53caf2cb92 100644
--- a/modules/contentbox/models/search/ISearchAdapter.cfc
+++ b/modules/contentbox/models/search/ISearchAdapter.cfc
@@ -53,6 +53,7 @@ interface {
*
* @return The search html
*/
- any function renderSearchWithResults( required contentbox.models.search.SearchResults searchResults );
-
-}
+ any function renderSearchWithResults(
+ required contentbox.models.search.SearchResults searchResults
+ );
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/search/SearchResults.cfc b/modules/contentbox/models/search/SearchResults.cfc
index 19150d7476..459f71c4a6 100644
--- a/modules/contentbox/models/search/SearchResults.cfc
+++ b/modules/contentbox/models/search/SearchResults.cfc
@@ -6,7 +6,6 @@
* The official ContentBox Search Results Object
*/
component accessors="true" {
-
property
name="results"
type="any"
@@ -22,10 +21,7 @@ component accessors="true" {
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="searchTerm" type="string" hint="The search term used";
property
name="error"
@@ -45,14 +41,14 @@ component accessors="true" {
/**
* Constructor
*/
- function init(){
- variables.results = [];
- variables.searchTime = 0;
- variables.total = 0;
- variables.metadata = {};
- variables.error = false;
+ function init() {
+ variables.results = [];
+ variables.searchTime = 0;
+ variables.total = 0;
+ variables.metadata = {};
+ variables.error = false;
variables.errorMessages = [];
- variables.searchTerm = "";
+ variables.searchTerm = "";
return this;
}
@@ -62,7 +58,7 @@ component accessors="true" {
*
* @return SearchResults
*/
- any function populate( required struct memento ){
+ any function populate( required struct memento ) {
for ( var key in arguments.memento ) {
if ( structKeyExists( variables, key ) ) {
variables[ key ] = arguments.memento[ key ];
@@ -76,16 +72,16 @@ component accessors="true" {
*
* @return struct of { "results","searchTime","total","metadata","error","errorMessages","searchTerm" }
*/
- struct function getMemento(){
+ struct function getMemento() {
return {
- "results" : results,
- "searchTime" : searchTime,
- "total" : total,
- "metadata" : metadata,
- "error" : error,
- "errorMessages" : errorMessages,
- "searchTerm" : searchTerm
+ "results" : results,
+ "searchTime" : searchTime,
+ "total" : total,
+ "metadata" : metadata,
+ "error" : error,
+ "errorMessages": errorMessages,
+ "searchTerm" : searchTerm
};
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/search/SearchService.cfc b/modules/contentbox/models/search/SearchService.cfc
index fa64dc5cdd..138d043290 100644
--- a/modules/contentbox/models/search/SearchService.cfc
+++ b/modules/contentbox/models/search/SearchService.cfc
@@ -6,15 +6,15 @@
* The official ContentBox Search Service
*/
component accessors="true" {
-
// DI
property name="wirebox" inject="wirebox";
+
property name="settingService" inject="settingService@contentbox";
/**
* Constructor
*/
- SearchService function init(){
+ SearchService function init() {
return this;
}
@@ -22,8 +22,8 @@ component accessors="true" {
* Return the actual ContentBox configured search adapter that should meet
* the following interface: contentbox.models.search.ISearchAdapter
*/
- any function getSearchAdapter(){
+ any function getSearchAdapter() {
return variables.wirebox.getInstance( variables.settingService.getSetting( "cb_search_adapter" ) );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/Author.cfc b/modules/contentbox/models/security/Author.cfc
index e373f57be3..8b065096c0 100644
--- a/modules/contentbox/models/security/Author.cfc
+++ b/modules/contentbox/models/security/Author.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -14,214 +14,212 @@ component
cachename ="cbAuthor"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="authorService"
- inject ="provider:authorService@contentbox"
+ name="authorService"
+ inject="provider:authorService@contentbox"
persistent="false";
property
- name ="avatar"
- inject ="provider:Avatar@contentbox"
+ name="avatar"
+ inject="provider:Avatar@contentbox"
persistent="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="authorID"
- column ="authorID"
+ name="authorID"
+ column="authorID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="firstName"
- column ="firstName"
- length ="100"
+ name="firstName"
+ column="firstName"
+ length="100"
notnull="true"
default="";
property
- name ="lastName"
- column ="lastName"
- length ="100"
+ name="lastName"
+ column="lastName"
+ length="100"
notnull="true"
default="";
property
- name ="email"
- column ="email"
- length ="255"
+ name="email"
+ column="email"
+ length="255"
notnull="true"
- index ="idx_email"
+ index="idx_email"
default="";
property
- name ="username"
- column ="username"
- length ="100"
+ name="username"
+ column="username"
+ length="100"
notnull="true"
- index ="idx_login"
- unique ="true"
+ index="idx_login"
+ unique="true"
default="";
property
- name ="password"
- column ="password"
- length ="100"
+ name="password"
+ column="password"
+ length="100"
notnull="true"
- index ="idx_login"
+ index="idx_login"
default="";
property
- name ="isActive"
- column ="isActive"
+ name="isActive"
+ column="isActive"
ormtype="boolean"
notnull="true"
default="false"
- index ="idx_login,idx_activeAuthor";
+ index="idx_login,idx_activeAuthor";
property
- name ="lastLogin"
- column ="lastLogin"
+ name="lastLogin"
+ column="lastLogin"
ormtype="timestamp"
notnull="false";
property
- name ="biography"
- column ="biography"
+ name="biography"
+ column="biography"
ormtype="text"
notnull="false"
- length ="8000"
+ length="8000"
default="";
property
- name ="preferences"
- column ="preferences"
+ name="preferences"
+ column="preferences"
ormtype="text"
notnull="false"
- length ="8000"
+ length="8000"
default="";
property
- name ="isPasswordReset"
- column ="isPasswordReset"
+ name="isPasswordReset"
+ column="isPasswordReset"
ormtype="boolean"
notnull="true"
default="false"
- index ="idx_passwordReset";
+ index="idx_passwordReset";
property
- name ="is2FactorAuth"
- column ="is2FactorAuth"
+ name="is2FactorAuth"
+ column="is2FactorAuth"
ormtype="boolean"
notnull="true"
default="false"
- index ="idx_2factorauth";
+ index="idx_2factorauth";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// O2M -> Entries
property
- name ="entries"
+ name="entries"
singularName="entry"
- type ="array"
- fieldtype ="one-to-many"
- cfc ="contentbox.models.content.Entry"
- fkcolumn ="FK_authorID"
- inverse ="true"
- lazy ="true"
- cascade ="save-update"
- batchsize ="10"
- orderby ="publishedDate DESC";
+ type="array"
+ fieldtype="one-to-many"
+ cfc="contentbox.models.content.Entry"
+ fkcolumn="FK_authorID"
+ inverse="true"
+ lazy="true"
+ cascade="save-update"
+ batchsize="10"
+ orderby="publishedDate DESC";
// O2M -> Pages
property
- name ="pages"
+ name="pages"
singularName="page"
- type ="array"
- fieldtype ="one-to-many"
- cfc ="contentbox.models.content.Page"
- fkcolumn ="FK_authorID"
- inverse ="true"
- lazy ="true"
- cascade ="save-update"
- batchsize ="10"
- orderby ="publishedDate DESC";
+ type="array"
+ fieldtype="one-to-many"
+ cfc="contentbox.models.content.Page"
+ fkcolumn="FK_authorID"
+ inverse="true"
+ lazy="true"
+ cascade="save-update"
+ batchsize="10"
+ orderby="publishedDate DESC";
// M20 -> Role
property
- name ="role"
- notnull ="true"
+ name="role"
+ notnull="true"
fieldtype="many-to-one"
- cfc ="contentbox.models.security.Role"
- fkcolumn ="FK_roleID"
- lazy ="true";
+ cfc="contentbox.models.security.Role"
+ fkcolumn="FK_roleID"
+ lazy="true";
// M2M -> A-la-carte Author Permissions
property
- name ="permissions"
- fieldtype ="many-to-many"
- cascade ="save-update"
- type ="array"
- lazy ="true"
- cfc ="contentbox.models.security.Permission"
- fkcolumn ="FK_authorID"
- linktable ="cb_authorPermissions"
+ name="permissions"
+ fieldtype="many-to-many"
+ cascade="save-update"
+ type="array"
+ lazy="true"
+ cfc="contentbox.models.security.Permission"
+ fkcolumn="FK_authorID"
+ linktable="cb_authorPermissions"
inversejoincolumn="FK_permissionID"
- orderby ="permission";
+ orderby="permission";
// M2M -> A-la-carte Author Permission Groups
property
- name ="permissionGroups"
- singularName ="permissionGroup"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- inverse ="true"
- cfc ="contentbox.models.security.PermissionGroup"
- cascade ="all"
- fkcolumn ="FK_authorID"
- linktable ="cb_authorPermissionGroups"
+ name="permissionGroups"
+ singularName="permissionGroup"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ inverse="true"
+ cfc="contentbox.models.security.PermissionGroup"
+ cascade="all"
+ fkcolumn="FK_authorID"
+ linktable="cb_authorPermissionGroups"
inversejoincolumn="FK_permissionGroupID"
- orderby ="name";
+ orderby="name";
- /* *********************************************************************
- ** CALCULATED FIELDS
- ********************************************************************* */
+ /**********************************************************************
+ * ** CALCULATED FIELDS
+ **********************************************************************/
- /* *********************************************************************
- ** NON PERSISTED PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** NON PERSISTED PROPERTIES
+ **********************************************************************/
// Non-persisted properties
property
- name ="loggedIn"
+ name="loggedIn"
persistent="false"
- default ="false"
- type ="boolean";
+ default="false"
+ type="boolean";
property name="permissionList" persistent="false";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + MEMENTO
- ********************************************************************* */
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + MEMENTO
+ **********************************************************************/
this.pk = "authorID";
this.memento = {
// Default properties to serialize
- defaultIncludes : [
+ defaultIncludes: [
"firstName",
"lastName",
"email",
@@ -238,7 +236,7 @@ component
"numberOfContentStore"
],
// Default Exclusions
- defaultExcludes : [
+ defaultExcludes: [
"entries",
"pages",
"permissions",
@@ -247,43 +245,43 @@ component
"isPasswordReset",
"is2FactorAuth"
],
- neverInclude : [ "password" ],
+ neverInclude: [ "password"],
// Defaults
- defaults : { "role" : {} }
+ defaults : { "role": {} }
};
this.constraints = {
- "firstName" : { required : true, size : "1..100" },
- "lastName" : { required : true, size : "1..100" },
- "email" : {
- required : true,
- size : "1..255",
- type : "email",
- validator : "UniqueValidator@cborm"
+ "firstName": { required: true, size: "1..100" },
+ "lastName" : { required: true, size: "1..100" },
+ "email" : {
+ required : true,
+ size : "1..255",
+ type : "email",
+ validator: "UniqueValidator@cborm"
},
- "username" : {
- required : true,
- size : "1..100",
- validator : "UniqueValidator@cborm"
+ "username": {
+ required : true,
+ size : "1..100",
+ validator: "UniqueValidator@cborm"
},
- "password" : { required : true, size : "1..100" },
- "role" : { required : true }
+ "password": { required: true, size: "1..100" },
+ "role" : { required: true }
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
- variables.permissionList = [];
- variables.loggedIn = false;
- variables.isActive = true;
+ function init() {
+ variables.permissionList = [];
+ variables.loggedIn = false;
+ variables.isActive = true;
variables.permissionGroups = [];
- variables.isPasswordReset = false;
- variables.is2FactorAuth = false;
+ variables.isPasswordReset = false;
+ variables.is2FactorAuth = false;
// Setup empty preferences
setPreferences( {} );
@@ -296,28 +294,28 @@ component
/**
* Get the total number of content items this author has created
*/
- numeric function getNumberOfContent(){
+ numeric function getNumberOfContent() {
return ( isLoaded() ? variables.authorService.getTotalContent( getAuthorId() ) : 0 );
}
/**
* Get the total number of entries this author has created
*/
- numeric function getNumberOfEntries(){
+ numeric function getNumberOfEntries() {
return ( isLoaded() ? variables.authorService.getTotalEntries( getAuthorId() ) : 0 );
}
/**
* Get the total number of pages this author has created
*/
- numeric function getNumberOfPages(){
+ numeric function getNumberOfPages() {
return ( isLoaded() ? variables.authorService.getTotalPages( getAuthorId() ) : 0 );
}
/**
* Get the total number of content store items this author has created
*/
- numeric function getNumberOfContentStore(){
+ numeric function getNumberOfContentStore() {
return ( isLoaded() ? variables.authorService.getTotalContentStoreItems( getAuthorId() ) : 0 );
}
@@ -326,9 +324,9 @@ component
*
* @permission One or a list of permissions to check for access
*/
- boolean function hasPermission( required permission ){
+ boolean function hasPermission( required permission ) {
// cache deconstructed permissions in case it's called many times during a request.
- if ( !arrayLen( variables.permissionList ) AND hasPermissions() ) {
+ if ( !arrayLen( variables.permissionList ) && hasPermissions() ) {
variables.permissionList = arrayReduce(
getPermissions(),
( result, item ) => {
@@ -340,11 +338,9 @@ component
// checks via role, then group permissions and then local permissions
if (
- ( hasRole() && getRole().hasPermission( arguments.permission ) )
- OR
- checkGroupPermissions( arguments.permission )
- OR
- inPermissionList( arguments.permission )
+ ( hasRole() && getRole().hasPermission( arguments.permission ) ) ||
+ checkGroupPermissions( arguments.permission ) ||
+ inPermissionList( arguments.permission )
) {
return true;
}
@@ -357,7 +353,7 @@ component
*
* @slug The slug to check
*/
- boolean function checkGroupPermissions( required slug ){
+ boolean function checkGroupPermissions( required slug ) {
// If no groups, just return false
if ( !hasPermissionGroup() ) {
return false;
@@ -378,16 +374,16 @@ component
*
* @permission A list or array of permission to check
*/
- public function inPermissionList( required permission ){
- return arrayWrap( arguments.permission )
- .filter( ( item ) => variables.permissionList.findNoCase( arguments.item ) )
- .len();
+ public function inPermissionList( required permission ) {
+ return arrayWrap( arguments.permission ).filter(
+ ( item ) => variables.permissionList.findNoCase( arguments.item )
+ ).len();
}
/**
* Remove all permissions
*/
- Author function clearPermissions(){
+ Author function clearPermissions() {
if ( hasPermissions() ) {
variables.permissions.clear();
} else {
@@ -400,7 +396,7 @@ component
/**
* Remove all permission groups
*/
- Author function clearPermissionGroups(){
+ Author function clearPermissionGroups() {
if ( hasPermissionGroup() ) {
variables.permissionGroups.clear();
} else {
@@ -414,7 +410,7 @@ component
*
* @permissions The permissions array to override
*/
- Author function setPermissions( required array permissions ){
+ Author function setPermissions( required array permissions ) {
if ( hasPermissions() ) {
variables.permissions.clear();
variables.permissions.addAll( arguments.permissions );
@@ -427,7 +423,7 @@ component
/**
* Shortcut Utlity function to get a list of all the permission groups this user belongs to.
*/
- string function getPermissionGroupsList( delimiter = "," ){
+ string function getPermissionGroupsList( delimiter = "," ) {
if ( hasPermissionGroup() ) {
return arrayReduce(
variables.permissionGroups,
@@ -443,7 +439,7 @@ component
*
* @group The permission group to add
*/
- Author function addPermissionGroup( required group ){
+ Author function addPermissionGroup( required group ) {
// Only add if not already there.
if ( !hasPermissionGroup( arguments.group ) ) {
arrayAppend( variables.permissionGroups, arguments.group );
@@ -457,7 +453,7 @@ component
*
* @group The permission group to add
*/
- Author function removePermissionGroup( required group ){
+ Author function removePermissionGroup( required group ) {
// Only add if not already there.
if ( hasPermissionGroup( arguments.group ) ) {
arrayDelete( variables.permissionGroups, arguments.group );
@@ -470,17 +466,20 @@ component
* Utility method to verify if an author has been logged in to the system or not.
* This method does not account for permissions. Only for logged in status.
*/
- function isLoggedIn(){
+ function isLoggedIn() {
return getLoggedIn();
}
/**
* Get formatted lastLogin
*/
- string function getDisplayLastLogin( dateFormat = this.DATE_FORMAt, timeFormat = this.TIME_FORMAT ){
+ string function getDisplayLastLogin(
+ dateFormat = this.DATE_FORMAt,
+ timeFormat = this.TIME_FORMAT
+ ) {
var lastLogin = getLastLogin();
- if ( NOT isNull( lastLogin ) ) {
+ if ( !isNull( lastLogin ) ) {
return dateFormat( lastLogin, arguments.dateFormat ) & " " & timeFormat( lastLogin, arguments.timeFormat );
}
@@ -494,8 +493,13 @@ component
*
* @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" {
+ Author function setPreferences( required any preferences ) {
+ lock
+ name ="user.#getAuthorID()#.preferences"
+ type ="exclusive"
+ throwontimeout="true"
+ timeout ="5"
+ {
if ( isStruct( arguments.preferences ) ) {
arguments.preferences = serializeJSON( arguments.preferences );
}
@@ -508,18 +512,28 @@ 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() );
+ struct function getAllPreferences() {
+ lock
+ name ="user.#getAuthorID()#.preferences"
+ type ="readonly"
+ throwontimeout="true"
+ timeout ="5"
+ {
+ return ( !isNull( preferences ) && isJSON( preferences ) ? deserializeJSON( preferences ) : structNew() );
}
}
/**
* Get a preference, you can pass a default value if preference does not exist
*/
- any function getPreference( required name, defaultValue ){
+ any function getPreference( required name, defaultValue ) {
// get preference
- lock name="user.#getAuthorID()#.preferences" type="readonly" throwontimeout="true" timeout="5" {
+ lock
+ name ="user.#getAuthorID()#.preferences"
+ type ="readonly"
+ throwontimeout="true"
+ timeout ="5"
+ {
var allPreferences = getAllPreferences();
if ( structKeyExists( allPreferences, arguments.name ) ) {
return allPreferences[ arguments.name ];
@@ -540,8 +554,8 @@ component
/**
* Set a preference in the user preferences
*/
- Author function setPreference( required name, required value ){
- var allPreferences = getAllPreferences();
+ Author function setPreference( required name, required value ) {
+ var allPreferences = getAllPreferences();
allPreferences[ arguments.name ] = arguments.value;
// store in lock mode
return setPreferences( allPreferences );
@@ -552,14 +566,14 @@ component
/**
* A struct of custom claims to add to the JWT token
*/
- struct function getJwtCustomClaims(){
+ struct function getJwtCustomClaims() {
return {};
}
/**
* This function returns an array of all the scopes that should be attached to the JWT token that will be used for authorization.
*/
- array function getJwtScopes(){
+ array function getJwtScopes() {
return [];
}
@@ -568,14 +582,14 @@ component
/**
* Get the user's role name
*/
- string function getRoleName(){
+ string function getRoleName() {
return ( hasRole() ? getRole().getRole() : "" );
}
/**
* Retrieve full name
*/
- string function getFullName(){
+ string function getFullName() {
return getFirstname() & " " & getLastName();
}
@@ -584,24 +598,24 @@ component
*
* @size The size of the avatar, defaults to 40
*/
- string function getAvatarLink( numeric size = 40 ){
+ string function getAvatarLink( numeric size = 40 ) {
return ( isNull( getEmail() ) ? "" : variables.avatar.generateLink( getEmail(), arguments.size ) );
}
/**
* Utility method to get a snapshot of the user information
*/
- struct function getInfoSnapshot(){
+ struct function getInfoSnapshot() {
if ( isLoaded() ) {
return {
- "authorID" : getAuthorID(),
- "name" : getFullName(),
- "email" : getEmail(),
- "avatarLink" : getAvatarLink()
+ "authorID" : getAuthorID(),
+ "name" : getFullName(),
+ "email" : getEmail(),
+ "avatarLink": getAvatarLink()
};
}
return {};
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/AuthorService.cfc b/modules/contentbox/models/security/AuthorService.cfc
index 14df4f3a52..ac942d28c3 100755
--- a/modules/contentbox/models/security/AuthorService.cfc
+++ b/modules/contentbox/models/security/AuthorService.cfc
@@ -1,34 +1,42 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
* ---
* Service to handle user operations.
*/
-component
- extends ="cborm.models.VirtualEntityService"
- accessors="true"
- singleton
-{
-
+component extends ="cborm.models.VirtualEntityService" accessors="true" singleton {
// DI
property name="bCrypt" inject="BCrypt@BCrypt";
+
property name="dateUtil" inject="DateUtil@contentbox";
+
property name="CBHelper" inject="CBHelper@contentbox";
+
property name="mailService" inject="mailService@cbmailservices";
+
property name="permissionService" inject="permissionService@contentbox";
- property name="permissionGroupService" inject="permissionGroupService@contentbox";
+
+ property
+ name="permissionGroupService"
+ inject="permissionGroupService@contentbox";
+
property name="renderer" inject="coldbox:renderer";
+
property name="requestService" inject="coldbox:requestService";
+
property name="roleService" inject="roleService@contentbox";
+
property name="settingService" inject="provider:settingService@contentbox";
+
property name="securityService" inject="provider:securityService@contentbox";
+
property name="siteService" inject="provider:siteService@contentbox";
/**
* Constructor
*/
- AuthorService function init(){
+ AuthorService function init() {
// init it
super.init( entityName = "cbAuthor" );
@@ -40,16 +48,16 @@ component
*
* @authorId The author id to report on
*/
- numeric function getTotalPages( required authorId ){
+ numeric function getTotalPages( required authorId ) {
return executeQuery(
- query: "
+ query = "
SELECT count(*)
FROM cbContent content join content.creator creator
WHERE creator.authorID = :authorId AND
content.contentType = 'Page'
",
- params: { "authorId" : arguments.authorId },
- unique: true
+ params = { "authorId": arguments.authorId },
+ unique = true
);
}
@@ -58,16 +66,16 @@ component
*
* @authorId The author id to report on
*/
- numeric function getTotalEntries( required authorId ){
+ numeric function getTotalEntries( required authorId ) {
return executeQuery(
- query: "
+ query = "
SELECT count(*)
FROM cbContent content join content.creator creator
WHERE creator.authorID = :authorId AND
content.contentType = 'Entry'
",
- params: { "authorId" : arguments.authorId },
- unique: true
+ params = { "authorId": arguments.authorId },
+ unique = true
);
}
@@ -76,16 +84,16 @@ component
*
* @authorId The author id to report on
*/
- numeric function getTotalContentStoreItems( required authorId ){
+ numeric function getTotalContentStoreItems( required authorId ) {
return executeQuery(
- query: "
+ query = "
SELECT count(*)
FROM cbContent content join content.creator creator
WHERE creator.authorID = :authorId AND
content.contentType = 'ContentStore'
",
- params: { "authorId" : arguments.authorId },
- unique: true
+ params = { "authorId": arguments.authorId },
+ unique = true
);
}
@@ -94,32 +102,32 @@ component
*
* @authorId The author id to report on
*/
- numeric function getTotalContent( required authorId ){
+ numeric function getTotalContent( required authorId ) {
return executeQuery(
- query: "
+ query = "
SELECT count(*)
FROM cbContent content join content.creator creator
WHERE creator.authorID = :authorId
",
- params: { "authorId" : arguments.authorId },
- unique: true
+ params = { "authorId": arguments.authorId },
+ unique = true
);
}
/**
* Get a status report of authors in the system.
*/
- function getStatusReport(){
- var c = newCriteria();
+ function getStatusReport() {
+ var c = newCriteria();
var results = {
- "active" : 0,
- "deactivated" : 0,
- "2FactorAuthEnabled" : 0,
- "2FactorAuthDisabled" : 0
+ "active" : 0,
+ "deactivated" : 0,
+ "2FactorAuthEnabled" : 0,
+ "2FactorAuthDisabled": 0
};
var statusReport = c
- .withProjections( count: "isActive:authors", groupProperty: "isActive" )
+ .withProjections( count = "isActive:authors", groupProperty = "isActive" )
.asStruct()
.list();
@@ -132,7 +140,10 @@ component
}
var twoFactorAuthReport = c
- .withProjections( count: "is2FactorAuth:authors", groupProperty: "is2FactorAuth" )
+ .withProjections(
+ count = "is2FactorAuth:authors",
+ groupProperty = "is2FactorAuth"
+ )
.asStruct()
.list();
@@ -152,7 +163,7 @@ component
*
* @author The author to delete
*/
- AuthorService function delete( required author ){
+ AuthorService function delete( required author ) {
transaction {
// Clear out relationships
arguments.author.clearPermissions();
@@ -172,7 +183,7 @@ component
*
* @return true if they match
*/
- boolean function isSameHash( required incoming, required target ){
+ boolean function isSameHash( required incoming, required target ) {
return variables.bcrypt.checkPassword( arguments.incoming, arguments.target );
}
@@ -183,7 +194,7 @@ component
*
* @return The created author
*/
- Author function createNewAuthor( required author ){
+ Author function createNewAuthor( required author ) {
transaction {
// Save it
this.save( arguments.author );
@@ -192,9 +203,9 @@ component
var mailResults = sendNewUserEmail( arguments.author );
if ( mailResults.error ) {
variables.logger.error(
- "Error sending author created email for #arguments.author.getFullName()#",
- mailResults.messages
- );
+ "Error sending author created email for #arguments.author.getFullName()#",
+ mailResults.messages
+ );
}
}
@@ -209,9 +220,9 @@ component
*
* @return Author
*/
- Author function save( required author, boolean passwordChange = false ){
+ Author function save( required author, boolean passwordChange = false ) {
// bcrypt password if new author
- if ( !arguments.author.isLoaded() OR arguments.passwordChange ) {
+ if ( !arguments.author.isLoaded() || arguments.passwordChange ) {
// bcrypt the incoming password
arguments.author.setPassword( variables.bcrypt.hashPassword( arguments.author.getPassword() ) );
}
@@ -239,58 +250,60 @@ component
string searchTerm = "",
string isActive,
string role,
- numeric max = 0,
- numeric offset = 0,
- boolean asQuery = false,
- string sortOrder = "lastName",
+ numeric max = 0,
+ numeric offset = 0,
+ boolean asQuery = false,
+ string sortOrder = "lastName",
string permissionGroups,
string twoFactorAuth
- ){
- var results = { "count" : 0, "authors" : [] };
- var c = newCriteria();
+ ) {
+ var results = { "count": 0, "authors": [] };
+ var c = newCriteria();
// Search
if ( len( arguments.searchTerm ) ) {
c.$or(
- c.restrictions.like( "firstName", "%#arguments.searchTerm#%" ),
- c.restrictions.like( "lastName", "%#arguments.searchTerm#%" ),
- c.restrictions.like( "email", "%#arguments.searchTerm#%" )
- );
+ c.restrictions.like( "firstName", "%#arguments.searchTerm#%" ),
+ c.restrictions.like( "lastName", "%#arguments.searchTerm#%" ),
+ c.restrictions.like( "email", "%#arguments.searchTerm#%" )
+ );
}
// isActive filter
- if ( structKeyExists( arguments, "isActive" ) AND arguments.isActive NEQ "any" ) {
+ if ( structKeyExists( arguments, "isActive" ) && arguments.isActive NEQ "any" ) {
c.isEq( "isActive", javacast( "boolean", arguments.isActive ) );
}
// twoFactorAuth filter
- if ( structKeyExists( arguments, "twoFactorAuth" ) AND arguments.twoFactorAuth NEQ "any" ) {
- c.isEq( "is2FactorAuth", javacast( "boolean", arguments.twoFactorAuth ) );
+ if ( structKeyExists( arguments, "twoFactorAuth" ) && arguments.twoFactorAuth NEQ "any" ) {
+ c.isEq(
+ "is2FactorAuth",
+ javacast( "boolean", arguments.twoFactorAuth )
+ );
}
// role filter
- if ( structKeyExists( arguments, "role" ) AND arguments.role NEQ "any" ) {
+ if ( structKeyExists( arguments, "role" ) && arguments.role NEQ "any" ) {
c.createAlias( "role", "role" ).isEq( "role.roleID", arguments.role );
}
// permission groups filter
- if ( structKeyExists( arguments, "permissionGroups" ) AND arguments.permissionGroups NEQ "any" ) {
- c.createAlias( "permissionGroups", "permissionGroups" )
- .isIn( "permissionGroups.permissionGroupID", listToArray( arguments.permissionGroups ) );
+ if ( structKeyExists( arguments, "permissionGroups" ) && arguments.permissionGroups NEQ "any" ) {
+ c.createAlias( "permissionGroups", "permissionGroups" ).isIn(
+ "permissionGroups.permissionGroupID",
+ listToArray( arguments.permissionGroups )
+ );
}
// run criteria query and projections count
- results.count = c.count( "authorID" );
- results.authors = c
- .resultTransformer( c.DISTINCT_ROOT_ENTITY )
- .list(
+ results.count = c.count( "authorID" );
+ results.authors = c.resultTransformer( c.DISTINCT_ROOT_ENTITY ).list(
offset = arguments.offset,
max = arguments.max,
sortOrder = arguments.sortOrder,
asQuery = arguments.asQuery
);
-
return results;
}
@@ -301,7 +314,7 @@ component
*
* @throws EntityNotFound
*/
- Author function retrieveUserByUsername( required username ){
+ Author function retrieveUserByUsername( required username ) {
var oAuthor = newCriteria()
.isEq( "username", arguments.username )
.isTrue( "isActive" )
@@ -324,7 +337,7 @@ component
*
* @throws EntityNotFound
*/
- Author function retrieveUserById( required id ){
+ Author function retrieveUserById( required id ) {
var oAuthor = newCriteria()
.isEq( "authorID", arguments.id )
.isTrue( "isActive" )
@@ -332,7 +345,10 @@ 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;
}
@@ -342,8 +358,8 @@ component
*
* @username The username to check if it exists already
*/
- boolean function usernameFound( required username ){
- var args = { "username" : arguments.username };
+ boolean function usernameFound( required username ) {
+ var args = { "username": arguments.username };
return ( countWhere( argumentCollection = args ) GT 0 );
}
@@ -352,20 +368,22 @@ component
*
* @email The email to check if it exists already
*/
- boolean function emailFound( required email ){
- var args = { "email" : arguments.email };
+ boolean function emailFound( required email ) {
+ var args = { "email": arguments.email };
return ( countWhere( argumentCollection = args ) GT 0 );
}
/**
* Get all data prepared for export
*/
- array function getAllForExport(){
- return getAll().map( function( thisItem ){
- return arguments.thisItem.getMemento(
- includes: "permissions,permissionGroups,isPasswordReset,is2FactorAuth"
+ array function getAllForExport() {
+ return getAll().map(
+ function( thisItem ) {
+ return arguments.thisItem.getMemento(
+ includes = "permissions,permissionGroups,isPasswordReset,is2FactorAuth"
+ );
+ }
);
- } );
}
/**
@@ -378,14 +396,17 @@ component
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -411,12 +432,12 @@ component
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allUsers = [];
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -424,15 +445,15 @@ component
for ( var thisUser in arguments.importData ) {
// Get new or persisted
var oUser = this.findByUsername( thisUser.username );
- oUser = ( isNull( oUser ) ? new () : oUser );
+ oUser = ( isNull( oUser ) ? new() : oUser );
// populate content from data
getBeanPopulator().populateFromStruct(
- target = oUser,
- memento = thisUser,
- exclude = "role,authorID,permissions,permissionGroups",
- composeRelationships = false
- );
+ target = oUser,
+ memento = thisUser,
+ exclude = "role,authorID,permissions,permissionGroups",
+ composeRelationships = false
+ );
// A-LA-CARTE PERMISSIONS
if ( arrayLen( thisUser.permissions ) ) {
@@ -440,12 +461,14 @@ component
var allPermissions = [];
for ( var thisPermission in thisUser.permissions ) {
var oPerm = variables.permissionService.findByPermission( thisPermission.permission );
- oPerm = (
- isNull( oPerm ) ? getBeanPopulator().populateFromStruct(
- target = variables.permissionService.new(),
- memento = thisPermission,
- exclude = "permissionID"
- ) : oPerm
+ oPerm = (
+ isNull( oPerm )
+ ? getBeanPopulator().populateFromStruct(
+ target = variables.permissionService.new(),
+ memento = thisPermission,
+ exclude = "permissionID"
+ )
+ : oPerm
);
// save oPerm if new only
if ( !oPerm.isLoaded() ) {
@@ -461,12 +484,14 @@ component
// Create group permissions that don't exist first
for ( var thisGroup in thisUser.permissionGroups ) {
var oGroup = variables.permissionGroupService.findByName( thisGroup.name );
- oGroup = (
- isNull( oGroup ) ? getBeanPopulator().populateFromStruct(
- target = variables.permissionGroupService.new(),
- memento = thisGroup,
- exclude = "permissionGroupID,permissions"
- ) : oGroup
+ oGroup = (
+ isNull( oGroup )
+ ? getBeanPopulator().populateFromStruct(
+ target = variables.permissionGroupService.new(),
+ memento = thisGroup,
+ exclude = "permissionGroupID,permissions"
+ )
+ : oGroup
);
// save oGroup if new only
if ( !oGroup.isLoaded() ) {
@@ -483,8 +508,8 @@ component
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.",
- type : "RoleNotFoundException"
+ message = "The role to import (#encodeForHTML( thisUser.role.role )#) does not exist in the system. Create it or import it first.",
+ type = "RoleNotFoundException"
);
}
@@ -492,7 +517,7 @@ component
if ( !oUser.isLoaded() ) {
arguments.importLog.append( "New user imported: #thisUser.username# " );
arrayAppend( allUsers, oUser );
- } else if ( oUser.isLoaded() and arguments.override ) {
+ } else if ( oUser.isLoaded() && arguments.override ) {
arguments.importLog.append( "Persisted user overriden: #thisUser.username# " );
arrayAppend( allUsers, oUser );
} else {
@@ -507,8 +532,8 @@ component
arguments.importLog.append( "Saved all imported and overriden users!" );
} else {
arguments.importLog.append(
- "No users imported as none where found or able to be overriden from the import file."
- );
+ "No users imported as none where found or able to be overriden from the import file."
+ );
}
}
// end of transaction
@@ -523,49 +548,55 @@ component
*
* @return struct of { error:boolean, messages:array }
*/
- struct function sendNewUserEmail( required Author author ){
- var token = variables.securityService.generateResetToken( arguments.author );
- var settings = variables.settingService.getAllSettings();
+ struct function sendNewUserEmail( required Author author ) {
+ 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 = {
- name : arguments.author.getFullName(),
- email : arguments.author.getEmail(),
- username : arguments.author.getUsername(),
- linkTimeout : settings.cb_security_password_reset_expiration,
- linkToken : adminUrl & "/security/verifyReset?token=#token#",
- resetLink : adminUrl & "/security/lostPassword",
- siteName : defaultSite.getName(),
- issuedBy : "",
- issuedEmail : ""
+ name : arguments.author.getFullName(),
+ email : arguments.author.getEmail(),
+ username : arguments.author.getUsername(),
+ linkTimeout: settings.cb_security_password_reset_expiration,
+ linkToken : adminUrl & "/security/verifyReset?token=#token#",
+ resetLink : adminUrl & "/security/lostPassword",
+ siteName : defaultSite.getName(),
+ issuedBy : "",
+ issuedEmail: ""
};
// Build email out
var mail = variables.mailservice.newMail(
- to = arguments.author.getEmail(),
- from = settings.cb_site_outgoingEmail,
- subject = "#defaultSite.getName()# Account was created for you",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = arguments.author.getEmail(),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#defaultSite.getName()# Account was created for you",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
mail.setBody(
- variables.renderer.layout(
- layout = "/contentbox/email_templates/layouts/email",
- view = "contentbox/email_templates/author_welcome"
- )
- );
+ variables.renderer.layout(
+ layout = "/contentbox/email_templates/layouts/email",
+ view = "contentbox/email_templates/author_welcome"
+ )
+ );
// send it out
- return variables.mailService.send( mail ).getResults();
+ return variables
+ .mailService
+ .send( mail )
+ .getResults();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/ISecurityService.cfc b/modules/contentbox/models/security/ISecurityService.cfc
index 6791fe312c..4ed40baf19 100755
--- a/modules/contentbox/models/security/ISecurityService.cfc
+++ b/modules/contentbox/models/security/ISecurityService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -81,5 +81,4 @@ interface {
* Checks Whether a content entry or page is protected and user has credentials for it
*/
boolean function isContentViewable( required content );
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/LoginAttempt.cfc b/modules/contentbox/models/security/LoginAttempt.cfc
index df6c119b4b..b7ea9448df 100644
--- a/modules/contentbox/models/security/LoginAttempt.cfc
+++ b/modules/contentbox/models/security/LoginAttempt.cfc
@@ -13,91 +13,87 @@ component
cachename ="loginAttempt"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
/**
* Primary key
*/
property
- name ="loginAttemptsID"
- column ="loginAttemptsID"
+ name="loginAttemptsID"
+ column="loginAttemptsID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
/**
* The username attempt value
*/
property
- name ="value"
- column ="value"
+ name="value"
+ column="value"
notnull="true"
default=""
- length ="255"
- index ="idx_values";
+ length="255"
+ index="idx_values";
+
/**
* How many attempts in the system
*/
property
- name ="attempts"
- column ="attempts"
+ name="attempts"
+ column="attempts"
ormtype="integer"
notnull="true"
default="0";
+
/**
* Tracks the last successful login IP address
*/
property
- name ="lastLoginSuccessIP"
- column ="lastLoginSuccessIP"
+ name="lastLoginSuccessIP"
+ column="lastLoginSuccessIP"
notnull="false"
- length ="100";
+ length="100";
+
/**
* Verifies if tracking is blocked or not
*/
property
- name ="isBlocked"
- column ="isBlocked"
+ name="isBlocked"
+ column="isBlocked"
persistent="false"
- default ="false"
- type ="boolean";
-
- /* *********************************************************************
- ** PK+CONSTRAINTS
- ********************************************************************* */
+ default="false"
+ type="boolean";
+ /**********************************************************************
+ * ** PK+CONSTRAINTS
+ **********************************************************************/
this.pk = "loginAttemptsID";
this.memento = {
- defaultIncludes : [
- "value",
- "attempts",
- "lastLoginSuccessIP",
- "isBlocked"
- ],
- defaultExcludes : [ "" ]
+ defaultIncludes: [ "value", "attempts", "lastLoginSuccessIP", "isBlocked"],
+ defaultExcludes: [ ""]
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
+ function init() {
variables.createdDate = now();
- variables.attempts = 0;
- variables.isBlocked = false;
+ variables.attempts = 0;
+ variables.isBlocked = false;
super.init();
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/LoginTracker.cfc b/modules/contentbox/models/security/LoginTracker.cfc
index 8ba2f8b93e..7651355002 100644
--- a/modules/contentbox/models/security/LoginTracker.cfc
+++ b/modules/contentbox/models/security/LoginTracker.cfc
@@ -6,19 +6,23 @@
* Listens to login attempts to keep track of them via the Login Tracker System
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="settingService" inject="id:settingService@contentbox";
+
property name="securityService" inject="id:securityService@contentbox";
+
property name="loginTrackerService" inject="id:loginTrackerService@contentbox";
+
property name="cb" inject="cbhelper@contentbox";
+
property name="systemUtil" inject="SystemUtil@contentbox";
+
property name="messagebox" inject="messagebox@cbMessagebox";
/**
* Configure interceptor
*/
- function configure(){
+ function configure() {
return this;
}
@@ -26,7 +30,7 @@ component extends="coldbox.system.Interceptor" {
* Before login check if user has been blocked. It will verify login attempts
* by username and IP address and block accordingly.
*/
- function cbadmin_preLogin( event, data, buffer ){
+ function cbadmin_preLogin( event, data, buffer ) {
// if disabled, we do not track logins
if ( !settingService.getSetting( "cb_security_login_blocker" ) ) {
return;
@@ -35,28 +39,28 @@ component extends="coldbox.system.Interceptor" {
loginTrackerService.reset();
// prepare collections
- var prc = event.getCollection( private = true );
- var realIP = variables.securityService.getRealIP();
+ var prc = event.getCollection( private = true );
+ var realIP = variables.securityService.getRealIP();
var realUsername = event.getValue( "username", "" );
// Try to find by username or IPs being blocked
- var aBlockIPs = loginTrackerService.findAllByValue( realIP );
+ var aBlockIPs = loginTrackerService.findAllByValue( realIP );
var aBlockUsernames = loginTrackerService.findAllByValue( realUsername );
- prc.oBlockByIP = ( arrayLen( aBlockIps ) ? aBlockIps[ 1 ] : loginTrackerService.new() );
+ prc.oBlockByIP = ( arrayLen( aBlockIps ) ? aBlockIps[ 1 ] : loginTrackerService.new() );
prc.oBlockByUsername = ( arrayLen( aBlockUsernames ) ? aBlockUsernames[ 1 ] : loginTrackerService.new() );
// do checks to prevent login
var isBlocked = false;
// which reason?
- var byIP = false;
+ var byIP = false;
// do checks by username and IP
- if ( !isNull( prc.oBlockByUsername ) and loginTrackerService.isBlocked( prc.oBlockByUsername ) ) {
+ if ( !isNull( prc.oBlockByUsername ) && loginTrackerService.isBlocked( prc.oBlockByUsername ) ) {
isBlocked = true;
}
- if ( !isNull( prc.oBlockByIP ) and loginTrackerService.isBlocked( prc.oBlockByIP ) ) {
+ if ( !isNull( prc.oBlockByIP ) && loginTrackerService.isBlocked( prc.oBlockByIP ) ) {
isBlocked = true;
- byIP = true;
+ byIP = true;
}
// If blocked, relocate
@@ -67,7 +71,9 @@ component extends="coldbox.system.Interceptor" {
messagebox.warn( cb.r( "messages.user_blocked@security" ) );
}
// Log it
- log.warn( "Request blocked (#realIP#;#realUsername#) via login tracker" );
+ log.warn(
+ "Request blocked (#realIP#;#realUsername#) via login tracker"
+ );
// Relocate
relocate( "#prc.cbAdminEntryPoint#.security.login" );
}
@@ -76,21 +82,23 @@ component extends="coldbox.system.Interceptor" {
/**
* Listen to successful logins
*/
- function cbadmin_onLogin( event, data, buffer ){
+ function cbadmin_onLogin( event, data, buffer ) {
// if disabled, we do not track logins
if ( !settingService.getSetting( "cb_security_login_blocker" ) ) {
return;
}
// get prc
- var prc = event.getCollection( private = true );
+ var prc = event.getCollection( private = true );
// get logged in user
- var oUser = securityService.getAuthorSession();
+ var oUser = securityService.getAuthorSession();
// Build entry to log
- var oEntry = loginTrackerService.new( {
- lastLoginSuccessIP : variables.securityService.getRealIP(),
- attempts : 0,
- value : oUser.getUsername()
- } );
+ var oEntry = loginTrackerService.new(
+ {
+ lastLoginSuccessIP: variables.securityService.getRealIP(),
+ attempts : 0,
+ value : oUser.getUsername()
+ }
+ );
// If blocked username get's it right, then log it and clear attempts
if ( !isNull( prc.oBlockByUsername ) ) {
@@ -112,21 +120,21 @@ component extends="coldbox.system.Interceptor" {
* so we can verify later if they will be blocked by username or ip misuses
* the blockByIp and blockByUsername entities are prepared on pre-login
*/
- void function cbadmin_onBadLogin( event, data, buffer ){
+ void function cbadmin_onBadLogin( event, data, buffer ) {
// if disabled, we do not track logins
if ( !settingService.getSetting( "cb_security_login_blocker" ) ) {
return;
}
// prepare collections
- var prc = event.getCollection( private = true );
- var realIP = variables.securityService.getRealIP();
+ var prc = event.getCollection( private = true );
+ var realIP = variables.securityService.getRealIP();
var realUsername = event.getValue( "username", "" );
// make or update entry for IP
if ( !isNull( prc.oBlockByIP ) ) {
prc.oBlockByIP.setAttempts( prc.oBlockByIP.getAttempts() + 1 );
} else {
- prc.oBlockByIP = loginTrackerService.new( { value : realIP, attempts : 1 } );
+ prc.oBlockByIP = loginTrackerService.new( { value: realIP, attempts: 1 } );
}
// Update date + Log it by ip
prc.oBlockByIP.setCreatedDate( now() );
@@ -136,11 +144,11 @@ component extends="coldbox.system.Interceptor" {
if ( !isNull( prc.oBlockByUsername ) ) {
prc.oBlockByUsername.setAttempts( prc.oBlockByUsername.getAttempts() + 1 );
} else {
- prc.oBlockByUsername = loginTrackerService.new( { value : realUsername, attempts : 1 } );
+ prc.oBlockByUsername = loginTrackerService.new( { value: realUsername, attempts: 1 } );
}
// Update date + Log it by ip
prc.oBlockByUsername.setCreatedDate( now() );
loginTrackerService.save( prc.oBlockByUsername );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/LoginTrackerService.cfc b/modules/contentbox/models/security/LoginTrackerService.cfc
index 7f1953b494..137c00692a 100644
--- a/modules/contentbox/models/security/LoginTrackerService.cfc
+++ b/modules/contentbox/models/security/LoginTrackerService.cfc
@@ -6,16 +6,17 @@
* This Service tracks logins into the ContentBox System
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="settingService" inject="id:settingService@contentbox";
+
property name="cb" inject="cbhelper@contentbox";
+
property name="log" inject="logbox:logger:{this}";
/**
* Constructor
*/
- function init(){
+ function init() {
// init it
super.init( entityName = "cbLoginAttempt" );
return this;
@@ -28,13 +29,20 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return If the attempt was blocked or not
*/
- boolean function isBlocked( LoginAttempt attempt ){
- var max_attempts = variables.settingService.getSetting( "cb_security_max_attempts" );
+ boolean function isBlocked( LoginAttempt attempt ) {
+ var max_attempts = variables.settingService.getSetting( "cb_security_max_attempts" );
var max_blockTime = variables.settingService.getSetting( "cb_security_blocktime" );
if (
- arguments.attempt.getAttempts() gte max_attempts AND
- ( dateDiff( "n", arguments.attempt.getCreatedDate(), now() ) lte max_blockTime )
+ arguments.attempt.getAttempts() GTE max_attempts &&
+ (
+ dateDiff(
+ "n",
+ arguments.attempt.getCreatedDate(),
+ now()
+ ) LTE
+ max_blockTime
+ )
) {
return true;
}
@@ -47,7 +55,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @sortOrder The sorting columns.
*/
- public array function getAll( sortOrder = "attempts" ){
+ public array function getAll( sortOrder = "attempts" ) {
var allEntries = list( sortOrder = arguments.sortOrder );
for ( var e in allEntries ) {
@@ -64,10 +72,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @max How many to retrieve
*/
- function getLastLogins( required numeric max ){
- return newCriteria()
- .isNotNull( "lastLoginSuccessIP" )
- .list(
+ function getLastLogins( required numeric max ) {
+ return newCriteria().isNotNull( "lastLoginSuccessIP" ).list(
asQuery = false,
max = arguments.max,
sortOrder = "createdDate DESC"
@@ -77,7 +83,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Truncate the entire auth logs
*/
- LoginTrackerService function truncate(){
+ LoginTrackerService function truncate() {
queryExecute( "TRUNCATE TABLE cb_loginAttempts" );
return this;
}
@@ -86,22 +92,25 @@ component extends="cborm.models.VirtualEntityService" singleton {
* Rotate auth logs
* Usually called by the {@code LoginTracker} Interceptor asynchronously
*/
- LoginTrackerService function rotate(){
+ LoginTrackerService function rotate() {
// if disabled, we do not track logins
if ( !settingService.getSetting( "cb_security_login_blocker" ) ) {
- log.debug( "Rotation not enabled since the security login blocker is disabled" );
+ log.debug(
+ "Rotation not enabled since the security login blocker is disabled"
+ );
return this;
}
- var maxLogs = variables.settingService.getSetting( "cb_security_max_auth_logs" );
- var maxLogs = 2;
+ var maxLogs = variables.settingService.getSetting( "cb_security_max_auth_logs" );
+ var maxLogs = 2;
var totalLogs = count();
// only if we have a max logs and we have gone above max logs, let's truncate
if ( len( maxLogs ) && isNumeric( maxLogs ) && totalLogs > maxLogs ) {
- var aToDelete = newCriteria()
- .withProjections( property = "loginAttemptsID" )
- .list( max = ( totalLogs - maxLogs ), sortOrder = "createdDate ASC" );
+ var aToDelete = newCriteria().withProjections( property = "loginAttemptsID" ).list(
+ max = ( totalLogs - maxLogs ),
+ sortOrder = "createdDate ASC"
+ );
var hql = "
DELETE FROM cbLoginAttempt
@@ -110,9 +119,9 @@ component extends="cborm.models.VirtualEntityService" singleton {
// run it
var results = executeQuery(
- query : hql,
- params : { "idsToDelete" : aToDelete },
- asQuery: false
+ query = hql,
+ params = { "idsToDelete": aToDelete },
+ asQuery = false
);
// log it
@@ -127,7 +136,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Reset login attempts if the time limit is reached
*/
- LoginTrackerService function reset(){
+ LoginTrackerService function reset() {
var limit = dateAdd(
"n",
variables.settingService.getSetting( "cb_security_blocktime" ) * -1,
@@ -141,12 +150,16 @@ component extends="cborm.models.VirtualEntityService" singleton {
WHERE createdDate <= :limit
";
- var params = { "limit" : limit };
+ var params = { "limit": limit };
// run it
- executeQuery( query = hql, params = params, asQuery = false );
+ executeQuery(
+ query = hql,
+ params = params,
+ asQuery = false
+ );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/Permission.cfc b/modules/contentbox/models/security/Permission.cfc
index 78e05849c4..fa48fc0759 100644
--- a/modules/contentbox/models/security/Permission.cfc
+++ b/modules/contentbox/models/security/Permission.cfc
@@ -13,86 +13,84 @@ component
cachename ="cbPermission"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="permissionID"
- column ="permissionID"
+ name="permissionID"
+ column="permissionID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="permission"
- column ="permission"
+ name="permission"
+ column="permission"
ormtype="string"
notnull="true"
- length ="255"
- unique ="true"
+ length="255"
+ unique="true"
default=""
- index ="idx_permissionName";
+ index="idx_permissionName";
property
- name ="description"
- column ="description"
+ name="description"
+ column="description"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
- /* *********************************************************************
- ** CALCULATED FIELDS
- ********************************************************************* */
+ /**********************************************************************
+ * ** CALCULATED FIELDS
+ **********************************************************************/
property
- name ="numberOfPermissionGroups"
+ name="numberOfPermissionGroups"
formula="select count(*) from cb_groupPermissions as gp where gp.FK_permissionID=permissionID";
property
- name ="numberOfRoles"
+ name="numberOfRoles"
formula="select count(*) from cb_rolePermissions as rolePermissions
where rolePermissions.FK_permissionID=permissionID";
property
- name ="numberOfGroups"
+ name="numberOfGroups"
formula="select count(*) from cb_groupPermissions as groupPermissions
where groupPermissions.FK_permissionID=permissionID";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + MEMENTO
- ********************************************************************* */
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + MEMENTO
+ **********************************************************************/
this.pk = "permissionID";
this.memento = {
- defaultIncludes : [ "permission", "description" ],
- defaultExcludes : [ "" ]
+ defaultIncludes: [ "permission", "description"],
+ defaultExcludes: [ ""]
};
this.constraints = {
- "permission" : {
- required : true,
- size : "1..255",
- validator : "UniqueValidator@cborm"
+ "permission": {
+ required : true,
+ size : "1..255",
+ validator: "UniqueValidator@cborm"
},
- "description" : { required : false, size : "1..500" }
+ "description": { required: false, size: "1..500" }
};
- /* *********************************************************************
- ** PUBLIC FUNCITONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCITONS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
+ function init() {
super.init();
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/PermissionGroup.cfc b/modules/contentbox/models/security/PermissionGroup.cfc
index 73e4e8c42d..3a28b94d75 100644
--- a/modules/contentbox/models/security/PermissionGroup.cfc
+++ b/modules/contentbox/models/security/PermissionGroup.cfc
@@ -13,123 +13,119 @@ component
cachename ="cbPermissionGroup"
cacheuse ="read-write"
{
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
- /* *********************************************************************
- ** DI
- ********************************************************************* */
-
-
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="permissionGroupID"
- column ="permissionGroupID"
+ name="permissionGroupID"
+ column="permissionGroupID"
fieldtype="id"
generator="uuid"
- length ="36"
- update ="false";
+ length="36"
+ update="false";
property
- name ="name"
- column ="name"
+ name="name"
+ column="name"
ormtype="string"
notnull="true"
- length ="255"
- unique ="true"
+ length="255"
+ unique="true"
default=""
- index ="idx_permissionGroupName";
+ index="idx_permissionGroupName";
property
- name ="description"
- column ="description"
+ name="description"
+ column="description"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M2M -> Permissions
property
- name ="permissions"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- orderby ="permission"
- cascade ="save-update"
- cacheuse ="read-write"
- cfc ="contentbox.models.security.Permission"
- fkcolumn ="FK_permissionGroupID"
- linktable ="cb_groupPermissions"
+ name="permissions"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ orderby="permission"
+ cascade="save-update"
+ cacheuse="read-write"
+ cfc="contentbox.models.security.Permission"
+ fkcolumn="FK_permissionGroupID"
+ linktable="cb_groupPermissions"
inversejoincolumn="FK_permissionID";
// M2M -> Authors
property
- name ="authors"
- singularName ="author"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- cacheuse ="read-write"
- cfc ="contentbox.models.security.Author"
- fkcolumn ="FK_permissionGroupID"
- linktable ="cb_authorPermissionGroups"
+ name="authors"
+ singularName="author"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ cacheuse="read-write"
+ cfc="contentbox.models.security.Author"
+ fkcolumn="FK_permissionGroupID"
+ linktable="cb_authorPermissionGroups"
inversejoincolumn="FK_authorID";
- /* *********************************************************************
- ** CALCULATED FIELDS
- ********************************************************************* */
+ /**********************************************************************
+ * ** CALCULATED FIELDS
+ **********************************************************************/
property
- name ="numberOfPermissions"
+ name="numberOfPermissions"
formula="select count(*) from cb_groupPermissions as groupPermissions
where groupPermissions.FK_permissionGroupID = permissionGroupID";
property
- name ="numberOfAuthors"
+ name="numberOfAuthors"
formula="select count(*) from cb_authorPermissionGroups as pg where pg.FK_permissionGroupID = permissionGroupID";
- /* *********************************************************************
- ** NON PERSISTED PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** NON PERSISTED PROPERTIES
+ **********************************************************************/
property name="permissionList" persistent="false";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + MEMENTO
- ********************************************************************* */
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + MEMENTO
+ **********************************************************************/
this.pk = "permissionGroupID";
this.memento = {
- defaultIncludes : [ "*" ],
- defaultExcludes : [ "authors" ]
+ defaultIncludes: [ "*"],
+ defaultExcludes: [ "authors"]
};
this.constraints = {
- "name" : {
- required : true,
- size : "1..255",
- validator : "UniqueValidator@cborm"
+ "name": {
+ required : true,
+ size : "1..255",
+ validator: "UniqueValidator@cborm"
},
- "description" : { required : false, size : "1..500" }
+ "description": { required: false, size: "1..500" }
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
- variables.permissions = [];
- variables.authors = [];
+ function init() {
+ variables.permissions = [];
+ variables.authors = [];
variables.permissionList = [];
super.init();
@@ -141,9 +137,9 @@ component
*
* @permission One or a list of permissions to verify
*/
- boolean function hasPermission( required permission ){
+ boolean function hasPermission( required permission ) {
// cache deconstructed permissions in case it's called many times during a request.
- if ( !arrayLen( variables.permissionList ) AND hasPermissions() ) {
+ if ( !arrayLen( variables.permissionList ) && hasPermissions() ) {
variables.permissionList = arrayReduce(
getPermissions(),
( result, item ) => {
@@ -154,16 +150,16 @@ component
}
// verify
- return arrayWrap( arguments.permission )
- .filter( ( item ) => variables.permissionList.findNoCase( arguments.item ) )
- .len();
+ return arrayWrap( arguments.permission ).filter(
+ ( item ) => variables.permissionList.findNoCase( arguments.item )
+ ).len();
}
/**
* Clear all permissions
*/
- PermissionGroup function clearPermissions(){
- variables.permissions = [];
+ PermissionGroup function clearPermissions() {
+ variables.permissions = [];
variables.permissionList = [];
return this;
}
@@ -171,7 +167,7 @@ component
/**
* Clear all authors
*/
- PermissionGroup function clearAuthors(){
+ PermissionGroup function clearAuthors() {
variables.authors = [];
return this;
}
@@ -181,7 +177,7 @@ component
*
* @permissions The permissions array
*/
- PermissionGroup function setPermissions( required array permissions ){
+ PermissionGroup function setPermissions( required array permissions ) {
if ( hasPermissions() ) {
variables.permissions.clear();
variables.permissions.addAll( arguments.permissions );
@@ -196,7 +192,7 @@ component
*
* @authors The permissions array
*/
- PermissionGroup function setAuthors( required array authors ){
+ PermissionGroup function setAuthors( required array authors ) {
if ( hasAuthor() ) {
variables.authors.clear();
variables.authors.addAll( arguments.authors );
@@ -206,4 +202,4 @@ component
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/PermissionGroupService.cfc b/modules/contentbox/models/security/PermissionGroupService.cfc
index 6a4b6b64d8..ffdcfa2d77 100755
--- a/modules/contentbox/models/security/PermissionGroupService.cfc
+++ b/modules/contentbox/models/security/PermissionGroupService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,15 +6,15 @@
* Permission Group Service for contentbox
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="permissionService" inject="permissionService@contentbox";
+
property name="dateUtil" inject="DateUtil@contentbox";
/**
* Constructor
*/
- PermissionGroupService function init(){
+ PermissionGroupService function init() {
// init it
super.init( entityName = "cbPermissionGroup" );
@@ -24,10 +24,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Get all data prepared for export
*/
- array function getAllForExport(){
- return getAll().map( function( thisItem ){
- return thisItem.getMemento();
- } );
+ array function getAllForExport() {
+ return getAll().map(
+ function( thisItem ) {
+ return thisItem.getMemento();
+ }
+ );
}
/**
@@ -40,14 +42,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -71,12 +76,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allGroups = [];
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -84,15 +89,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
for ( var thisGroup in arguments.importData ) {
// Get new or persisted
var oGroup = this.findByName( thisGroup.name );
- oGroup = ( isNull( oGroup ) ? new () : oGroup );
+ oGroup = ( isNull( oGroup ) ? new() : oGroup );
// populate content from data
getBeanPopulator().populateFromStruct(
- target = oGroup,
- memento = thisGroup,
- exclude = "permissionGroupID,permissions",
- composeRelationships = false
- );
+ target = oGroup,
+ memento = thisGroup,
+ exclude = "permissionGroupID,permissions",
+ composeRelationships = false
+ );
// PERMISSIONS
if ( arrayLen( thisGroup.permissions ) ) {
@@ -100,12 +105,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
var allPermissions = [];
for ( var thisPermission in thisGroup.permissions ) {
var oPerm = variables.permissionService.findByPermission( thisPermission.permission );
- oPerm = (
- isNull( oPerm ) ? getBeanPopulator().populateFromStruct(
- target = variables.permissionService.new(),
- memento = thisPermission,
- exclude = "permissionID"
- ) : oPerm
+ oPerm = (
+ isNull( oPerm )
+ ? getBeanPopulator().populateFromStruct(
+ target = variables.permissionService.new(),
+ memento = thisPermission,
+ exclude = "permissionID"
+ )
+ : oPerm
);
// save oPerm if new only
if ( !oPerm.isLoaded() ) {
@@ -122,8 +129,10 @@ component extends="cborm.models.VirtualEntityService" singleton {
if ( !oGroup.isLoaded() ) {
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# " );
+ } else if ( oGroup.isLoaded() && arguments.override ) {
+ arguments.importLog.append(
+ "Persisted permission group overriden: #thisGroup.name# "
+ );
arrayAppend( allGroups, oGroup );
} else {
arguments.importLog.append( "Skipping permission group: #thisGroup.name# " );
@@ -137,8 +146,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.importLog.append( "Saved all imported and overriden permission groups!" );
} else {
arguments.importLog.append(
- "No permission groups imported as none where found or able to be overriden from the import file."
- );
+ "No permission groups imported as none where found or able to be overriden from the import file."
+ );
}
}
// end of transaction
@@ -146,4 +155,4 @@ component extends="cborm.models.VirtualEntityService" singleton {
return arguments.importLog.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/PermissionService.cfc b/modules/contentbox/models/security/PermissionService.cfc
index 404b8b6cb5..8ea643dd75 100755
--- a/modules/contentbox/models/security/PermissionService.cfc
+++ b/modules/contentbox/models/security/PermissionService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,14 +6,13 @@
* Permissions service for contentbox
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="dateUtil" inject="DateUtil@contentbox";
/**
* Constructor
*/
- PermissionService function init(){
+ PermissionService function init() {
// init it
super.init( entityName = "cbPermission" );
@@ -25,28 +24,28 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @permissionID The permission ID to remove
*/
- boolean function deletePermission( required permissionID ){
+ boolean function deletePermission( required permissionID ) {
transaction {
// We do SQL deletions as those relationships are not bi-directional
queryExecute(
"delete from cb_rolePermissions where FK_permissionID = :permissionID",
- { "permissionID" : arguments.permissionID }
+ { "permissionID": arguments.permissionID }
);
queryExecute(
"delete from cb_authorPermissions where FK_permissionID = :permissionID",
- { "permissionID" : arguments.permissionID }
+ { "permissionID": arguments.permissionID }
);
queryExecute(
"delete from cb_groupPermissions where FK_permissionID = :permissionID",
- { "permissionID" : arguments.permissionID }
+ { "permissionID": arguments.permissionID }
);
queryExecute(
"delete from cb_permission where permissionID = :permissionID",
- { "permissionID" : arguments.permissionID }
+ { "permissionID": arguments.permissionID }
);
}
@@ -58,17 +57,29 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @return Array of struct permission data
*/
- array function getAllForExport(){
+ 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" );
- return item;
- } );
+ .map(
+ function( item ) {
+ item[ "createdDate" ] = variables.dateUtil.toUTC(
+ item[ "createdDate" ],
+ "",
+ "UTC"
+ );
+ item[ "modifiedDate" ] = variables.dateUtil.toUTC(
+ item[ "modifiedDate" ],
+ "",
+ "UTC"
+ );
+ return item;
+ }
+ );
}
/**
@@ -81,14 +92,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -114,12 +128,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allPermissions = [];
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -127,21 +141,23 @@ component extends="cborm.models.VirtualEntityService" singleton {
for ( var thisPermission in arguments.importData ) {
// Get new or persisted
var oPermission = this.findByPermission( thisPermission.permission );
- oPermission = ( isNull( oPermission ) ? new () : oPermission );
+ oPermission = ( isNull( oPermission ) ? new() : oPermission );
// populate content from data
getBeanPopulator().populateFromStruct(
- target = oPermission,
- memento = thisPermission,
- exclude = "permissionID",
- composeRelationships = false
- );
+ target = oPermission,
+ memento = thisPermission,
+ exclude = "permissionID",
+ composeRelationships = false
+ );
// 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 ) {
+ } else if ( oPermission.isLoaded() && arguments.override ) {
arguments.importLog.append( "Permission overriden: #thisPermission.permission# " );
arrayAppend( allPermissions, oPermission );
} else {
@@ -156,8 +172,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.importLog.append( "Saved all imported and overriden permissions!" );
} else {
arguments.importLog.append(
- "No permissions imported as none where found or able to be overriden from the import file."
- );
+ "No permissions imported as none where found or able to be overriden from the import file."
+ );
}
}
// end of transaction
@@ -165,4 +181,4 @@ component extends="cborm.models.VirtualEntityService" singleton {
return arguments.importLog.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/RateLimiter.cfc b/modules/contentbox/models/security/RateLimiter.cfc
index ea01388ee2..0d3ff6a984 100755
--- a/modules/contentbox/models/security/RateLimiter.cfc
+++ b/modules/contentbox/models/security/RateLimiter.cfc
@@ -6,26 +6,29 @@
* Limits and prevents DOS attacks
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="settingService" inject="id:settingService@contentbox";
+
property name="securityService" inject="id:securityService@contentbox";
+
property name="cachebox" inject="Cachebox";
/**
* onRequestCapture
* fires before any event caching or processing
*/
- function onRequestCapture( event, data, buffer ){
+ function onRequestCapture( event, data, buffer ) {
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;
}
// do we limit bot OR normal requests as well?
- if ( !len( cgi.http_cookie ) OR !allSettings.cb_security_rate_limiter_bots_only ) {
+ if ( !len( cgi.http_cookie ) || !allSettings.cb_security_rate_limiter_bots_only ) {
// limit it now.
limiter(
count = allSettings[ "cb_security_rate_limiter_count" ],
@@ -46,15 +49,18 @@ component extends="coldbox.system.Interceptor" {
* @event The request context object
* @settings The settings structure
*/
- private function limiter( count, duration, event, settings ){
+ private function limiter( count, duration, event, settings ) {
// Get real IP address of requester
- var realIP = variables.securityService.getRealIP();
- var cache = cachebox.getDefaultCache();
+ var realIP = variables.securityService.getRealIP();
+ var cache = cachebox.getDefaultCache();
var cacheKey = "limiter" & realIP;
- var targetData = cache.getOrSet( cacheKey, function(){
- return { attempts : 0, lastAttempt : now() }
- } );
+ var targetData = cache.getOrSet(
+ cacheKey,
+ function() {
+ return { attempts: 0, lastAttempt: now() };
+ }
+ );
// on first visit no further processing
if ( targetData.attempts == 0 ) {
@@ -68,12 +74,22 @@ component extends="coldbox.system.Interceptor" {
// log.info( "Within Duration " & dateDiff( "s", targetData.lastAttempt, Now() ) LT arguments.duration );
// Are we executing another request withing our duration in seconds? Ex: Has X seconds passed before last attempt
- if ( dateDiff( "s", targetData.lastAttempt, now() ) LT arguments.duration ) {
+ if (
+ dateDiff(
+ "s",
+ targetData.lastAttempt,
+ now()
+ ) LT
+ arguments.duration
+ ) {
// Limit by count?
if ( targetData.attempts GT arguments.count ) {
if ( settings.cb_security_rate_limiter_logging && log.canInfo() ) {
// Log it to app logs
- log.info( "'limiter invoked for:','#realIP#',#targetData.attempts#,#cgi.request_method#,'#cgi.SCRIPT_NAME#', '#cgi.QUERY_STRING#','#cgi.http_user_agent#','#targetData.lastAttempt#',#listLen( cgi.http_cookie, ";" )#" );
+ log.info(
+ "'limiter invoked for:','#realIP#',#targetData.attempts#,#cgi.request_method#,'#cgi.SCRIPT_NAME#', '#cgi.QUERY_STRING#','#cgi.http_user_agent#','#targetData.lastAttempt#',#listLen( cgi.http_cookie,
+ ";" )#"
+ );
}
// Log attempt
@@ -100,7 +116,8 @@ component extends="coldbox.system.Interceptor" {
"all"
)
);
- arguments.event
+ arguments
+ .event
.setHTTPHeader( statusCode = "503" )
.setHTTPHeader( name = "Retry-After", value = arguments.duration );
@@ -116,7 +133,7 @@ component extends="coldbox.system.Interceptor" {
}
} else {
// Reset attempts counter, since we are in the safe zone, just log the last attempt timestamp
- targetData.attempts = 0;
+ targetData.attempts = 0;
targetData.lastAttempt = now();
}
@@ -124,4 +141,4 @@ component extends="coldbox.system.Interceptor" {
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/Role.cfc b/modules/contentbox/models/security/Role.cfc
index 130edcdef4..3a450446d8 100644
--- a/modules/contentbox/models/security/Role.cfc
+++ b/modules/contentbox/models/security/Role.cfc
@@ -13,108 +13,108 @@ component
cachename ="cbRole"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="permissionService"
- inject ="provider:permissionService@contentbox"
+ name="permissionService"
+ inject="provider:permissionService@contentbox"
persistent="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="roleID"
- column ="roleID"
+ name="roleID"
+ column="roleID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="role"
- column ="role"
+ name="role"
+ column="role"
ormtype="string"
notnull="true"
- length ="255"
- unique ="true"
+ length="255"
+ unique="true"
default=""
- index ="idx_roleName";
+ index="idx_roleName";
property
- name ="description"
- column ="description"
+ name="description"
+ column="description"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M2M -> Permissions
property
- name ="permissions"
- fieldtype ="many-to-many"
- type ="array"
- lazy ="true"
- orderby ="permission"
- cascade ="save-update"
- cacheuse ="read-write"
- cfc ="contentbox.models.security.Permission"
- fkcolumn ="FK_roleID"
- linktable ="cb_rolePermissions"
+ name="permissions"
+ fieldtype="many-to-many"
+ type="array"
+ lazy="true"
+ orderby="permission"
+ cascade="save-update"
+ cacheuse="read-write"
+ cfc="contentbox.models.security.Permission"
+ fkcolumn="FK_roleID"
+ linktable="cb_rolePermissions"
inversejoincolumn="FK_permissionID";
- /* *********************************************************************
- ** CALUCLATED FIELDS
- ********************************************************************* */
+ /**********************************************************************
+ * ** CALUCLATED FIELDS
+ **********************************************************************/
property
- name ="numberOfPermissions"
+ 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
- ********************************************************************* */
+ /**********************************************************************
+ * ** NON PERSISTED PROPERTIES
+ **********************************************************************/
property name="permissionList" persistent="false";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + MEMENTO
- ********************************************************************* */
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + MEMENTO
+ **********************************************************************/
this.pk = "roleID";
this.memento = {
- defaultIncludes : [ "role", "description" ],
- defaultExcludes : [ "permissionList" ]
+ defaultIncludes: [ "role", "description"],
+ defaultExcludes: [ "permissionList"]
};
this.constraints = {
- "role" : {
- required : true,
- size : "1..255",
- validator : "UniqueValidator@cborm"
+ "role": {
+ required : true,
+ size : "1..255",
+ validator: "UniqueValidator@cborm"
},
- "description" : { required : false, size : "1..500" }
+ "description": { required: false, size: "1..500" }
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
// Constructor
- function init(){
- variables.permissions = [];
+ function init() {
+ variables.permissions = [];
variables.permissionList = [];
super.init();
@@ -124,7 +124,7 @@ component
/**
* Get the role name, same as getRole()
*/
- string function getName(){
+ string function getName() {
return variables.role;
}
@@ -133,9 +133,9 @@ component
*
* @permission One or a list of permissions to verify
*/
- boolean function hasPermission( required permission ){
+ boolean function hasPermission( required permission ) {
// cache deconstructed permissions in case it's called many times during a request.
- if ( !arrayLen( variables.permissionList ) AND hasPermissions() ) {
+ if ( !arrayLen( variables.permissionList ) && hasPermissions() ) {
variables.permissionList = arrayReduce(
getPermissions(),
( result, item ) => {
@@ -145,16 +145,16 @@ component
);
}
// verify
- return arrayWrap( arguments.permission )
- .filter( ( item ) => variables.permissionList.findNoCase( arguments.item ) )
- .len();
+ return arrayWrap( arguments.permission ).filter(
+ ( item ) => variables.permissionList.findNoCase( arguments.item )
+ ).len();
}
/**
* Clear all permissions
*/
- Role function clearPermissions(){
- variables.permissions = [];
+ Role function clearPermissions() {
+ variables.permissions = [];
variables.permissionList = [];
return this;
}
@@ -162,7 +162,7 @@ component
/**
* Override the setPermissions
*/
- Role function setPermissions( required array permissions ){
+ Role function setPermissions( required array permissions ) {
if ( hasPermissions() ) {
variables.permissions.clear();
variables.permissions.addAll( arguments.permissions );
@@ -172,4 +172,4 @@ component
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/RoleService.cfc b/modules/contentbox/models/security/RoleService.cfc
index 3e509b0967..b5f9d5809f 100755
--- a/modules/contentbox/models/security/RoleService.cfc
+++ b/modules/contentbox/models/security/RoleService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,15 +6,15 @@
* Roles service for contentbox
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="permissionService" inject="permissionService@contentbox";
+
property name="dateUtil" inject="DateUtil@contentbox";
/**
* Constructor
*/
- RoleService function init(){
+ RoleService function init() {
// init it
super.init( entityName = "cbRole" );
@@ -24,10 +24,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Get all data prepared for export
*/
- array function getAllForExport(){
- return getAll().map( function( thisItem ){
- return thisItem.getMemento( includes = "permissions" );
- } );
+ array function getAllForExport() {
+ return getAll().map(
+ function( thisItem ) {
+ return thisItem.getMemento( includes = "permissions" );
+ }
+ );
}
/**
@@ -40,14 +42,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -73,12 +78,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allRoles = [];
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -86,15 +91,15 @@ component extends="cborm.models.VirtualEntityService" singleton {
for ( var thisRole in arguments.importData ) {
// Get new or persisted
var oRole = this.findByRole( thisRole.role );
- oRole = ( isNull( oRole ) ? new () : oRole );
+ oRole = ( isNull( oRole ) ? new() : oRole );
// populate content from data
getBeanPopulator().populateFromStruct(
- target = oRole,
- memento = thisRole,
- exclude = "roleID,permissions",
- composeRelationships = false
- );
+ target = oRole,
+ memento = thisRole,
+ exclude = "roleID,permissions",
+ composeRelationships = false
+ );
// PERMISSIONS
if ( arrayLen( thisRole.permissions ) ) {
@@ -102,12 +107,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
var allPermissions = [];
for ( var thisPermission in thisRole.permissions ) {
var oPerm = variables.permissionService.findByPermission( thisPermission.permission );
- oPerm = (
- isNull( oPerm ) ? getBeanPopulator().populateFromStruct(
- target = variables.permissionService.new(),
- memento = thisPermission,
- exclude = "permissionID"
- ) : oPerm
+ oPerm = (
+ isNull( oPerm )
+ ? getBeanPopulator().populateFromStruct(
+ target = variables.permissionService.new(),
+ memento = thisPermission,
+ exclude = "permissionID"
+ )
+ : oPerm
);
// save oPerm if new only
if ( !oPerm.isLoaded() ) {
@@ -124,7 +131,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
if ( !oRole.isLoaded() ) {
arguments.importLog.append( "New role imported: #thisRole.role# " );
arrayAppend( allRoles, oRole );
- } else if ( oRole.isLoaded() and arguments.override ) {
+ } else if ( oRole.isLoaded() && arguments.override ) {
arguments.importLog.append( "Persisted role overriden: #thisRole.role# " );
arrayAppend( allRoles, oRole );
} else {
@@ -139,8 +146,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.importLog.append( "Saved all imported and overriden roles!" );
} else {
arguments.importLog.append(
- "No roles imported as none where found or able to be overriden from the import file."
- );
+ "No roles imported as none where found or able to be overriden from the import file."
+ );
}
}
// end transaction
@@ -148,4 +155,4 @@ component extends="cborm.models.VirtualEntityService" singleton {
return arguments.importLog.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/SecurityRule.cfc b/modules/contentbox/models/security/SecurityRule.cfc
index 50c8d2a76e..97401e7c7d 100644
--- a/modules/contentbox/models/security/SecurityRule.cfc
+++ b/modules/contentbox/models/security/SecurityRule.cfc
@@ -13,151 +13,149 @@ component
cachename ="cbSecurityRule"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="ruleID"
- column ="ruleID"
+ name="ruleID"
+ column="ruleID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="whitelist"
- column ="whitelist"
+ name="whitelist"
+ column="whitelist"
ormtype="string"
notnull="false"
default=""
- length ="255";
+ length="255";
property
- name ="securelist"
- column ="securelist"
+ name="securelist"
+ column="securelist"
ormtype="string"
notnull="true"
default=""
- length ="255";
+ length="255";
property
- name ="match"
- column ="match"
- ormtype ="string"
- notnull ="false"
- default ="event"
+ name="match"
+ column="match"
+ ormtype="string"
+ notnull="false"
+ default="event"
dbdefault="'event'"
- length ="50";
+ length="50";
property
- name ="roles"
- column ="roles"
+ name="roles"
+ column="roles"
ormtype="string"
notnull="false"
default=""
- length ="255";
+ length="255";
property
- name ="permissions"
- column ="permissions"
+ name="permissions"
+ column="permissions"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
property
- name ="redirect"
- column ="redirect"
+ name="redirect"
+ column="redirect"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
property
- name ="overrideEvent"
- column ="overrideEvent"
+ name="overrideEvent"
+ column="overrideEvent"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
property
- name ="useSSL"
- column ="useSSL"
+ name="useSSL"
+ column="useSSL"
ormtype="boolean"
notnull="false"
default="false";
property
- name ="action"
- column ="action"
- ormtype ="string"
- notnull ="false"
- default ="redirect"
+ name="action"
+ column="action"
+ ormtype="string"
+ notnull="false"
+ default="redirect"
dbdefault="'redirect'"
- length ="50";
+ length="50";
property
- name ="module"
- column ="module"
+ name="module"
+ column="module"
ormtype="string"
notnull="false"
default=""
- length ="500";
+ length="500";
property
- name ="httpMethods"
- column ="httpMethods"
- ormtype ="string"
- notnull ="true"
- default ="*"
+ name="httpMethods"
+ column="httpMethods"
+ ormtype="string"
+ notnull="true"
+ default="*"
dbdefault="'*'"
- length ="255";
+ length="255";
property
- name ="allowedIPs"
- column ="allowedIPs"
- ormtype ="string"
- notnull ="true"
- default ="*"
+ name="allowedIPs"
+ column="allowedIPs"
+ ormtype="string"
+ notnull="true"
+ default="*"
dbdefault="'*'"
- length ="255";
+ length="255";
property
- name ="order"
- column ="order"
+ name="order"
+ column="order"
ormtype="integer"
notnull="true"
default="0";
property
- name ="message"
- column ="message"
+ name="message"
+ column="message"
ormtype="string"
notnull="false"
default=""
- length ="255";
+ length="255";
property
- name ="messageType"
- column ="messageType"
- ormtype ="string"
- notnull ="false"
- default ="info"
+ name="messageType"
+ column="messageType"
+ ormtype="string"
+ notnull="false"
+ default="info"
dbdefault="'info'"
- length ="50";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ length="50";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "ruleID";
this.memento = {
- defaultIncludes : [
+ defaultIncludes: [
"action",
"allowedIps",
"httpMethods",
@@ -174,52 +172,52 @@ component
"useSSL",
"whitelist"
],
- defaultExcludes : [ "" ]
+ defaultExcludes: [ ""]
};
this.constraints = {
- "whitelist" : { required : false, size : "1..255" },
- "securelist" : { required : true, size : "1..255" },
- "match" : {
- required : false,
- size : "1..50",
- regex : "^(event|url)$"
+ "whitelist" : { required: false, size: "1..255" },
+ "securelist": { required: true, size: "1..255" },
+ "match" : {
+ required: false,
+ size : "1..50",
+ regex : "^(event|url)$"
},
- "roles" : { required : false, size : "1..255" },
- "permissions" : { required : false, size : "1..500" },
- "redirect" : { required : false, size : "1..500" },
- "overrideEvent" : { required : false, size : "1..500" },
- "useSSL" : { required : false, type : "boolean" },
- "action" : {
- required : false,
- size : "1..50",
- regex : "^(redirect|override)$"
+ "roles" : { required: false, size: "1..255" },
+ "permissions" : { required: false, size: "1..500" },
+ "redirect" : { required: false, size: "1..500" },
+ "overrideEvent": { required: false, size: "1..500" },
+ "useSSL" : { required: false, type: "boolean" },
+ "action" : {
+ required: false,
+ size : "1..50",
+ regex : "^(redirect|override)$"
},
- "module" : { required : false, size : "1..255" },
- "order" : { required : false, type : "numeric" },
- "message" : { required : false, size : "1..255" },
- "messageType" : { required : false, size : "1..50" }
+ "module" : { required: false, size: "1..255" },
+ "order" : { required: false, type: "numeric" },
+ "message" : { required: false, size: "1..255" },
+ "messageType": { required: false, size: "1..50" }
};
- /* *********************************************************************
- ** PUBLIC FUNCTIONS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC FUNCTIONS
+ **********************************************************************/
// Constructor
- function init(){
- variables.match = "event";
- variables.action = "redirect";
- variables.useSSL = false;
- variables.order = 0;
- variables.messageType = "info";
+ function init() {
+ variables.match = "event";
+ variables.action = "redirect";
+ variables.useSSL = false;
+ variables.order = 0;
+ variables.messageType = "info";
variables.overrideEvent = "";
- variables.module = "";
- variables.httpMethods = "*";
- variables.allowedIPs = "*";
+ variables.module = "";
+ variables.httpMethods = "*";
+ variables.allowedIPs = "*";
super.init();
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/SecurityRuleService.cfc b/modules/contentbox/models/security/SecurityRuleService.cfc
index d19a72d73c..ebeb305d3b 100755
--- a/modules/contentbox/models/security/SecurityRuleService.cfc
+++ b/modules/contentbox/models/security/SecurityRuleService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,15 +6,15 @@
* Security rules manager
*/
component extends="cborm.models.VirtualEntityService" singleton {
-
// DI
property name="populator" inject="wirebox:populator";
+
property name="dateUtil" inject="DateUtil@contentbox";
/**
* Constructor
*/
- SecurityRuleService function init(){
+ SecurityRuleService function init() {
// init it
super.init( entityName = "cbSecurityRule" );
@@ -24,8 +24,11 @@ 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 );
+ numeric function getMaxOrder() {
+ var q = executeQuery(
+ query = "select max( sr.order ) from cbSecurityRule as sr",
+ asQuery = false
+ );
if ( arrayIsDefined( q, 1 ) ) {
return q[ 1 ];
}
@@ -35,7 +38,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Get the next maximum used order
*/
- numeric function getNextMaxOrder(){
+ numeric function getNextMaxOrder() {
return getMaxOrder() + 1;
}
@@ -47,7 +50,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
boolean forceInsert = false,
boolean flush = false,
boolean transactional = getUseTransactions()
- ){
+ ) {
// determine new or not
if ( !arguments.entity.isLoaded() ) {
// new, so add next max order if not default
@@ -62,14 +65,14 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Get all rules in firing order
*/
- query function getSecurityRules(){
+ query function getSecurityRules() {
return list( sortOrder = "order asc", asQuery = true );
}
/**
* Reset rules to factory shipping standards, this will remove all rules also
*/
- any function resetRules(){
+ any function resetRules() {
transaction {
// Get rules path
var rulesPath = getDirectoryFromPath( getMetadata( this ).path ) & "data/securityRules.json";
@@ -83,7 +86,7 @@ component extends="cborm.models.VirtualEntityService" singleton {
if ( structKeyExists( thisRule, "ruleID" ) ) {
structDelete( thisRule, "ruleID" );
}
- var oRule = new ( properties = thisRule );
+ var oRule = new( properties = thisRule );
save( entity = oRule, transactional = false );
}
}
@@ -94,10 +97,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
/**
* Get all data prepared for export
*/
- array function getAllForExport(){
- return getAll().map( function( thisItem ){
- return thisItem.getMemento( profile: "export" );
- } );
+ array function getAllForExport() {
+ return getAll().map(
+ function( thisItem ) {
+ return thisItem.getMemento( profile = "export" );
+ }
+ );
}
/**
@@ -110,14 +115,17 @@ component extends="cborm.models.VirtualEntityService" singleton {
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -141,12 +149,12 @@ component extends="cborm.models.VirtualEntityService" singleton {
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allRules = [];
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
@@ -154,34 +162,38 @@ component extends="cborm.models.VirtualEntityService" singleton {
for ( var thisRule in arguments.importData ) {
// Get new or persisted with enough info to match
var oRule = this.findWhere(
- criteria = {
- match : thisRule.match,
- whitelist : thisRule.whitelist,
- securelist : thisRule.securelist,
- redirect : thisRule.redirect,
- roles : thisRule.roles,
- permissions : thisRule.permissions
- }
- );
- oRule = ( isNull( oRule ) ? new () : oRule );
+ criteria = {
+ match : thisRule.match,
+ whitelist : thisRule.whitelist,
+ securelist : thisRule.securelist,
+ redirect : thisRule.redirect,
+ roles : thisRule.roles,
+ permissions: thisRule.permissions
+ }
+ );
+ oRule = ( isNull( oRule ) ? new() : oRule );
// populate content from data
getBeanPopulator().populateFromStruct(
- target = oRule,
- memento = thisRule,
- exclude = "ruleID",
- composeRelationships = false
- );
+ target = oRule,
+ memento = thisRule,
+ exclude = "ruleID",
+ composeRelationships = false
+ );
// if new or persisted with override then save.
if ( !oRule.isLoaded() ) {
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()# " );
+ } else if ( oRule.isLoaded() && arguments.override ) {
+ 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
@@ -192,8 +204,8 @@ component extends="cborm.models.VirtualEntityService" singleton {
arguments.importLog.append( "Saved all imported and overriden security rules!" );
} else {
arguments.importLog.append(
- "No security rules imported as none where found or able to be overriden from the import file."
- );
+ "No security rules imported as none where found or able to be overriden from the import file."
+ );
}
}
// end transaction
@@ -201,4 +213,4 @@ component extends="cborm.models.VirtualEntityService" singleton {
return arguments.importLog.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/SecurityService.cfc b/modules/contentbox/models/security/SecurityService.cfc
index dbf3f625e0..f2870751d5 100755
--- a/modules/contentbox/models/security/SecurityService.cfc
+++ b/modules/contentbox/models/security/SecurityService.cfc
@@ -6,32 +6,42 @@
* Our contentbox security service must match our interface: ISecurityService
*/
component singleton {
-
// Dependencies
property name="authorService" inject="authorService@contentbox";
+
property name="settingService" inject="settingService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="cacheStorage" inject="cacheStorage@cbStorages";
+
property name="cookieStorage" inject="cookieStorage@cbStorages";
+
property name="requestStorage" inject="RequestStorage@cbstorages";
+
property name="mailService" inject="mailService@cbmailservices";
+
property name="renderer" inject="coldbox:renderer";
+
property name="CBHelper" inject="CBHelper@contentbox";
+
property name="log" inject="logbox:logger:{this}";
+
property name="cache" inject="cachebox:template";
+
property name="bCrypt" inject="BCrypt@BCrypt";
+
property name="cbCSRF" inject="@cbcsrf";
// Properties
property name="encryptionKey";
-
// Static key to identify an author in a request: more for api interaction than web.
variables.AUTHOR_KEY = "contentbox_author";
/**
* Constructor
*/
- SecurityService function init(){
+ SecurityService function init() {
variables.encryptionKey = "";
return this;
}
@@ -41,7 +51,7 @@ component singleton {
*
* @author The author object
*/
- Author function updateAuthorLoginTimestamp( required author ){
+ Author function updateAuthorLoginTimestamp( required author ) {
arguments.author.setLastLogin( now() );
variables.authorService.save( arguments.author );
return arguments.author;
@@ -50,7 +60,7 @@ component singleton {
/**
* Alias to getAuthorSession() created to satisfy JWT Services
*/
- function getUser(){
+ function getUser() {
return this.getAuthorSession();
}
@@ -64,7 +74,7 @@ component singleton {
*
* @return Logged in or new author object
*/
- Author function getAuthorSession(){
+ Author function getAuthorSession() {
// Check if valid author id in session or request respectively
var oAuthor = variables.requestStorage.get( variables.AUTHOR_KEY, variables.authorService.new() );
if ( oAuthor.isLoggedIn() ) {
@@ -81,7 +91,7 @@ component singleton {
// If we found an authorID, load it up and check it
if ( len( authorID ) ) {
// try to get it with that ID
- var author = variables.authorService.findWhere( { authorID : authorID, isActive : true, isDeleted : false } );
+ var author = variables.authorService.findWhere( { authorID: authorID, isActive: true, isDeleted: false } );
// If user found? Inflate them back
if ( !isNull( author ) ) {
return login( author );
@@ -95,7 +105,7 @@ component singleton {
/**
* Verifies if a user is logged in or not. Required for JWT Services
*/
- boolean function isLoggedIn(){
+ boolean function isLoggedIn() {
var oAuthor = this.getAuthorSession();
return oAuthor.isLoaded() && oAuthor.isLoggedIn();
}
@@ -105,7 +115,7 @@ component singleton {
*
* @author The author to log in
*/
- Author function login( required author ){
+ Author function login( required author ) {
// Mark as logged in
arguments.author.setLoggedIn( true );
// Store for the duration of the request, API mode
@@ -120,7 +130,7 @@ component singleton {
*
* @return SecurityService
*/
- SecurityService function logout(){
+ SecurityService function logout() {
variables.requestStorage.delete( variables.AUTHOR_KEY );
variables.cacheStorage.clearAll();
variables.cookieStorage.delete( "contentbox_keep_logged_in" );
@@ -149,32 +159,38 @@ component singleton {
required username,
required password,
boolean logThemIn = false
- ){
+ ) {
// Find them
try {
var oAuthor = variables.authorService.retrieveUserByUsername( arguments.username );
- } catch ( EntityNotFound e ) {
+ } catch (EntityNotFound e) {
variables.log.warn(
- "Invalid username authentication from #getRealIP()# for username: #arguments.username#",
- getHTTPRequestData( false )
+ "Invalid username authentication from #getRealIP()# for username: #arguments.username#",
+ getHTTPRequestData( false )
+ );
+ throw(
+ type = "InvalidCredentials",
+ message = "Incorrect Credentials Entered"
);
- throw( type = "InvalidCredentials", message = "Incorrect Credentials Entered" );
}
// Validate password using bcrypt
try {
var isSamePassword = variables.bcrypt.checkPassword( arguments.password, oAuthor.getPassword() );
- } catch ( any e ) {
+ } catch (any e) {
var isSamePassword = false;
}
// Verify Password
if ( !isSamePassword ) {
variables.log.warn(
- "Invalid password authentication from #getRealIP()# for username: #arguments.username#",
- getHTTPRequestData( false )
+ "Invalid password authentication from #getRealIP()# for username: #arguments.username#",
+ getHTTPRequestData( false )
+ );
+ throw(
+ type = "InvalidCredentials",
+ message = "Incorrect Credentials Entered"
);
- throw( type = "InvalidCredentials", message = "Incorrect Credentials Entered" );
}
// Set last login date
@@ -193,7 +209,7 @@ component singleton {
*
* @string The string to bcrypt
*/
- string function encryptString( required string ){
+ string function encryptString( required string ) {
return variables.bCrypt.hashPassword( arguments.string );
}
@@ -202,16 +218,18 @@ component singleton {
*
* @author The author to create the reset token for.
*/
- string function generateResetToken( required Author author ){
+ string function generateResetToken( required Author author ) {
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() );
- cache.set(
- "reset-token-#token#",
- arguments.author.getAuthorID(),
- tokenTimeout,
- tokenTimeout
+ var token = hash(
+ arguments.author.getEmail() & arguments.author.getAuthorID() & now()
);
+ cache.set(
+ "reset-token-#token#",
+ arguments.author.getAuthorID(),
+ tokenTimeout,
+ tokenTimeout
+ );
return token;
}
@@ -229,45 +247,46 @@ component singleton {
required Author author,
boolean adminIssued = false,
Author issuer
- ){
+ ) {
// Generate security token
var token = generateResetToken( arguments.author );
// get settings
- var settings = variables.settingService.getAllSettings();
+ var settings = variables.settingService.getAllSettings();
var defaultSite = variables.siteService.getDefaultSite();
// get mail payload
var bodyTokens = {
- name : arguments.author.getFullName(),
- 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#",
- issuedBy : "",
- issuedEmail : ""
+ name : arguments.author.getFullName(),
+ 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#",
+ issuedBy : "",
+ issuedEmail: ""
};
// Check if an issuer was passed
if ( !isNull( arguments.issuer ) ) {
- bodyTokens.issuedBy = arguments.issuer.getFullName();
+ bodyTokens.issuedBy = arguments.issuer.getFullName();
bodyTokens.issuedEmail = arguments.issuer.getEmail();
}
// Build email out
var mail = variables.mailservice.newMail(
- to = arguments.author.getEmail(),
- from = settings.cb_site_outgoingEmail,
- subject = "#defaultSite.getName()# Password Reset Verification",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = arguments.author.getEmail(),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#defaultSite.getName()# Password Reset Verification",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// Decide template depending if issued by user or admin
var emailTemplate = "password_verification";
@@ -276,11 +295,11 @@ component singleton {
}
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/#emailTemplate#",
- layout = "/contentbox/email_templates/layouts/email"
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/#emailTemplate#",
+ layout = "/contentbox/email_templates/layouts/email"
+ )
+ );
// send it out
return mailService.send( mail ).getResults();
@@ -294,8 +313,8 @@ component singleton {
*
* @return {error, author}
*/
- struct function validateResetToken( required token ){
- var results = { "error" : false, "author" : "" };
+ struct function validateResetToken( required token ) {
+ var results = { "error": false, "author": "" };
var cacheKey = "reset-token-#arguments.token#";
var authorID = cache.get( cacheKey );
@@ -303,14 +322,14 @@ component singleton {
if ( isNull( authorID ) ) {
results.error = true;
return results;
- };
+ }
// Verify the author of the token
results.author = variables.authorService.get( authorID );
if ( isNull( results.author ) ) {
results.error = true;
return results;
- };
+ }
return results;
}
@@ -328,30 +347,30 @@ component singleton {
required token,
required Author author,
required password
- ){
- var results = { "error" : false, "messages" : "" };
+ ) {
+ var results = { "error": false, "messages": "" };
var cacheKey = "reset-token-#arguments.token#";
var authorID = cache.get( cacheKey );
// If token not found, don't reset and return back
if ( isNull( authorID ) ) {
- results.error = true;
+ results.error = true;
results.messages = "Token does not exist or has expired";
return results;
- };
+ }
// Verify the author of the token
- if ( arguments.author.getAuthorID() neq authorID ) {
- results.error = true;
+ if ( arguments.author.getAuthorID() NEQ authorID ) {
+ results.error = true;
results.messages = "Author reset token mismatch";
return results;
- };
+ }
// Remove token now that we have the data and it has been validated
cache.clear( cacheKey );
// get settings
- var settings = settingService.getAllSettings();
+ var settings = settingService.getAllSettings();
var defaultSite = variables.siteService.getDefaultSite();
// set it in the user and save reset password
@@ -361,32 +380,32 @@ component singleton {
// get mail payload
var bodyTokens = {
- name : arguments.author.getFullName(),
- ip : getRealIP(),
- linkLogin : CBHelper.linkAdminLogin( ssl = settings.cb_admin_ssl ),
- siteName : defaultSite.getName(),
- adminEmail : settings.cb_site_email
+ name : arguments.author.getFullName(),
+ ip : getRealIP(),
+ linkLogin : CBHelper.linkAdminLogin( ssl = settings.cb_admin_ssl ),
+ siteName : defaultSite.getName(),
+ adminEmail: settings.cb_site_email
};
var mail = mailservice.newMail(
- to = arguments.author.getEmail(),
- from = settings.cb_site_outgoingEmail,
- subject = "#defaultSite.getName()# Password Reset Completed",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = arguments.author.getEmail(),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#defaultSite.getName()# Password Reset Completed",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// ,body=renderer.$get().externalView(view="/contentbox/email_templates/password_reminder" )
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/password_reset",
- layout = "/contentbox/email_templates/layouts/email"
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/password_reset",
+ layout = "/contentbox/email_templates/layouts/email"
+ )
+ );
// send it out
mailService.send( mail );
@@ -399,14 +418,14 @@ component singleton {
* @content The content object
* @password The password to check
*/
- boolean function authorizeContent( required content, required password ){
+ boolean function authorizeContent( required content, required password ) {
// Validate Password
- if ( compare( arguments.content.getPasswordProtection(), arguments.password ) eq 0 ) {
+ if ( compare( arguments.content.getPasswordProtection(), arguments.password ) EQ 0 ) {
// Set simple validation
cacheStorage.set(
- "protection-#hash( arguments.content.getSlug() )#",
- getContentProtectedHash( arguments.content )
- );
+ "protection-#hash( arguments.content.getSlug() )#",
+ getContentProtectedHash( arguments.content )
+ );
return true;
}
@@ -418,52 +437,54 @@ component singleton {
*
* @content The content object to check
*/
- boolean function isContentViewable( required content ){
+ boolean function isContentViewable( required content ) {
var protectedHash = cacheStorage.get( "protection-#hash( arguments.content.getSlug() )#", "" );
// check hash against validated content
- if ( compare( protectedHash, getContentProtectedHash( arguments.content ) ) EQ 0 ) {
+ if (
+ compare(
+ protectedHash,
+ getContentProtectedHash( arguments.content )
+ ) EQ
+ 0
+ ) {
return true;
}
return false;
}
- /**
- * 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" );
- }
-
/**
* Get remember me cookie
*/
- any function getRememberMe(){
+ any function getRememberMe() {
var cookieValue = cookieStorage.get( "contentbox_remember_me", "" );
try {
return decryptIt( cookieValue );
- } catch ( Any e ) {
+ } catch (Any e) {
// Errors on decryption
- log.error( "Error decrypting remember me key: #e.message# #e.detail#", cookieValue );
+ log.error(
+ "Error decrypting remember me key: #e.message# #e.detail#",
+ cookieValue
+ );
cookieStorage.delete( "contentbox_remember_me" );
return "";
}
}
-
/**
* Get keep me logged in cookie
*/
- any function getKeepMeLoggedIn(){
+ any function getKeepMeLoggedIn() {
var cookieValue = cookieStorage.get( "contentbox_keep_logged_in", "" );
try {
return decryptIt( cookieValue );
- } catch ( Any e ) {
+ } 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 "";
}
@@ -475,7 +496,7 @@ component singleton {
* @username The username to store
* @days The days to store
*/
- SecurityService function setRememberMe( required username, required numeric days = 0 ){
+ 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.
if ( !arguments.days ) {
variables.cookieStorage.delete( "contentbox_remember_me" );
@@ -485,24 +506,26 @@ component singleton {
// Save the username to pre-populate the login field after their login expires for up to a year.
variables.cookieStorage.set(
- name = "contentbox_remember_me",
- value = encryptIt( arguments.username ),
- expires = 365
- );
+ name = "contentbox_remember_me",
+ value = encryptIt( arguments.username ),
+ expires = 365
+ );
// Look up the user ID and store for the duration specified
- var author = variables.authorService.findWhere( {
- username : arguments.username,
- isActive : true,
- isDeleted : false
- } );
+ var author = variables.authorService.findWhere(
+ {
+ username : arguments.username,
+ isActive : true,
+ isDeleted: false
+ }
+ );
if ( !isNull( author ) ) {
// The user will be auto-logged in as long as this cookie exists
variables.cookieStorage.set(
- name = "contentbox_keep_logged_in",
- value = encryptIt( author.getAuthorID() ),
- expires = arguments.days
- );
+ name = "contentbox_keep_logged_in",
+ value = encryptIt( author.getAuthorID() ),
+ expires = arguments.days
+ );
}
return this;
@@ -513,7 +536,7 @@ component singleton {
*
* @encValue value to encrypt
*/
- string function encryptIt( required encValue ){
+ string function encryptIt( required encValue ) {
// if empty just return it
if ( !len( arguments.encValue ) ) {
return arguments.encValue;
@@ -531,7 +554,7 @@ component singleton {
*
* @decValue value to decrypt
*/
- string function decryptIt( required decValue ){
+ string function decryptIt( required decValue ) {
if ( !len( arguments.decValue ) ) {
return arguments.decValue;
}
@@ -547,21 +570,23 @@ component singleton {
* Verifies we have a salt in our installation
* if not, it will generate a new cb_enc_key
*/
- string function getEncryptionKey(){
+ string function getEncryptionKey() {
// Is the encryption key loaded?
if ( len( variables.encryptionKey ) ) {
return variables.encryptionKey;
}
// Verify we have one in the installation, else generate one
- var oSetting = settingService.findWhere( { name : "cb_enc_key" } );
+ var oSetting = settingService.findWhere( { name: "cb_enc_key" } );
// if no key, then create it for this ContentBox installation
if ( isNull( oSetting ) ) {
- oSetting = settingService.new( {
- name : "cb_enc_key",
- value : generateSecretKey( "BLOWFISH" )
- } );
+ oSetting = settingService.new(
+ {
+ name : "cb_enc_key",
+ value: generateSecretKey( "BLOWFISH" )
+ }
+ );
settingService.save( entity = oSetting );
log.info( "Registered new cookie encryption key" );
}
@@ -576,7 +601,7 @@ component singleton {
/**
* Get Real IP, by looking at clustered, proxy headers and locally.
*/
- function getRealIP(){
+ function getRealIP() {
var headers = getHTTPRequestData( false ).headers;
// When going through a proxy, the IP can be a delimtied list, thus we take the last one in the list
@@ -591,4 +616,16 @@ component singleton {
return len( cgi.remote_addr ) ? trim( listFirst( cgi.remote_addr ) ) : "127.0.0.1";
}
-}
+ /**
+ * 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"
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/SecurityValidator.cfc b/modules/contentbox/models/security/SecurityValidator.cfc
index 98a8cd0070..5a1782cb96 100644
--- a/modules/contentbox/models/security/SecurityValidator.cfc
+++ b/modules/contentbox/models/security/SecurityValidator.cfc
@@ -6,12 +6,7 @@
* This is our security validator that works with CBSecurity in order to validate
* rules and annotations.
*/
-component
- singleton
- threadsafe
- extends="cbsecurity.models.validators.AuthValidator"
-{
-
+component singleton threadsafe extends="cbsecurity.models.validators.AuthValidator" {
// Dependencies
property name="securityService" inject="securityService@contentbox";
@@ -27,11 +22,11 @@ component
*
* @return { allow:boolean, type:string(authentication|authorization), messages:string }
*/
- struct function ruleValidator( required rule, required controller ){
+ struct function ruleValidator( required rule, required controller ) {
return validateSecurity(
- rule : arguments.rule,
- securedValue: arguments.rule.permissions,
- controller : arguments.controller
+ rule = arguments.rule,
+ securedValue = arguments.rule.permissions,
+ controller = arguments.controller
);
}
@@ -46,8 +41,8 @@ component
*
* @return { allow:boolean, type:string(authentication|authorization), messages:string }
*/
- struct function annotationValidator( required securedValue, required controller ){
- return validateSecurity( securedValue: arguments.securedValue, controller: arguments.controller );
+ struct function annotationValidator( required securedValue, required controller ) {
+ return validateSecurity( securedValue = arguments.securedValue, controller = arguments.controller );
}
/**
@@ -59,7 +54,7 @@ component
*
* @return Validation struct of: { allow:boolean, type:(authentication|authorization), messages }
*/
- struct function validateSecurity( struct rule, securedValue = "", any controller ){
+ struct function validateSecurity( struct rule, securedValue = "", any controller ) {
var results = super.validateSecurity( arguments.securedValue );
// If we are allowing, then continue to test the ContentBox roles
@@ -70,9 +65,12 @@ component
// Check if the rule requires roles
if ( !isNull( arguments.rule ) && len( arguments.rule.roles ) ) {
results.allow = false;
- results.type = "authorization";
- for ( var thisRole in arguments.rule.roles.listToArray() ) {
- if ( oAuthor.getRoleName() eq thisRole ) {
+ results.type = "authorization";
+ for ( var thisRole in arguments
+ .rule
+ .roles
+ .listToArray() ) {
+ if ( oAuthor.getRoleName() EQ thisRole ) {
results.allow = true;
break;
}
@@ -82,21 +80,22 @@ component
// If the rule has a message, then set a messagebox
if (
- !results.allow &&
- !isNull( arguments.rule ) &&
- !isNull( arguments.rule.message ) &&
- len( arguments.rule.message )
+ !results.allow && !isNull( arguments.rule ) && !isNull( arguments.rule.message ) &&
+ len( arguments.rule.message )
) {
- arguments.controller
+ arguments
+ .controller
.getWireBox()
.getInstance( "messagebox@cbmessagebox" )
.setMessage(
- type : ( structKeyExists( rule, "messageType" ) && len( rule.messageType ) ? rule.messageType : "info" ),
- message: rule.message
+ type = (
+ structKeyExists( rule, "messageType" ) && len( rule.messageType ) ? rule.messageType : "info"
+ ),
+ message = rule.message
);
}
return results;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/twofactor/BaseTwoFactorProvider.cfc b/modules/contentbox/models/security/twofactor/BaseTwoFactorProvider.cfc
index 62d31f4ba0..e7bb3f3d94 100644
--- a/modules/contentbox/models/security/twofactor/BaseTwoFactorProvider.cfc
+++ b/modules/contentbox/models/security/twofactor/BaseTwoFactorProvider.cfc
@@ -13,26 +13,30 @@
* - CBHelper
*/
component {
-
// DI
property name="log" inject="logbox:logger:{this}";
+
property name="settingService" inject="settingService@contentbox";
+
property name="securityService" inject="securityService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="renderer" inject="coldbox:renderer";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
/**
* Constructor
*/
- function init(){
+ function init() {
return this;
}
/**
* Get all system settings
*/
- struct function getAllSettings(){
+ struct function getAllSettings() {
return variables.settingService.getAllSettings();
}
@@ -41,7 +45,7 @@ component {
*
* @return Site
*/
- function getDefaultSite(){
+ function getDefaultSite() {
return variables.siteService.getDefaultSite();
}
@@ -50,8 +54,8 @@ component {
*
* @return Site
*/
- function discoverSite(){
+ function discoverSite() {
return variables.siteService.discoverSite();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc b/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc
index 84457a057c..6225dbaa14 100644
--- a/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc
+++ b/modules/contentbox/models/security/twofactor/ITwoFactorProvider.cfc
@@ -67,5 +67,4 @@ interface {
* @author The author to verify challenge
*/
function finalize( required string code, required author );
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/security/twofactor/TwoFactorService.cfc b/modules/contentbox/models/security/twofactor/TwoFactorService.cfc
index 9e68425d9c..0ce150083d 100644
--- a/modules/contentbox/models/security/twofactor/TwoFactorService.cfc
+++ b/modules/contentbox/models/security/twofactor/TwoFactorService.cfc
@@ -6,19 +6,21 @@
* Manages Two Factor Authenticators
*/
component accessors="true" threadSafe singleton {
-
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="securityService" inject="securityService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
+
property name="cookieStorage" inject="cookieStorage@cbStorages";
+
property name="log" inject="logbox:logger:{this}";
/**
* Providers registry
*/
property name="providers" type="struct";
-
// Static Properties
variables.TRUSTED_DEVICE_COOKIE = "contentbox_2factor_device";
@@ -28,7 +30,7 @@ component accessors="true" threadSafe singleton {
*
* @wirebox.inject wirebox
*/
- TwoFactorService function init( required wirebox ){
+ TwoFactorService function init( required wirebox ) {
// init providers
variables.providers = {};
@@ -41,7 +43,7 @@ component accessors="true" threadSafe singleton {
/**
* Are we forcing global two factor authentication
*/
- boolean function isForceTwoFactorAuth(){
+ boolean function isForceTwoFactorAuth() {
// Doing !! to force a boolean
return !!settingService.getSetting( "cb_security_2factorAuth_force" );
}
@@ -49,21 +51,21 @@ component accessors="true" threadSafe singleton {
/**
* Get the default system provider name
*/
- string function getDefaultProvider(){
+ string function getDefaultProvider() {
return settingService.getSetting( "cb_security_2factorAuth_provider" );
}
/**
* Get the default system provider object
*/
- contentbox.models.security.twofactor.ITwoFactorProvider function getDefaultProviderObject(){
+ contentbox.models.security.twofactor.ITwoFactorProvider function getDefaultProviderObject() {
return getProvider( getDefaultProvider() );
}
/**
* Get the default system trusted device timespan
*/
- numeric function getTrustedDeviceTimespan(){
+ numeric function getTrustedDeviceTimespan() {
return settingService.getSetting( "cb_security_2factorAuth_trusted_days" );
}
@@ -74,7 +76,7 @@ component accessors="true" threadSafe singleton {
*/
TwoFactorService function registerProvider(
required contentbox.models.security.twofactor.ITwoFactorProvider provider
- ){
+ ) {
variables.providers[ arguments.provider.getName() ] = arguments.provider;
return this;
}
@@ -84,7 +86,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the provider to unregister
*/
- TwoFactorService function unRegisterProvider( required name ){
+ TwoFactorService function unRegisterProvider( required name ) {
structDelete( variables.providers, arguments.name );
return this;
}
@@ -92,22 +94,24 @@ component accessors="true" threadSafe singleton {
/**
* Get an array of registered provider names in alphabetical order
*/
- array function getRegisteredProviders(){
- return listToArray( listSort( structKeyList( variables.providers ), "textnocase" ) );
+ array function getRegisteredProviders() {
+ return listToArray(
+ listSort( structKeyList( variables.providers ), "textnocase" )
+ );
}
/**
* Get an array of registered provider names in alphabetical order with their display names
*/
- array function getRegisteredProvidersMap(){
+ array function getRegisteredProvidersMap() {
var aProviders = getRegisteredProviders();
- var result = [];
+ var result = [];
for ( var thisProvider in aProviders ) {
arrayAppend(
result,
{
- name : thisProvider,
- displayName : variables.providers[ thisProvider ].getDisplayName()
+ name : thisProvider,
+ displayName: variables.providers[ thisProvider ].getDisplayName()
}
);
}
@@ -119,7 +123,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the provider
*/
- contentbox.models.security.twofactor.ITwoFactorProvider function getProvider( required name ){
+ contentbox.models.security.twofactor.ITwoFactorProvider function getProvider( required name ) {
return variables.providers[ arguments.name ];
}
@@ -128,7 +132,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the provider
*/
- boolean function hasProvider( required name ){
+ boolean function hasProvider( required name ) {
return structKeyExists( variables.providers, arguments.name );
}
@@ -137,12 +141,12 @@ component accessors="true" threadSafe singleton {
*
* @trustedID The trusted ID to track in the tracking cookie
*/
- TwoFactorService function setTrustedDevice( required trustedID ){
+ TwoFactorService function setTrustedDevice( required trustedID ) {
cookieStorage.set(
- name = variables.TRUSTED_DEVICE_COOKIE,
- value = securityService.encryptIt( arguments.trustedID ),
- expires = getTrustedDeviceTimespan()
- );
+ name = variables.TRUSTED_DEVICE_COOKIE,
+ value = securityService.encryptIt( arguments.trustedID ),
+ expires = getTrustedDeviceTimespan()
+ );
return this;
}
@@ -151,21 +155,24 @@ component accessors="true" threadSafe singleton {
*
* @trustedID The trusted ID to verify
*/
- boolean function isTrustedDevice( required trustedID ){
+ boolean function isTrustedDevice( required trustedID ) {
var cookieValue = cookieStorage.get( name = variables.TRUSTED_DEVICE_COOKIE, defaultValue = "" );
try {
// decrypt the target id
var targetTrustedID = securityService.decryptIt( cookieValue );
// Verify they are the same
- if ( targetTrustedID neq arguments.trustedID ) {
+ if ( targetTrustedID NEQ arguments.trustedID ) {
cookieStorage.delete( variables.TRUSTED_DEVICE_COOKIE );
return false;
}
return true;
- } catch ( Any e ) {
+ } catch (Any e) {
// Errors on decryption
- log.error( "Error decrypting trusted id cookie: #e.message# #e.detail#", cookieValue );
+ log.error(
+ "Error decrypting trusted id cookie: #e.message# #e.detail#",
+ cookieValue
+ );
cookieStorage.delete( variables.TRUSTED_DEVICE_COOKIE );
return false;
}
@@ -176,18 +183,16 @@ component accessors="true" threadSafe singleton {
*
* @author The author to challenge or not
*/
- boolean function canChallenge( required author ){
+ boolean function canChallenge( required author ) {
var oProvider = getProvider( getDefaultProvider() );
- var results = false;
+ var results = false;
if (
- // Verify if global force is enabled
- isForceTwoFactorAuth()
- OR
- // Verify if user has two factor auth enabled
- arguments.author.getIs2FactorAuth()
+ isForceTwoFactorAuth() ||
+ arguments.author// Verify if user has two factor auth enabled
+ .getIs2FactorAuth()
) {
// Verify if using trusted device options and if device is trusted
- if ( oProvider.allowTrustedDevice() AND isTrustedDevice( arguments.author.getAuthorID() ) ) {
+ if ( oProvider.allowTrustedDevice() && isTrustedDevice( arguments.author.getAuthorID() ) ) {
results = false;
} else {
results = true;
@@ -206,7 +211,7 @@ component accessors="true" threadSafe singleton {
*
* @return struct:{ error:boolean, messages:string }
*/
- struct function sendChallenge( required author ){
+ struct function sendChallenge( required author ) {
return getProvider( getDefaultProvider() ).sendChallenge( arguments.author );
}
@@ -219,8 +224,8 @@ component accessors="true" threadSafe singleton {
*
* @return struct:{ error:boolean, messages:string }
*/
- struct function verifyChallenge( required string code, required author ){
+ struct function verifyChallenge( required string code, required author ) {
return getProvider( getDefaultProvider() ).verifyChallenge( arguments.code, arguments.author );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/BaseSubscription.cfc b/modules/contentbox/models/subscriptions/BaseSubscription.cfc
index 0b58cfa28e..0384c7854f 100644
--- a/modules/contentbox/models/subscriptions/BaseSubscription.cfc
+++ b/modules/contentbox/models/subscriptions/BaseSubscription.cfc
@@ -13,105 +13,95 @@ component
cachename ="cbSubscription"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES again due to ACF Bug
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES again due to ACF Bug
+ **********************************************************************/
property
- name ="createdDate"
- column ="createdDate"
- type ="date"
+ name="createdDate"
+ column="createdDate"
+ type="date"
ormtype="timestamp"
notnull="true"
- update ="false";
+ update="false";
property
- name ="modifiedDate"
- column ="modifiedDate"
- type ="date"
+ name="modifiedDate"
+ column="modifiedDate"
+ type="date"
ormtype="timestamp"
notnull="true";
property
- name ="isDeleted"
- column ="isDeleted"
+ name="isDeleted"
+ column="isDeleted"
ormtype="boolean"
notnull="true"
default="false";
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="subscriptionID"
- column ="subscriptionID"
+ name="subscriptionID"
+ column="subscriptionID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
/**
* This token identifies subscribers (emails) to appropriate subscriptions
*/
property
- name ="subscriptionToken"
- column ="subscriptionToken"
+ name="subscriptionToken"
+ column="subscriptionToken"
ormtype="string"
- length ="255"
+ length="255"
notnull="true";
/**
* The type of subscriptions. Available subscriptions are : comment
*/
- property
- name ="type"
- column ="type"
- ormtype="string"
- notnull="true";
+ property name="type" column="type" ormtype="string" notnull="true";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> Content loaded as a proxy
property
- name ="subscriber"
- notnull ="true"
- cfc ="contentbox.models.subscriptions.Subscriber"
+ name="subscriber"
+ notnull="true"
+ cfc="contentbox.models.subscriptions.Subscriber"
fieldtype="many-to-one"
- fkcolumn ="FK_subscriberID"
- lazy ="true"
- inverse ="true"
- orderBy ="subscriberEmail";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fkcolumn="FK_subscriberID"
+ lazy="true"
+ inverse="true"
+ orderBy="subscriberEmail";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "subscriptionID";
this.memento = {
- defaultIncludes : [
- "subscriptionToken",
- "type",
- "subscriberSnapshot:subscriber"
- ],
- defaultExcludes : []
+ defaultIncludes: [ "subscriptionToken", "type", "subscriberSnapshot:subscriber"],
+ defaultExcludes: []
};
this.constraints = {
- "subscriptionToken" : { required : true, size : "1..255" },
- "type" : { required : true, size : "1..255", regex : "^(comment)$" }
+ "subscriptionToken": { required: true, size: "1..255" },
+ "type" : { required: true, size: "1..255", regex: "^(comment)$" }
};
- /* *********************************************************************
- ** METHODS
- ********************************************************************* */
+ /**********************************************************************
+ * ** METHODS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
return this;
}
@@ -119,11 +109,11 @@ component
/**
* Build a snapshot of the subscriber
*/
- struct function getSubscriberSnapshot(){
+ struct function getSubscriberSnapshot() {
if ( hasSubscriber() ) {
return getSubscriber().getInfoSnapshot();
}
return {};
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/CommentSubscription.cfc b/modules/contentbox/models/subscriptions/CommentSubscription.cfc
index 0a49b185de..360c6eab22 100644
--- a/modules/contentbox/models/subscriptions/CommentSubscription.cfc
+++ b/modules/contentbox/models/subscriptions/CommentSubscription.cfc
@@ -14,44 +14,46 @@ component
cachename ="cbCommentSubscription"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** DI
- ********************************************************************* */
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
property
- name ="commentSubscriptionService"
- inject ="provider:commentSubscriptionService@contentbox"
+ name="commentSubscriptionService"
+ inject="provider:commentSubscriptionService@contentbox"
persistent="false";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> Content loaded as a proxy
property
- name ="relatedContent"
- notnull ="true"
- cfc ="contentbox.models.content.BaseContent"
+ name="relatedContent"
+ notnull="true"
+ cfc="contentbox.models.content.BaseContent"
fieldtype="many-to-one"
- fkcolumn ="FK_contentID"
- lazy ="true"
- orderBy ="Title ASC";
+ fkcolumn="FK_contentID"
+ lazy="true"
+ orderBy="Title ASC";
- /* *********************************************************************
- ** METHODS
- ********************************************************************* */
+ /**********************************************************************
+ * ** METHODS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
- appendToMemento( [ "relatedContentSnapshot:relatedContent" ], "defaultIncludes" );
+ appendToMemento(
+ [ "relatedContentSnapshot:relatedContent"],
+ "defaultIncludes"
+ );
return this;
}
/**
* Build a snapshot of the related content
*/
- struct function getRelatedContentSnapshot(){
+ struct function getRelatedContentSnapshot() {
if ( hasRelatedContent() ) {
return getRelatedContent().getInfoSnapshot();
}
@@ -61,7 +63,7 @@ component
/**
* Before insertion verify if we have a token, else generate one.
*/
- public void function preInsert(){
+ public void function preInsert() {
super.preInsert();
if ( isNull( getSubscriptionToken() ) ) {
@@ -70,12 +72,14 @@ component
}
}
- public boolean function isExtantSubscription(){
- var extantSubscription = variables.commentSubscriptionService.findWhere( {
- relatedContent : getRelatedContent(),
- subscriber : getSubscriber()
- } );
+ public boolean function isExtantSubscription() {
+ var extantSubscription = variables.commentSubscriptionService.findWhere(
+ {
+ relatedContent: getRelatedContent(),
+ subscriber : getSubscriber()
+ }
+ );
return isNull( extantSubscription ) ? false : true;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/CommentSubscriptionService.cfc b/modules/contentbox/models/subscriptions/CommentSubscriptionService.cfc
index 8f8f98ff0f..c7544c64e2 100644
--- a/modules/contentbox/models/subscriptions/CommentSubscriptionService.cfc
+++ b/modules/contentbox/models/subscriptions/CommentSubscriptionService.cfc
@@ -7,8 +7,11 @@
*/
component extends="SubscriptionService" singleton {
- function init(){
- super.init( entityName = "cbCommentSubscription", useQueryCaching = true );
+ function init() {
+ super.init(
+ entityName = "cbCommentSubscription",
+ useQueryCaching = true
+ );
return this;
}
@@ -19,20 +22,23 @@ component extends="SubscriptionService" singleton {
*
* @return Array of properties: title, relatedContent, subscriberCount or label, value
*/
- array function getGroupedSubscriptions( required numeric max = 0 ){
+ array function getGroupedSubscriptions( required numeric max = 0 ) {
if ( !arguments.max ) {
- var sortOrder = "title ASC";
+ var sortOrder = "title ASC";
var groupProperty = "content.title:title,relatedContent";
- var countAlias = "subscriberCount";
+ var countAlias = "subscriberCount";
} else {
- var sortOrder = "value DESC";
+ var sortOrder = "value DESC";
var groupProperty = "content.title:label";
- var countAlias = "value";
+ var countAlias = "value";
}
return newCriteria()
.joinTo( "relatedContent", "content" )
- .withProjections( groupProperty = groupProperty, count = "subscriber:#countAlias#" )
+ .withProjections(
+ groupProperty = groupProperty,
+ count = "subscriber:#countAlias#"
+ )
.asStruct()
.list( sortOrder = sortOrder, max = arguments.max );
}
@@ -40,8 +46,8 @@ component extends="SubscriptionService" singleton {
/**
* Get the count of total comment subscriptions
*/
- public numeric function getGroupedSubscriptionCount(){
+ public numeric function getGroupedSubscriptionCount() {
return newCriteria().count();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/Subscriber.cfc b/modules/contentbox/models/subscriptions/Subscriber.cfc
index 13cb4623cd..44e580e209 100644
--- a/modules/contentbox/models/subscriptions/Subscriber.cfc
+++ b/modules/contentbox/models/subscriptions/Subscriber.cfc
@@ -13,76 +13,70 @@ component
cachename ="cbSubscriber"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="subscriberID"
- column ="subscriberID"
+ name="subscriberID"
+ column="subscriberID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
property
- name ="subscriberEmail"
- column ="subscriberEmail"
+ name="subscriberEmail"
+ column="subscriberEmail"
notnull="true"
- length ="255"
- index ="idx_subscriberEmail";
+ length="255"
+ index="idx_subscriberEmail";
property
- name ="subscriberToken"
- column ="subscriberToken"
+ name="subscriberToken"
+ column="subscriberToken"
ormtype="string"
- length ="255"
+ length="255"
notnull="true";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
property
- name ="subscriptions"
+ name="subscriptions"
singularName="subscription"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- batchsize ="25"
- orderby ="createdDate"
- cfc ="contentbox.models.subscriptions.BaseSubscription"
- fkcolumn ="FK_subscriberID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS
- ********************************************************************* */
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ batchsize="25"
+ orderby="createdDate"
+ cfc="contentbox.models.subscriptions.BaseSubscription"
+ fkcolumn="FK_subscriberID"
+ inverse="true"
+ cascade="all-delete-orphan";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS
+ **********************************************************************/
this.pk = "subscriberID";
this.memento = {
- defaultIncludes : [
- "subscriberEmail",
- "subscriptionToken",
- "subscriptionsSnapshot:subscriptions"
- ],
- defaultExcludes : []
+ defaultIncludes: [ "subscriberEmail", "subscriptionToken", "subscriptionsSnapshot:subscriptions"],
+ defaultExcludes: []
};
this.constraints = {
- "subscriptionToken" : { required : true, size : "1..255" },
- "subscriberEmail" : { required : true, size : "1..255", type : "email" }
+ "subscriptionToken": { required: true, size: "1..255" },
+ "subscriberEmail" : { required: true, size: "1..255", type: "email" }
};
- /* *********************************************************************
- ** METHODS
- ********************************************************************* */
+ /**********************************************************************
+ * ** METHODS
+ **********************************************************************/
- function init(){
+ function init() {
super.init();
return this;
}
@@ -90,12 +84,12 @@ component
/**
* Utility method to get a snapshot of this object
*/
- struct function getInfoSnapshot(){
+ struct function getInfoSnapshot() {
if ( isLoaded() ) {
return {
- "subscriberID" : getSubscriberID(),
- "subscriberEmail" : getSubscriberEmail(),
- "subscriberToken" : getSubscriberToken()
+ "subscriberID" : getSubscriberID(),
+ "subscriberEmail": getSubscriberEmail(),
+ "subscriberToken": getSubscriberToken()
};
}
return {};
@@ -104,11 +98,13 @@ component
/**
* Build a snapshot of subscriptions this subscriber has
*/
- array function getSubscriptionsSnapshot(){
+ array function getSubscriptionsSnapshot() {
if ( hasSubscriptions() ) {
- return getSubscriptions().map( function( thisItem ){
- return arguments.thisItem.getMemento( excludes = "subscriber" );
- } );
+ return getSubscriptions().map(
+ function( thisItem ) {
+ return arguments.thisItem.getMemento( excludes = "subscriber" );
+ }
+ );
}
return {};
}
@@ -116,7 +112,7 @@ component
/**
* Before insert create the user subscription token
*/
- public void function preInsert(){
+ public void function preInsert() {
super.preInsert();
if ( isNull( getSubscriberToken() ) ) {
var tkn = getSubscriberEmail() & getCreatedDate();
@@ -127,14 +123,14 @@ component
/**
* Returns a slim representation of subscriptions by type
*/
- public struct function getSubscriptionsByContentType(){
+ public struct function getSubscriptionsByContentType() {
var subs = {};
for ( var subscription in getSubscriptions() ) {
var contentType = subscription.getType();
if ( !structKeyExists( subs, contentType ) ) {
subs[ "#contentType#" ] = [];
}
- var memento = { "subscriptionToken" : subscription.getSubscriptionToken() };
+ var memento = { "subscriptionToken": subscription.getSubscriptionToken() };
switch ( contentType ) {
case "Comment":
memento[ "title" ] = subscription.getRelatedContent().getTitle();
@@ -145,4 +141,4 @@ component
return subs;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/SubscriberService.cfc b/modules/contentbox/models/subscriptions/SubscriberService.cfc
index 51f41517d1..bd79818884 100644
--- a/modules/contentbox/models/subscriptions/SubscriberService.cfc
+++ b/modules/contentbox/models/subscriptions/SubscriberService.cfc
@@ -7,15 +7,15 @@
*/
component extends="cborm.models.VirtualEntityService" singleton {
- SubscriberService function init(){
+ SubscriberService function init() {
// init it
super.init( entityName = "cbSubscriber", useQueryCaching = true );
return this;
}
- numeric function getUniqueSubscriberCount(){
+ numeric function getUniqueSubscriberCount() {
return newCriteria().withProjections( countDistinct = "email" ).count();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/SubscriptionListener.cfc b/modules/contentbox/models/subscriptions/SubscriptionListener.cfc
index 5945f4409d..6bfa9eabe3 100644
--- a/modules/contentbox/models/subscriptions/SubscriptionListener.cfc
+++ b/modules/contentbox/models/subscriptions/SubscriptionListener.cfc
@@ -5,19 +5,23 @@
* ---
* Comment Notification interceptor
*/
-component extends="coldbox.system.Interceptor" accessors="true" {
-
+component extends ="coldbox.system.Interceptor" accessors="true" {
// DI
property name="commentService" inject="id:commentService@contentbox";
+
property name="subscriberService" inject="id:subscriberService@contentbox";
- property name="commentSubscriptionService" inject="id:commentSubscriptionService@contentbox";
- function configure(){
+ property
+ name="commentSubscriptionService"
+ inject="id:commentSubscriptionService@contentbox";
+
+ function configure() {
+
}
- public void function cbui_onCommentPost( required any event, required struct data ){
- var content = data.content;
- var comment = data.comment;
+ public void function cbui_onCommentPost( required any event, required struct data ) {
+ var content = data.content;
+ var comment = data.comment;
var subscribe = data.subscribe;
var moderated = data.moderationResults.moderated;
@@ -28,17 +32,17 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// if author has elected to subscribe to comments, do it
if ( subscribe ) {
- var criteria = { subscriberEmail : comment.getAuthorEmail() };
+ var criteria = { subscriberEmail: comment.getAuthorEmail() };
var subscriber = variables.subscriberService.findWhere( criteria = criteria );
- var exists = false;
+ var exists = false;
if ( isNull( subscriber ) ) {
subscriber = variables.subscriberService.new( criteria );
}
var args = {
- relatedContent : comment.getRelatedContent(),
- subscriber : subscriber,
- type : "Comment"
+ relatedContent: comment.getRelatedContent(),
+ subscriber : subscriber,
+ type : "Comment"
};
if ( subscriber.isLoaded() ) {
exists = !isNull( commentSubscriptionService.findWhere( criteria = args ) );
@@ -52,7 +56,7 @@ component extends="coldbox.system.Interceptor" accessors="true" {
}
}
- public void function cbadmin_onCommentStatusUpdate( required any event, required struct data ){
+ public void function cbadmin_onCommentStatusUpdate( required any event, required struct data ) {
var commentIds = listToArray( arguments.data.commentID );
for ( var commentId in commentIds ) {
var comment = commentService.get( commentId );
@@ -62,4 +66,4 @@ component extends="coldbox.system.Interceptor" accessors="true" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/subscriptions/SubscriptionService.cfc b/modules/contentbox/models/subscriptions/SubscriptionService.cfc
index 1c243c3e70..0967663c35 100644
--- a/modules/contentbox/models/subscriptions/SubscriptionService.cfc
+++ b/modules/contentbox/models/subscriptions/SubscriptionService.cfc
@@ -7,9 +7,9 @@
*/
component extends="cborm.models.VirtualEntityService" singleton {
- SubscriptionService function init( entityName = "cbSubscription" ){
+ SubscriptionService function init( entityName = "cbSubscription" ) {
super.init( entityName = arguments.entityName, useQueryCaching = true );
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/CBHelper.cfc b/modules/contentbox/models/system/CBHelper.cfc
index 58235a45be..cca2b4de53 100644
--- a/modules/contentbox/models/system/CBHelper.cfc
+++ b/modules/contentbox/models/system/CBHelper.cfc
@@ -6,34 +6,53 @@
* This is the ContentBox UI helper class that is injected by the CBRequest interceptor
*/
component accessors="true" singleton threadSafe {
-
// DI
property name="categoryService" inject="categoryService@contentbox";
+
property name="settingService" inject="settingService@contentbox";
+
property name="entryService" inject="entryService@contentbox";
+
property name="pageService" inject="pageService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
+
property name="commentService" inject="commentService@contentbox";
+
property name="contentStoreService" inject="contentStoreService@contentbox";
+
property name="widgetService" inject="widgetService@contentbox";
+
property name="moduleService" inject="moduleService@contentbox";
+
property name="themeService" inject="themeService@contentbox";
+
property name="mobileDetector" inject="mobileDetector@contentbox";
+
property name="menuService" inject="menuService@contentbox";
+
property name="menuItemService" inject="menuItemService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="requestService" inject="coldbox:requestService";
+
property name="wirebox" inject="wirebox";
+
property name="controller" inject="coldbox";
+
property name="cbResourceService" inject="resourceService@cbi18n";
+
property name="securityService" inject="securityService@contentbox";
+
property name="markdown" inject="Processor@cbmarkdown";
+
property name="requestStorage" inject="requestStorage@cbstorages";
/**
* Constructor
*/
- function init(){
+ function init() {
return this;
}
@@ -44,7 +63,7 @@ component accessors="true" singleton threadSafe {
*
* @return coldbox.system.web.context.RequestContext
*/
- function getRequestContext(){
+ function getRequestContext() {
return variables.requestService.getContext();
}
@@ -53,14 +72,14 @@ component accessors="true" singleton threadSafe {
*
* @private The boolean bit that says give me the RC by default or true for the private collection (PRC)
*/
- struct function getRequestCollection( boolean private = false ){
+ struct function getRequestCollection( boolean private = false ) {
return getRequestContext().getCollection( private = arguments.private );
}
/**
* Get the private request collection
*/
- struct function getPrivateRequestCollection(){
+ struct function getPrivateRequestCollection() {
return getRequestContext().getCollection( private = true );
}
@@ -69,7 +88,7 @@ component accessors="true" singleton threadSafe {
*
* @module The module to retrieve the configuration settings from
*/
- struct function getModuleSettings( required module ){
+ struct function getModuleSettings( required module ) {
return getModuleConfig( arguments.module ).settings;
}
@@ -78,15 +97,15 @@ component accessors="true" singleton threadSafe {
*
* @module The module to retrieve the configuration structure from
*/
- struct function getModuleConfig( required module ){
+ struct function getModuleConfig( required module ) {
var mConfig = controller.getSetting( "modules" );
if ( structKeyExists( mConfig, arguments.module ) ) {
return mConfig[ arguments.module ];
}
throw(
- message: "The module you passed #arguments.module# is invalid.",
- detail : "The loaded modules are #structKeyList( mConfig )#",
- type : "FrameworkSuperType.InvalidModuleException"
+ message = "The module you passed #arguments.module# is invalid.",
+ detail = "The loaded modules are #structKeyList( mConfig )#",
+ type = "FrameworkSuperType.InvalidModuleException"
);
}
@@ -99,7 +118,7 @@ component accessors="true" singleton threadSafe {
* @defaultValue The default value to return if not found
* @throw InvalidSettingException
*/
- any function setting( required key, defaultValue ){
+ any function setting( required key, defaultValue ) {
var prc = getPrivateRequestCollection();
// See if all the settings are loaded, else lazy load them
@@ -117,9 +136,9 @@ component accessors="true" singleton threadSafe {
}
// else throw exception
throw(
- message: "Setting requested: #arguments.key# not found",
- detail : "Settings keys are #structKeyList( prc.cbSettings )#",
- type : "InvalidSettingException"
+ message = "Setting requested: #arguments.key# not found",
+ detail = "Settings keys are #structKeyList( prc.cbSettings )#",
+ type = "InvalidSettingException"
);
}
@@ -131,7 +150,7 @@ component accessors="true" singleton threadSafe {
*
* @throws InvalidSettingException
*/
- any function siteSetting( required key, defaultValue ){
+ any function siteSetting( required key, defaultValue ) {
var prc = getPrivateRequestCollection();
// See if all the settings are loaded, else lazy load them
@@ -149,44 +168,44 @@ component accessors="true" singleton threadSafe {
}
// else throw exception
throw(
- message: "Site Setting requested: #arguments.key# not found",
- detail : "Site Settings keys are #structKeyList( prc.cbSiteSettings )#",
- type : "InvalidSettingException"
+ message = "Site Setting requested: #arguments.key# not found",
+ detail = "Site Settings keys are #structKeyList( prc.cbSiteSettings )#",
+ type = "InvalidSettingException"
);
}
/**
* The ContentBox version
*/
- function getContentBoxVersion(){
+ function getContentBoxVersion() {
return getModuleConfig( "contentbox" ).version;
}
/**
* The ContentBox Codename
*/
- function getContentBoxCodeName(){
+ function getContentBoxCodeName() {
return getModuleSettings( "contentbox" ).codename;
}
/**
* The ContentBox codename Uri
*/
- function getContentBoxCodeNameURL(){
+ function getContentBoxCodeNameURL() {
return getModuleSettings( "contentbox" ).codenameLink;
}
/**
* Get the blog entry point as specified in the global settings
*/
- function getBlogEntryPoint(){
+ function getBlogEntryPoint() {
return setting( "cb_site_blog_entrypoint", "blog" );
}
/**
* Get the maintenance message from the ContentBox settings in rendering condition.
*/
- function getMaintenanceMessage(){
+ function getMaintenanceMessage() {
return variables.markdown.toHTML( setting( "cb_site_maintenance_message", "" ) );
}
@@ -201,8 +220,8 @@ component accessors="true" singleton threadSafe {
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() );
@@ -215,12 +234,12 @@ component accessors="true" singleton threadSafe {
*
* @return The content object or a new empty content object
*/
- function contentStoreObject( required slug, string siteID = site().getsiteID() ){
+ function contentStoreObject( required slug, string siteID = site().getsiteID() ) {
return contentStoreService.findBySlug(
- slug : arguments.slug,
- showUnpublished: true,
- siteID : arguments.siteID
- );
+ slug = arguments.slug,
+ showUnpublished = true,
+ siteID = arguments.siteID
+ );
}
/************************************** root and pathing methods *********************************************/
@@ -228,28 +247,28 @@ component accessors="true" singleton threadSafe {
/**
* Verifies if the admin module is loaded
*/
- function isAdminLoaded(){
+ function isAdminLoaded() {
return structKeyExists( controller.getSetting( "modules" ), "contentbox-admin" );
}
/**
* Get the admin site root location using the configured module's entry point
*/
- function adminRoot(){
+ function adminRoot() {
return getPrivateRequestCollection().cbAdminEntryPoint;
}
/**
* Get the name of the current set and active theme
*/
- function themeName(){
+ function themeName() {
return getPrivateRequestCollection().cbTheme;
}
/**
* Get the theme record of the current set and active theme
*/
- function themeRecord(){
+ function themeRecord() {
return getPrivateRequestCollection().cbThemeRecord;
}
@@ -259,7 +278,7 @@ component accessors="true" singleton threadSafe {
* @key The name of the theme setting
* @defaultValue The default value if the layout setting does not exist
*/
- function themeSetting( required key, defaultValue ){
+ function themeSetting( required key, defaultValue ) {
arguments.key = "cb_theme_#themeName()#_#arguments.key#";
return siteSetting( argumentCollection = arguments );
}
@@ -275,14 +294,17 @@ component accessors="true" singleton threadSafe {
*
* @siteID The site id to get the root from, by default we use the current site you are on
*/
- function site( string siteID = "" ){
+ function site( string siteID = "" ) {
// Verify incoming override/lookup
if ( len( arguments.siteID ) ) {
// Do a request storage lookup cache for optmizations when requesting the same site
// over and over again in the same request.
- return variables.requestStorage.getOrSet( "cbhelper-request-site-#arguments.siteID#", function(){
- return variables.siteService.getOrFail( siteID );
- } );
+ return variables.requestStorage.getOrSet(
+ "cbhelper-request-site-#arguments.siteID#",
+ function() {
+ return variables.siteService.getOrFail( siteID );
+ }
+ );
}
// Verify PRC
@@ -298,7 +320,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the location of your currently defined theme in the application, great for assets, cfincludes, etc
*/
- function themeRoot(){
+ function themeRoot() {
return getPrivateRequestCollection().cbThemeRoot;
}
@@ -307,7 +329,7 @@ component accessors="true" singleton threadSafe {
*
* @siteID The site id to get the root from, by default we use the current site you are on
*/
- function siteRoot( string siteID = "" ){
+ function siteRoot( string siteID = "" ) {
// Return the appropriate site Uri
return this.site( arguments.siteID ).getSiteRoot() & getModuleConfig( "contentbox-ui" ).entryPoint;
}
@@ -317,7 +339,7 @@ component accessors="true" singleton threadSafe {
*
* @siteID The site id to get the root from, by default we use the current site you are on
*/
- function siteBaseURL( string siteID = "" ){
+ function siteBaseURL( string siteID = "" ) {
return reReplaceNoCase(
this.siteRoot( arguments.siteID ),
"index.cfm\/?",
@@ -328,42 +350,42 @@ component accessors="true" singleton threadSafe {
/**
* Retrieve the site name
*/
- function siteName(){
+ function siteName() {
return site().getName();
}
/**
* Retrieve the site tagline
*/
- function siteTagLine(){
+ function siteTagLine() {
return site().getTagLine();
}
/**
* Retrieve the site description
*/
- function siteDescription(){
+ function siteDescription() {
return site().getDescription();
}
/**
* Retrieve the site keywords
*/
- function siteKeywords(){
+ function siteKeywords() {
return site().getKeywords();
}
/**
* Retrieve the site administrator email
*/
- function siteEmail(){
+ function siteEmail() {
return site().getNotificationEmails();
}
/**
* Retrieve the site outgoing email
*/
- function siteOutgoingEmail(){
+ function siteOutgoingEmail() {
return setting( "cb_site_outgoingEmail" );
}
@@ -372,9 +394,9 @@ component accessors="true" singleton threadSafe {
*
* @content The entry or page content to validate comments also with
*/
- boolean function isCommentsEnabled( content ){
+ boolean function isCommentsEnabled( content ) {
if ( !isNull( arguments.content ) ) {
- return ( arguments.content.getAllowComments() AND siteSetting( "cb_comments_enabled" ) );
+ return ( arguments.content.getAllowComments() && siteSetting( "cb_comments_enabled" ) );
}
return ( siteSetting( "cb_comments_enabled" ) );
}
@@ -382,14 +404,14 @@ component accessors="true" singleton threadSafe {
/**
* Determines if a comment form error has ocurred
*/
- boolean function isCommentFormError(){
+ boolean function isCommentFormError() {
return getFlash().exists( "commentErrors" );
}
/**
* Determine if you are in printing or exporting format
*/
- boolean function isPrintFormat(){
+ boolean function isPrintFormat() {
var currentFormat = getRequestContext().getValue( "format", "contentbox" );
return ( listFindNoCase( "contentbox,html", currentFormat ) ? false : true );
}
@@ -399,7 +421,7 @@ component accessors="true" singleton threadSafe {
*
* @return The errors array or an empty array
*/
- array function getCommentErrors(){
+ array function getCommentErrors() {
return getFlash().get( "commentErrors", [] );
}
@@ -420,10 +442,10 @@ component accessors="true" singleton threadSafe {
string title,
string description,
string keywords
- ){
+ ) {
var event = getRequestContext();
- var prc = getPrivateRequestCollection();
- var rc = getRequestCollection();
+ var prc = getPrivateRequestCollection();
+ var rc = getRequestCollection();
// Request Metadata
if ( structKeyExists( arguments, "title" ) ) {
@@ -437,7 +459,7 @@ component accessors="true" singleton threadSafe {
}
// store UI module root
- prc.cbRoot = getContextRoot() & event.getModuleRoot( "contentbox" );
+ prc.cbRoot = getContextRoot() & event.getModuleRoot( "contentbox" );
// store module entry point
prc.cbEntryPoint = getModuleConfig( "contentbox-ui" ).entryPoint;
// store site entry point
@@ -447,29 +469,31 @@ component accessors="true" singleton threadSafe {
prc.cbAdminEntryPoint = "";
}
// Place site on request
- prc.oCurrentSite = variables.siteService.discoverSite();
+ prc.oCurrentSite = variables.siteService.discoverSite();
// Place global cb options on scope
- prc.cbSettings = variables.settingService.getAllSettings();
+ prc.cbSettings = variables.settingService.getAllSettings();
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 );
+ prc.cbTheme = prc.oCurrentSite.getActiveTheme();
+ prc.cbThemeRecord = variables.themeService.getThemeRecord( prc.cbTheme );
// Place layout root location
- prc.cbthemeRoot = prc.cbThemeRecord.includePath;
+ prc.cbthemeRoot = prc.cbThemeRecord.includePath;
// Place widgets root location
- prc.cbWidgetRoot = prc.cbRoot & "/widgets";
+ prc.cbWidgetRoot = prc.cbRoot & "/widgets";
// announce event
this.event( "cbui_preRequest" );
// Do we set a layout for them already?
if ( structKeyExists( arguments, "layout" ) ) {
- event.setLayout( name = "#prc.cbThemeRecord.includePath#/layouts/" & arguments.layout );
+ event.setLayout(
+ name = "#prc.cbThemeRecord.includePath#/layouts/#arguments.layout#"
+ );
}
/************************************** FORCE SITE WIDE SSL *********************************************/
- if ( prc.oCurrentSite.getIsSSL() and !event.isSSL() ) {
+ if ( prc.oCurrentSite.getIsSSL() && !event.isSSL() ) {
controller.relocate( event = event.getCurrentRoutedURL(), ssl = true );
}
@@ -483,54 +507,56 @@ component accessors="true" singleton threadSafe {
}
// Determine if you have a category filter
- boolean function categoryFilterExists(){
+ boolean function categoryFilterExists() {
var rc = getRequestCollection();
- return ( structKeyExists( rc, "category" ) AND len( rc.category ) );
+ return ( structKeyExists( rc, "category" ) && len( rc.category ) );
}
+
// Get Category Filter
- function getCategoryFilter(){
+ function getCategoryFilter() {
return getRequestContext().getValue( "category", "" );
}
// Get Year Filter
- function getYearFilter(){
+ function getYearFilter() {
return getRequestContext().getValue( "year", "0" );
}
+
// Get Month Filter
- function getMonthFilter(){
+ function getMonthFilter() {
return getRequestContext().getValue( "month", "0" );
}
+
// Get Day Filter
- function getDayFilter(){
+ function getDayFilter() {
return getRequestContext().getValue( "day", "0" );
}
// Determine if you are in the blog
- boolean function isBlogView(){
- if ( isIndexView() OR isEntryView() OR isArchivesView() ) {
+ boolean function isBlogView() {
+ if ( isIndexView() || isEntryView() || isArchivesView() ) {
return true;
}
return false;
}
+
// Determine if you are in the archives view
- boolean function isArchivesView(){
+ boolean function isArchivesView() {
var event = getRequestContext();
- return ( event.getCurrentEvent() eq "contentbox-ui:blog.archives" );
+ return ( event.getCurrentEvent() EQ "contentbox-ui:blog.archives" );
}
+
// Determine if you are in the index view
- boolean function isIndexView(){
+ boolean function isIndexView() {
var event = getRequestContext();
- return ( event.getCurrentEvent() eq "contentbox-ui:blog.index" );
+ return ( event.getCurrentEvent() EQ "contentbox-ui:blog.index" );
}
+
// Determine if you are in the entry view
- boolean function isEntryView(){
+ boolean function isEntryView() {
var event = getRequestContext();
return (
- // If in static export, then mark as yes
- event.getPrivateValue( "staticExport", false )
- OR
- // In executing view
- event.getCurrentEvent() eq "contentbox-ui:blog.entry"
+ event.getPrivateValue( "staticExport", false ) || event.getCurrentEvent() EQ "contentbox-ui:blog.entry"
);
}
@@ -539,20 +565,18 @@ component accessors="true" singleton threadSafe {
*
* @page Optional page slug to determine if you are in that page or not.
*/
- boolean function isPageView( page = "" ){
+ boolean function isPageView( page = "" ) {
var event = getRequestContext();
if (
- // If in static export, then mark as yes
- event.getPrivateValue( "staticExport", false ) OR
- (
- // Check if in page event
- findNoCase( "contentbox-ui:page", event.getCurrentEvent() ) AND
- // And page Exists
- event.valueExists( "page", true )
- )
+ event.getPrivateValue( "staticExport", false ) ||
+ (
+ findNoCase( "contentbox-ui:page", event.getCurrentEvent() ) &&
+ event// And page Exists
+ .valueExists( "page", true )
+ )
) {
// slug check
- if ( len( arguments.page ) AND getCurrentPage().getSlug() eq arguments.page ) {
+ if ( len( arguments.page ) && getCurrentPage().getSlug() EQ arguments.page ) {
return true;
} else if ( !len( arguments.page ) ) {
return true;
@@ -565,7 +589,7 @@ component accessors="true" singleton threadSafe {
/**
* Determine if you're in a "preview" mode or not
*/
- boolean function isPreview(){
+ boolean function isPreview() {
return reFindNoCase( "contentbox-ui:.*preview", getRequestContext().getCurrentEvent() ) ? true : false;
}
@@ -576,7 +600,7 @@ component accessors="true" singleton threadSafe {
*
* @throws ContentBox.CBHelper.InvalidEntriesContext
*/
- any function getCurrentEntries(){
+ any function getCurrentEntries() {
var prc = getRequestCollection( private = true );
if ( structKeyExists( prc, "entries" ) ) {
return prc.entries;
@@ -593,7 +617,7 @@ component accessors="true" singleton threadSafe {
*
* @throws ContentBox.CBHelper.InvalidEntriesContext
*/
- numeric function getCurrentEntriesCount(){
+ numeric function getCurrentEntriesCount() {
var prc = getRequestCollection( private = true );
if ( structKeyExists( prc, "entriesCount" ) ) {
return prc.entriesCount;
@@ -612,11 +636,11 @@ component accessors="true" singleton threadSafe {
*
* @return array of category
*/
- any function getCurrentCategories( isPublic = true ){
+ any function getCurrentCategories( isPublic = true ) {
return variables.categoryService.search(
- isPublic: ( isNull( arguments.isPublic ) ? javacast( "null", "" ) : arguments.isPublic ),
- siteId : site().getSiteId()
- ).categories;
+ isPublic = ( isNull( arguments.isPublic ) ? javacast( "null", "" ) : arguments.isPublic ),
+ siteId = site().getSiteId()
+ ).categories;
}
/**
@@ -626,7 +650,7 @@ component accessors="true" singleton threadSafe {
*
* @throws ContentBox.CBHelper.InvalidEntryContext
*/
- any function getCurrentEntry(){
+ any function getCurrentEntry() {
var prc = getRequestCollection( private = true );
if ( structKeyExists( prc, "entry" ) ) {
return prc.entry;
@@ -645,7 +669,7 @@ component accessors="true" singleton threadSafe {
*
* @throws ContentBox.CBHelper.InvalidPageContext
*/
- any function getCurrentPage(){
+ any function getCurrentPage() {
var prc = getRequestCollection( private = true );
if ( structKeyExists( prc, "page" ) ) {
return prc.page;
@@ -664,7 +688,7 @@ component accessors="true" singleton threadSafe {
*
* @throws ContentBox.CBHelper.InvalidCommentContext
*/
- any function getCurrentComments(){
+ any function getCurrentComments() {
var prc = getRequestCollection( private = true );
if ( structKeyExists( prc, "comments" ) ) {
return prc.comments;
@@ -685,7 +709,7 @@ component accessors="true" singleton threadSafe {
*
* @throws ContentBox.CBHelper.InvalidCommentContext
*/
- numeric function getCurrentCommentsCount(){
+ numeric function getCurrentCommentsCount() {
var prc = getRequestCollection( private = true );
if ( structKeyExists( prc, "commentsCount" ) ) {
return prc.commentsCount;
@@ -700,12 +724,12 @@ component accessors="true" singleton threadSafe {
/**
* Get the missing page, if any, usually used in a page not found context
*/
- any function getMissingPage(){
+ any function getMissingPage() {
return getRequestContext().getValue(
- name = "missingPage",
- private = "true",
- defaultValue = ""
- );
+ name = "missingPage",
+ private = "true",
+ defaultValue = ""
+ );
}
/**
@@ -713,14 +737,14 @@ component accessors="true" singleton threadSafe {
*
* @siteID The site id to get it from
*/
- any function getHomePage( string siteID = "" ){
+ any function getHomePage( string siteID = "" ) {
return site( arguments.siteID ).getHomepage();
}
/**
* Checks if the currently viewed page is the homepage.
*/
- boolean function isHomePage(){
+ boolean function isHomePage() {
var prc = getPrivateRequestCollection();
// Check if page exists
if ( !structKeyExists( prc, "page" ) ) {
@@ -734,7 +758,7 @@ component accessors="true" singleton threadSafe {
*
* @return array
*/
- any function getCurrentRelatedContent(){
+ any function getCurrentRelatedContent() {
var relatedContent = [];
if ( isPageView() && getCurrentPage().hasRelatedContent() ) {
relatedContent = getCurrentPage().getRelatedContent();
@@ -747,7 +771,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the current page's or blog entries custom fields as a struct
*/
- struct function getCurrentCustomFields(){
+ struct function getCurrentCustomFields() {
if ( isPageView() ) {
return getCurrentPage().getCustomFieldsAsStruct();
} else {
@@ -761,7 +785,7 @@ component accessors="true" singleton threadSafe {
* @key The custom field key
* @defaultValue The default value to return if not found
*/
- any function getCustomField( required key, defaultValue ){
+ any function getCustomField( required key, defaultValue ) {
var fields = getCurrentCustomFields();
if ( structKeyExists( fields, arguments.key ) ) {
return fields[ arguments.key ];
@@ -781,7 +805,7 @@ component accessors="true" singleton threadSafe {
/**
* Check the Meta struct exists in the PRC
*/
- function checkMetaStruct(){
+ function checkMetaStruct() {
var prc = getPrivateRequestCollection();
if ( !structKeyExists( prc, "meta" ) ) {
prc.meta = {};
@@ -793,7 +817,7 @@ component accessors="true" singleton threadSafe {
*
* @title - The new title
*/
- function setMetaTitle( required string title ){
+ function setMetaTitle( required string title ) {
var prc = getPrivateRequestCollection();
checkMetaStruct();
prc.meta.title = arguments.title;
@@ -802,7 +826,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Meta Title for the request
*/
- function getMetaTitle(){
+ function getMetaTitle() {
var prc = getPrivateRequestCollection();
checkMetaStruct();
if ( structKeyExists( prc.meta, "title" ) ) {
@@ -817,7 +841,7 @@ component accessors="true" singleton threadSafe {
*
* @description - The new Description
*/
- function setMetaDescription( required string description ){
+ function setMetaDescription( required string description ) {
var prc = getPrivateRequestCollection();
checkMetaStruct();
prc.meta.description = arguments.description;
@@ -826,7 +850,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Meta description for the request
*/
- function getMetaDescription(){
+ function getMetaDescription() {
var prc = getPrivateRequestCollection();
checkMetaStruct();
if ( structKeyExists( prc.meta, "description" ) ) {
@@ -841,7 +865,7 @@ component accessors="true" singleton threadSafe {
*
* @keywords - The new Keywords
*/
- function setMetaKeywords( required string keywords ){
+ function setMetaKeywords( required string keywords ) {
var prc = getPrivateRequestCollection();
checkMetaStruct();
prc.meta.keywords = arguments.keywords;
@@ -850,7 +874,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Meta keywords for the request
*/
- function getMetaKeywords(){
+ function getMetaKeywords() {
var prc = getPrivateRequestCollection();
checkMetaStruct();
if ( structKeyExists( prc.meta, "keywords" ) ) {
@@ -863,9 +887,9 @@ component accessors="true" singleton threadSafe {
/**
* Get the current content metadata title according to SEO Discovery Rules
*/
- function getContentTitle(){
+ function getContentTitle() {
var oCurrentContent = "";
- var metaTitle = getMetaTitle();
+ var metaTitle = getMetaTitle();
// If Meta Title is set Manually, return it
if ( len( metaTitle ) ) {
@@ -896,7 +920,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the current content metadata description according to SEO discovery rules
*/
- function getContentDescription(){
+ function getContentDescription() {
var oCurrentContent = "";
var metaDescription = getMetaDescription();
@@ -917,9 +941,9 @@ component accessors="true" singleton threadSafe {
// - Site Description
if ( isHomePage() ) {
metaDescription = oCurrentContent.getHTMLDescription();
- return len( metaDescription ) ? encodeForHTMLAttribute( metaDescription ) : encodeForHTMLAttribute(
- siteDescription()
- );
+ return len( metaDescription )
+ ? encodeForHTMLAttribute( metaDescription )
+ : encodeForHTMLAttribute( siteDescription() );
}
// Page/Blog Rules
@@ -947,9 +971,9 @@ component accessors="true" singleton threadSafe {
/**
* Get the current content metadata keywords according to SEO discovery rules
*/
- function getContentKeywords(){
+ function getContentKeywords() {
var oCurrentContent = "";
- var metaKeywords = getMetaKeywords();
+ var metaKeywords = getMetaKeywords();
// If Meta Keywords is set Manually, return it
if ( len( metaKeywords ) ) {
@@ -968,13 +992,13 @@ component accessors="true" singleton threadSafe {
// - Site
if ( isHomePage() ) {
metaKeywords = stripWhitespace( oCurrentContent.getHTMLKeywords() );
- return len( metaKeywords ) ? encodeForHTMLAttribute( metaKeywords ) : encodeForHTMLAttribute(
- siteKeywords()
- );
+ return len( metaKeywords )
+ ? encodeForHTMLAttribute( metaKeywords )
+ : encodeForHTMLAttribute( siteKeywords() );
}
// in context view or global
- if ( isObject( oCurrentContent ) AND len( oCurrentContent.getHTMLKeywords() ) ) {
+ if ( isObject( oCurrentContent ) && len( oCurrentContent.getHTMLKeywords() ) ) {
return encodeForHTMLAttribute( stripWhitespace( oCurrentContent.getHTMLKeywords() ) );
}
@@ -982,13 +1006,12 @@ component accessors="true" singleton threadSafe {
return encodeForHTMLAttribute( siteKeywords() );
}
-
/**
* Set the Meta Canonical URL for the request
*
* @url - The new url
*/
- function setMetaURL( required string url ){
+ function setMetaURL( required string url ) {
var prc = getPrivateRequestCollection();
checkMetaStruct();
prc.meta.url = arguments.url;
@@ -997,7 +1020,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Meta Canonical URL for the request
*/
- function getMetaURL(){
+ function getMetaURL() {
var prc = getPrivateRequestCollection();
checkMetaStruct();
if ( structKeyExists( prc.meta, "url" ) ) {
@@ -1007,14 +1030,13 @@ component accessors="true" singleton threadSafe {
}
}
-
/**
* Get the Canonical URL based on content type
*/
- function getContentURL(){
- var oCurrentContent = "";
+ function getContentURL() {
+ var oCurrentContent = "";
var oCurrentEntryPoint = "";
- var metaURL = getMetaURL();
+ var metaURL = getMetaURL();
if ( len( metaURL ) ) {
return metaURL;
@@ -1022,15 +1044,15 @@ component accessors="true" singleton threadSafe {
// Check if in page view or entry view
if ( isPageView() ) {
- oCurrentContent = getCurrentPage();
+ oCurrentContent = getCurrentPage();
oCurrentEntryPoint = "";
} else if ( isEntryView() ) {
- oCurrentContent = getCurrentEntry();
+ oCurrentContent = getCurrentEntry();
oCurrentEntryPoint = setting( "cb_site_blog_entrypoint" ) & "/";
}
// in context view or global
- if ( isObject( oCurrentContent ) AND len( oCurrentContent.getslug() ) ) {
+ if ( isObject( oCurrentContent ) && len( oCurrentContent.getslug() ) ) {
return siteBaseURL() & oCurrentEntryPoint & oCurrentContent.getslug();
}
@@ -1042,7 +1064,7 @@ component accessors="true" singleton threadSafe {
*
* @imageURL - The new imageURL
*/
- function setMetaImageURL( required string imageURL ){
+ function setMetaImageURL( required string imageURL ) {
var prc = getPrivateRequestCollection();
checkMetaStruct();
prc.meta.imageURL = arguments.imageURL;
@@ -1051,7 +1073,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Meta ImageURL for the request
*/
- function getMetaImageURL(){
+ function getMetaImageURL() {
var prc = getPrivateRequestCollection();
checkMetaStruct();
if ( structKeyExists( prc.meta, "imageURL" ) ) {
@@ -1064,9 +1086,9 @@ component accessors="true" singleton threadSafe {
/**
* Get the Content Image URL based on content type
*/
- function getContentImageURL(){
+ function getContentImageURL() {
var oCurrentContent = "";
- var metaImageUrl = getMetaImageURL();
+ var metaImageUrl = getMetaImageURL();
if ( len( metaImageURL ) ) {
return metaImageURL;
@@ -1080,7 +1102,7 @@ component accessors="true" singleton threadSafe {
}
// in context view or global
- if ( isObject( oCurrentContent ) AND len( oCurrentContent.getFeaturedImageURL() ) ) {
+ if ( isObject( oCurrentContent ) && len( oCurrentContent.getFeaturedImageURL() ) ) {
return siteBaseURL() & oCurrentContent.getFeaturedImageURL();
}
@@ -1092,7 +1114,7 @@ component accessors="true" singleton threadSafe {
*
* @OGType - The new OGType
*/
- function setMetaOGType( required string OGType ){
+ function setMetaOGType( required string OGType ) {
var prc = getPrivateRequestCollection();
checkMetaStruct();
prc.meta.OGType = arguments.OGType;
@@ -1101,7 +1123,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Meta OGType for the request
*/
- function getMetaOGType(){
+ function getMetaOGType() {
var prc = getPrivateRequestCollection();
checkMetaStruct();
if ( structKeyExists( prc.meta, "OGType" ) ) {
@@ -1114,7 +1136,7 @@ component accessors="true" singleton threadSafe {
/**
* Get the Content Open Graph Type based on content type
*/
- function getContentOGType(){
+ function getContentOGType() {
var metaOGType = getMetaOGType();
if ( len( metaOGType ) ) {
@@ -1136,49 +1158,58 @@ component accessors="true" singleton threadSafe {
* More information: https://developers.facebook.com/docs/reference/opengraph
* Best Practices: https://developers.facebook.com/docs/sharing/best-practices
*/
- function getOpenGraphMeta(){
- var content = "";
+ function getOpenGraphMeta() {
+ var content = "";
// cfformat-ignore-start
savecontent variable="content" {
- writeOutput( " #chr( 10 )#" );
- writeOutput( " #chr( 10 )#" );
- writeOutput( " #chr( 10 )#" );
-
- if ( len( getContentURL() ) ) {
- writeOutput( " #chr( 10 )#" );
- }
+writeOutput(
+" #chr( 10 )#"
+);
+writeOutput(
+" #chr( 10 )#"
+);
+writeOutput(
+" #chr( 10 )#"
+);
+
+if ( len( getContentURL() ) ) {
+writeOutput(
+" #chr( 10 )#"
+);
+}
- if ( len( getContentImageURL() ) ) {
- writeOutput( " #chr( 10 )#" );
- }
- }
+if ( len( getContentImageURL() ) ) {
+writeOutput(
+" #chr( 10 )#"
+);
+}
+}
// cfformat-ignore-end
return content;
}
-
/************************************** search *********************************************/
// Determine if you are in the search view
- boolean function isSearchView(){
+ boolean function isSearchView() {
var event = getRequestContext();
- return ( event.getCurrentEvent() eq "contentbox-ui:page.search" );
+ return ( event.getCurrentEvent() EQ "contentbox-ui:page.search" );
}
/**
* quickSearchForm will build a standard ContentBox Content Search Form according to the SearchForm widget
*/
- function quickSearchForm(){
- return widget( "SearchForm", { type : "content" } );
+ function quickSearchForm() {
+ return widget( "SearchForm", { type: "content" } );
}
/**
* Render out paging for search content
*/
- function quickSearchPaging(){
+ function quickSearchPaging() {
var prc = getRequestCollection( private = true );
- if ( NOT structKeyExists( prc, "oPaging" ) ) {
+ if ( !structKeyExists( prc, "oPaging" ) ) {
throw(
message = "Paging object is not in the collection",
detail = "This probably means you are trying to use the paging outside of the search results page and that is a No No",
@@ -1186,10 +1217,10 @@ component accessors="true" singleton threadSafe {
);
}
return prc.oPaging.renderit(
- foundRows = getSearchResults().getTotal(),
- link = prc.pagingLink,
- pagingMaxRows = setting( "cb_search_maxResults" )
- );
+ foundRows = getSearchResults().getTotal(),
+ link = prc.pagingLink,
+ pagingMaxRows = setting( "cb_search_maxResults" )
+ );
}
/**
@@ -1197,46 +1228,46 @@ component accessors="true" singleton threadSafe {
*
* @return contentbox.models.search.SearchResults
*/
- function getSearchResults(){
+ function getSearchResults() {
var event = getRequestContext();
return event.getValue(
- name = "searchResults",
- private = "true",
- default = ""
- );
+ name = "searchResults",
+ private = "true",
+ default = ""
+ );
}
/**
* get the curent search results HTML content
*/
- any function getSearchResultsContent(){
+ any function getSearchResultsContent() {
var event = getRequestContext();
return event.getValue(
- name = "searchResultsContent",
- private = "true",
- default = ""
- );
+ name = "searchResultsContent",
+ private = "true",
+ default = ""
+ );
}
/**
* Determine if you have a search term
*/
- boolean function searchTermExists(){
+ boolean function searchTermExists() {
var rc = getRequestCollection();
- return ( structKeyExists( rc, "q" ) AND len( rc.q ) );
+ return ( structKeyExists( rc, "q" ) && len( rc.q ) );
}
/**
* Get Search Term used
*/
- function getSearchTerm(){
+ function getSearchTerm() {
return getRequestContext().getValue( "q", "" );
}
/************************************** events *********************************************/
// event announcements, funky for whitespace reasons
- function event( required state, struct data = structNew() ) output="true"{
+ function event( required state, struct data = structNew() ) output="true" {
controller.getInterceptorService().announce( arguments.state, arguments.data );
}
@@ -1255,16 +1286,16 @@ component accessors="true" singleton threadSafe {
required string to,
queryString = "",
boolean ssl = getRequestContext().isSSL()
- ){
+ ) {
// Remove by 6.x
if ( !isNull( arguments.linkTo ) ) {
arguments.to = arguments.linkTo;
}
return getRequestContext().buildLink(
- to : adminRoot() & ".module.#arguments.module#.#arguments.to#",
- queryString: arguments.queryString,
- ssl : arguments.ssl
- );
+ to = adminRoot() & ".module.#arguments.module#.#arguments.to#",
+ queryString = arguments.queryString,
+ ssl = arguments.ssl
+ );
}
/**
@@ -1277,13 +1308,12 @@ component accessors="true" singleton threadSafe {
string URI,
string queryString = "",
persist,
- struct persistStruct
- boolean addToken,
+ struct persistStruct boolean addToken,
boolean ssl,
baseURL,
boolean postProcessExempt,
numeric statusCode
- ){
+ ) {
return moduleRelocate( argumentCollection = arguments );
}
@@ -1310,13 +1340,12 @@ component accessors="true" singleton threadSafe {
string URI,
string queryString = "",
persist,
- struct persistStruct
- boolean addToken,
+ struct persistStruct boolean addToken,
boolean ssl,
baseURL,
boolean postProcessExempt,
numeric statusCode
- ){
+ ) {
arguments.event = adminRoot() & ".module.#arguments.module#.#arguments.event#";
return controller.relocate( argumentCollection = arguments );
}
@@ -1327,7 +1356,7 @@ component accessors="true" singleton threadSafe {
* @event An optional event to link to
* @ssl Use SSL or not, defaults to event context.
*/
- function linkAdmin( event = "", boolean ssl = getRequestContext().isSSL() ){
+ function linkAdmin( event = "", boolean ssl = getRequestContext().isSSL() ) {
return getRequestContext().buildLink( to = adminRoot() & ".#arguments.event#", ssl = arguments.ssl );
}
@@ -1336,7 +1365,7 @@ component accessors="true" singleton threadSafe {
*
* @ssl Use SSL or not, defaults to event context.
*/
- function linkAdminLogout( boolean ssl = getRequestContext().isSSL() ){
+ function linkAdminLogout( boolean ssl = getRequestContext().isSSL() ) {
return getRequestContext().buildLink( to = adminRoot() & "/security/doLogout", ssl = arguments.ssl );
}
@@ -1345,7 +1374,7 @@ component accessors="true" singleton threadSafe {
*
* @ssl Use SSL or not, defaults to event context.
*/
- function linkAdminLogin( boolean ssl = getRequestContext().isSSL() ){
+ function linkAdminLogin( boolean ssl = getRequestContext().isSSL() ) {
return getRequestContext().buildLink( to = adminRoot() & "/security/login", ssl = arguments.ssl );
}
@@ -1354,7 +1383,7 @@ component accessors="true" singleton threadSafe {
*
* @siteID The site id to link to or use the default
*/
- function linkHome( string siteID = "" ){
+ function linkHome( string siteID = "" ) {
return siteRoot( arguments.siteID );
}
@@ -1363,24 +1392,17 @@ component accessors="true" singleton threadSafe {
*
* @siteID The site id to link to or use the default
*/
- function linkBlog( string siteID = "" ){
+ function linkBlog( string siteID = "" ) {
return "#siteRoot( arguments.siteID )#/#getBlogEntryPoint()#";
}
/**
* Create a link to the current page/entry you are on
*/
- function linkSelf(){
+ function linkSelf() {
return "#siteRoot()##sep()##cgi.script_name##cgi.path_info#";
}
- /**
- * Get the site URL separator depending if you have an entry point or not
- */
- private function sep(){
- return "/";
- }
-
/**
* Link to RSS feeds that ContentBox generates, by default it is the recent updates feed
*
@@ -1391,10 +1413,10 @@ component accessors="true" singleton threadSafe {
*/
function linkRSS(
category,
- comments = false,
+ comments = false,
entry,
boolean ssl = getRequestContext().isSSL()
- ){
+ ) {
var xehRSS = linkBlog() & "/rss";
// do we have a category?
@@ -1428,8 +1450,8 @@ component accessors="true" singleton threadSafe {
any category,
boolean comments = false,
string slug,
- boolean ssl = getRequestContext().isSSL()
- ){
+ boolean ssl = getRequestContext().isSSL()
+ ) {
var xehRSS = siteRoot() & sep() & "__rss";
// do we have a category?
@@ -1466,8 +1488,8 @@ component accessors="true" singleton threadSafe {
any category,
boolean comments = false,
page,
- boolean ssl = getRequestContext().isSSL()
- ){
+ boolean ssl = getRequestContext().isSSL()
+ ) {
var xehRSS = siteRoot() & sep() & "__rss/pages";
// do we have a category?
@@ -1498,7 +1520,7 @@ component accessors="true" singleton threadSafe {
* @category The category object or slug to link to
* @ssl Use SSL or not, defaults to false.
*/
- function linkCategory( required any category, boolean ssl = getRequestContext().isSSL() ){
+ function linkCategory( required any category, boolean ssl = getRequestContext().isSSL() ) {
var categorySlug = "";
if ( isSimpleValue( arguments.category ) ) {
categorySlug = arguments.category;
@@ -1515,7 +1537,10 @@ component accessors="true" singleton threadSafe {
* @categorySlug The category slug as a string to link to
* @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#";
}
@@ -1527,12 +1552,7 @@ component accessors="true" singleton threadSafe {
* @day The day of the archive
* @ssl Use SSL or not, defaults to false.
*/
- function linkArchive(
- year,
- month,
- day,
- boolean ssl = getRequestContext().isSSL()
- ){
+ function linkArchive( year, month, day, boolean ssl = getRequestContext().isSSL() ) {
var xeh = linkBlog() & "/archives";
if ( structKeyExists( arguments, "year" ) ) {
@@ -1553,7 +1573,7 @@ component accessors="true" singleton threadSafe {
*
* @ssl Use SSL or not, defaults to false.
*/
- function linkSearch( boolean ssl = getRequestContext().isSSL() ){
+ function linkSearch( boolean ssl = getRequestContext().isSSL() ) {
return linkBlog() & "/search";
}
@@ -1562,7 +1582,7 @@ component accessors="true" singleton threadSafe {
*
* @ssl Use SSL or not, defaults to false.
*/
- function linkContentSearch( boolean ssl = getRequestContext().isSSL() ){
+ function linkContentSearch( boolean ssl = getRequestContext().isSSL() ) {
return siteRoot() & sep() & "__search";
}
@@ -1571,7 +1591,7 @@ component accessors="true" singleton threadSafe {
*
* @ssl Use SSL or not, defaults to false.
*/
- function linkContentSubscription( boolean ssl = getRequestContext().isSSL() ){
+ function linkContentSubscription( boolean ssl = getRequestContext().isSSL() ) {
return siteRoot() & sep() & "__subscribe";
}
@@ -1580,7 +1600,7 @@ component accessors="true" singleton threadSafe {
*
* @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#";
}
@@ -1595,9 +1615,9 @@ component accessors="true" singleton threadSafe {
required entry,
boolean ssl = getRequestContext().isSSL(),
format = "html"
- ){
+ ) {
// format?
- var outputFormat = ( arguments.format neq "html" ? ".#arguments.format#" : "" );
+ var outputFormat = ( arguments.format NEQ "html" ? ".#arguments.format#" : "" );
if ( isSimpleValue( arguments.entry ) ) {
return linkEntrywithslug(
@@ -1621,11 +1641,15 @@ component accessors="true" singleton threadSafe {
required slug,
boolean ssl = getRequestContext().isSSL(),
format = "html"
- ){
+ ) {
// format?
- var outputFormat = ( arguments.format neq "html" ? ".#arguments.format#" : "" );
+ var outputFormat = ( arguments.format NEQ "html" ? ".#arguments.format#" : "" );
// Cleanup
- arguments.slug = reReplace( arguments.slug, "^/", "" );
+ arguments.slug = reReplace(
+ arguments.slug,
+ "^/",
+ ""
+ );
// link
return linkBlog() & sep() & arguments.slug & outputFormat;
}
@@ -1641,15 +1665,15 @@ component accessors="true" singleton threadSafe {
required content,
boolean ssl = getRequestContext().isSSL(),
format = "html"
- ){
- if ( arguments.content.getContentType() eq "entry" ) {
+ ) {
+ if ( arguments.content.getContentType() EQ "entry" ) {
return linkEntry(
arguments.content,
arguments.ssl,
arguments.format
);
}
- if ( arguments.content.getContentType() eq "page" ) {
+ if ( arguments.content.getContentType() EQ "page" ) {
return linkPage(
arguments.content,
arguments.ssl,
@@ -1671,9 +1695,9 @@ component accessors="true" singleton threadSafe {
required page,
boolean ssl = getRequestContext().isSSL(),
format = "html"
- ){
+ ) {
// format extension?
- var outputFormat = ( arguments.format neq "html" ? ".#arguments.format#" : "" );
+ var outputFormat = ( arguments.format NEQ "html" ? ".#arguments.format#" : "" );
// link directly or with slug
if ( isSimpleValue( arguments.page ) ) {
@@ -1699,11 +1723,15 @@ component accessors="true" singleton threadSafe {
required slug,
boolean ssl = getRequestContext().isSSL(),
format = "html"
- ){
+ ) {
// format?
- var outputFormat = ( arguments.format neq "html" ? ".#arguments.format#" : "" );
+ var outputFormat = ( arguments.format NEQ "html" ? ".#arguments.format#" : "" );
// cleanup
- arguments.slug = reReplace( arguments.slug, "^/", "" );
+ arguments.slug = reReplace(
+ arguments.slug,
+ "^/",
+ ""
+ );
// Return the formed link
return siteRoot() & sep() & arguments.slug & outputFormat;
}
@@ -1714,9 +1742,15 @@ component accessors="true" singleton threadSafe {
* @comment The comment to link to
* @ssl Use SSL or not, defaults to false.
*/
- function linkComment( required comment, boolean ssl = getRequestContext().isSSL() ){
+ function linkComment( required comment, boolean ssl = getRequestContext().isSSL() ) {
var xeh = "";
- if ( arguments.comment.getRelatedContent().getContentType() eq "page" ) {
+ if (
+ arguments
+ .comment
+ .getRelatedContent()
+ .getContentType() EQ
+ "page"
+ ) {
xeh = linkPage( arguments.comment.getRelatedContent(), arguments.ssl );
} else {
xeh = linkEntry( arguments.comment.getRelatedContent(), arguments.ssl );
@@ -1732,9 +1766,9 @@ component accessors="true" singleton threadSafe {
* @content The entry or page to link to its comments
* @ssl Use SSL or not, defaults to false.
*/
- function linkComments( required content, boolean ssl = getRequestContext().isSSL() ){
+ function linkComments( required content, boolean ssl = getRequestContext().isSSL() ) {
var xeh = "";
- if ( arguments.content.getContentType() eq "page" ) {
+ if ( arguments.content.getContentType() EQ "page" ) {
xeh = linkPage( arguments.content, arguments.ssl );
} else {
xeh = linkEntry( arguments.content, arguments.ssl );
@@ -1751,8 +1785,8 @@ component accessors="true" singleton threadSafe {
*
* @return The URL to submit to.
*/
- function linkCommentPost( required content, boolean ssl = getRequestContext().isSSL() ){
- if ( arguments.content.getContentType() eq "page" ) {
+ function linkCommentPost( required content, boolean ssl = getRequestContext().isSSL() ) {
+ if ( arguments.content.getContentType() EQ "page" ) {
return siteRoot() & sep() & "__pageCommentPost";
}
@@ -1764,7 +1798,7 @@ component accessors="true" singleton threadSafe {
*
* @lang The iso language code
*/
- function linkLanguageChange( string lang = "en_US" ){
+ function linkLanguageChange( string lang = "en_US" ) {
return getRequestContext().buildLink( "__changeLang/" & arguments.lang );
}
@@ -1776,7 +1810,7 @@ component accessors="true" singleton threadSafe {
* @name The name of the installed widget to execute
* @args The argument collection to pass to the widget's renderIt() method
*/
- function widget( required name, struct args = structNew() ){
+ function widget( required name, struct args = structNew() ) {
return getWidget( arguments.name ).renderit( argumentCollection = arguments.args );
}
@@ -1788,7 +1822,7 @@ component accessors="true" singleton threadSafe {
*
* @name The name of the installed widget to return
*/
- function getWidget( required name ){
+ function getWidget( required name ) {
return widgetService.getWidgetByDiscovery( arguments.name );
}
@@ -1798,33 +1832,38 @@ component accessors="true" singleton threadSafe {
* Create entry category links to be display usually on an entry or entry list.
* @entry The entry to use to build its category links list.
*/
- function quickCategoryLinks( required entry ){
+ function quickCategoryLinks( required entry ) {
var e = arguments.entry;
// check if it has categories
- if ( NOT e.hasCategories() ) {
+ if ( !e.hasCategories() ) {
return "";
}
- var cats = e.getCategories();
+ var cats = e.getCategories();
var catList = [];
// iterate and create links
- for ( var x = 1; x lte arrayLen( cats ); x++ ) {
+ for ( var x = 1; x LTE arrayLen( cats ); x++ ) {
var link = "#cats[ x ].getCategory()# ";
arrayAppend( catList, link );
}
// return list of links
- return replace( arrayToList( catList ), ",", ", ", "all" );
+ return replace(
+ arrayToList( catList ),
+ ",",
+ ", ",
+ "all"
+ );
}
/**
* Render out paging for blog entries only
*/
- function quickPaging(){
+ function quickPaging() {
var prc = getRequestCollection( private = true );
- if ( NOT structKeyExists( prc, "oPaging" ) ) {
+ if ( !structKeyExists( prc, "oPaging" ) ) {
throw(
message = "Paging object is not in the collection",
detail = "This probably means you are trying to use the paging outside of the main entries index page and that is a No No",
@@ -1832,11 +1871,11 @@ component accessors="true" singleton threadSafe {
);
}
return prc.oPaging.renderit(
- foundRows = prc.entriesCount,
- link = prc.pagingLink,
- aslist = true,
- pagingMaxRows = setting( "cb_paging_maxentries" )
- );
+ foundRows = prc.entriesCount,
+ link = prc.pagingLink,
+ aslist = true,
+ pagingMaxRows = setting( "cb_paging_maxentries" )
+ );
}
/**
@@ -1850,11 +1889,9 @@ component accessors="true" singleton threadSafe {
string template = "entry",
string collectionAs = "entry",
struct args = structNew()
- ){
+ ) {
var entries = getCurrentEntries();
- return controller
- .getRenderer()
- .view(
+ return controller.getRenderer().view(
view = "#themeName()#/templates/#arguments.template#",
collection = entries,
collectionAs = arguments.collectionAs,
@@ -1873,11 +1910,9 @@ component accessors="true" singleton threadSafe {
string template = "entry",
string collectionAs = "entry",
struct args = structNew()
- ){
- var entries = [ getCurrentEntry() ];
- return controller
- .getRenderer()
- .view(
+ ) {
+ var entries = [ getCurrentEntry()];
+ return controller.getRenderer().view(
view = "#themeName()#/templates/#arguments.template#",
collection = entries,
collectionAs = arguments.collectionAs,
@@ -1898,11 +1933,9 @@ component accessors="true" singleton threadSafe {
string collectionAs = "category",
struct args = structNew(),
isPublic = true
- ){
+ ) {
var categories = getCurrentCategories( argumentCollection = arguments );
- return controller
- .getRenderer()
- .view(
+ return controller.getRenderer().view(
view = "#themeName()#/templates/#arguments.template#",
collection = categories,
collectionAs = arguments.collectionAs,
@@ -1921,11 +1954,9 @@ component accessors="true" singleton threadSafe {
string template = "relatedContent",
string collectionAs = "relatedContent",
struct args = structNew()
- ){
+ ) {
var relatedContent = getCurrentRelatedContent();
- return controller
- .getRenderer()
- .view(
+ return controller.getRenderer().view(
view = "#themeName()#/templates/#arguments.template#",
collection = relatedContent,
collectionAs = arguments.collectionAs,
@@ -1936,14 +1967,16 @@ component accessors="true" singleton threadSafe {
/**
* Render out custom fields for the current content
*/
- function quickCustomFields(){
+ function quickCustomFields() {
var customFields = getCurrentCustomFields();
- var content = "";
+ var content = "";
savecontent variable="content" {
writeOutput( "" );
for ( var thisField in customFields ) {
- writeOutput( "#thisField#: #customFields[ thisField ]# " );
+ writeOutput(
+ "#thisField#: #customFields[ thisField ]# "
+ );
}
writeOutput( " " );
}
@@ -1962,11 +1995,9 @@ component accessors="true" singleton threadSafe {
string template = "comment",
string collectionAs = "comment",
struct args = structNew()
- ){
+ ) {
var comments = getCurrentComments();
- return controller
- .getRenderer()
- .view(
+ return controller.getRenderer().view(
view = "#themeName()#/templates/#arguments.template#",
collection = comments,
collectionAs = arguments.collectionAs,
@@ -1984,16 +2015,14 @@ component accessors="true" singleton threadSafe {
required author,
numeric size = 25,
string class = "gravatar"
- ){
+ ) {
var targetEmail = arguments.author;
// check if simple or not
- if ( NOT isSimpleValue( arguments.author ) ) {
+ if ( !isSimpleValue( arguments.author ) ) {
targetEmail = arguments.author.getEmail();
}
- return wirebox
- .getInstance( "Avatar@contentbox" )
- .renderAvatar(
+ return wirebox.getInstance( "Avatar@contentbox" ).renderAvatar(
email = targetEmail,
size = arguments.size,
class = arguments.class
@@ -2021,12 +2050,12 @@ component accessors="true" singleton threadSafe {
*/
function quickView(
required view,
- cache = false,
+ cache = false,
cacheTimeout,
cacheLastAccessTimeout,
cacheSuffix,
- cacheProvider = "template",
- module = "contentbox",
+ cacheProvider = "template",
+ module = "contentbox",
struct args,
collection,
collectionAs = "",
@@ -2034,8 +2063,8 @@ component accessors="true" singleton threadSafe {
numeric collectionMaxRows = 0,
collectionDelim = "",
boolean prepostExempt = false
- ){
- arguments.view = "#themeName()#/views/#arguments.view#";
+ ) {
+ arguments.view = "#themeName()#/views/#arguments.view#";
arguments.module = themeRecord().module;
return controller.getRenderer().view( argumentCollection = arguments );
}
@@ -2058,7 +2087,7 @@ component accessors="true" singleton threadSafe {
args = structNew(),
viewModule = "",
boolean prePostExempt = false
- ){
+ ) {
arguments.layout = "#themeName()#/layouts/#arguments.layout#";
return controller.getRenderer().layout( argumentCollection = arguments );
}
@@ -2068,8 +2097,8 @@ component accessors="true" singleton threadSafe {
*
* @content The content this comment form will be linked to, page or entry
*/
- function quickCommentForm( required content ){
- return widget( "CommentForm", { content : arguments.content } );
+ function quickCommentForm( required content ) {
+ return widget( "CommentForm", { content: arguments.content } );
}
/**
@@ -2077,7 +2106,7 @@ component accessors="true" singleton threadSafe {
*
* @args
*/
- function mainView( struct args = structNew() ){
+ function mainView( struct args = structNew() ) {
return controller.getRenderer().view( view = "", args = arguments.args );
}
@@ -2096,7 +2125,7 @@ component accessors="true" singleton threadSafe {
required string slug,
required type = "html",
required array slugCache = []
- ){
+ ) {
var menu = variables.menuService.findBySlug( arguments.slug, site().getsiteID() );
if ( menu.isLoaded() ) {
@@ -2117,13 +2146,16 @@ component accessors="true" singleton threadSafe {
* @menu.doc_generic contentbox.models.menu.Menu
* @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();
+ public string function buildProviderMenu(
+ required any menu,
+ required array slugCache = []
+ ) {
+ var listType = arguments.menu.getListType();
// arguments.listType = !reFindNoCase( "^(ul|ol)$", arguments.listType ) ? "" : arguments.listType;
// set start
var menuString = "<#listType# class='#arguments.menu.getMenuClass()#'>";
// now get root items
- var items = arguments.menu.getRootMenuItems();
+ var items = arguments.menu.getRootMenuItems();
// create cache of slugs to prevent infinite recursions
arrayAppend( arguments.slugCache, menu.getSlug() );
// build out this top level
@@ -2138,49 +2170,6 @@ component accessors="true" singleton threadSafe {
return menuString;
}
- /**
- * Builds out a level of a custom menu
- *
- * @items An array of menu items for this level
- * @listType The type of list to create (derived from owning menu)
- * @slugCache The cache of menu slugs already used in this request
- */
- private string function buildProviderMenuLevel(
- required array items,
- required string listType = "ul",
- required array slugCache = [],
- string listClass = ""
- ){
- var menuString = "";
- // loop over items to build out level
- for ( var item in arguments.items ) {
- var extras = {
- slugCache : arguments.slugCache,
- listType : arguments.listType
- };
- // check that item can be added
- if ( item.canDisplay( options = extras ) ) {
- // get template from provider
- menuString &= "" & item
- .getProvider()
- .getDisplayTemplate( item, extras );
- // if this menu item has children...
- if ( item.hasChild() ) {
- // recurse, recurse, recurse!
- menuString &= "<#arguments.listType# class='#arguments.listClass#'>" &
- buildProviderMenuLevel(
- items = item.getChildren(),
- listType = arguments.listType,
- slugCache = arguments.slugCache
- ) &
- "#arguments.listType#>";
- }
- menuString &= " ";
- }
- }
- return menuString;
- }
-
/**
* Render out a quick menu for root level pages
*
@@ -2202,16 +2191,16 @@ component accessors="true" singleton threadSafe {
elementClass = "",
parentClass = "parent",
activeClass = "active"
- ){
- arguments.showNone = false;
+ ) {
+ arguments.showNone = false;
// get root pages
arguments.pageRecords = pageService.findPublishedContent(
- parent : "",
- showInMenu: true,
- siteID : site().getsiteID(),
- properties: "contentID,slug,title,numberOfChildren",
- sortOrder : "order ASC, publishedDate ASC"
- );
+ parent = "",
+ showInMenu = true,
+ siteID = site().getsiteID(),
+ properties = "contentID,slug,title",
+ sortOrder = "order ASC, publishedDate ASC"
+ );
// build it out
return buildMenu( argumentCollection = arguments );
}
@@ -2243,7 +2232,7 @@ component accessors="true" singleton threadSafe {
parentClass = "parent",
activeClass = "active",
activeShowChildren = false
- ){
+ ) {
// If page not passed, or empty, then use the current page
if ( isNull( arguments.page ) || ( isSimpleValue( arguments.page ) && !len( arguments.page ) ) ) {
arguments.page = getCurrentPage();
@@ -2257,12 +2246,12 @@ component accessors="true" singleton threadSafe {
// get child pages
arguments.pageRecords = pageService.findPublishedContent(
- parent : page.getContentID(),
- showInMenu: true,
- siteID : site().getsiteID(),
- properties: "contentID,slug,title,numberOfChildren",
- sortOrder : "order ASC, publishedDate ASC"
- );
+ parent = page.getContentID(),
+ showInMenu = true,
+ siteID = site().getsiteID(),
+ properties = "contentID,slug,title",
+ sortOrder = "order ASC, publishedDate ASC"
+ );
// build it out
return buildMenu( argumentCollection = arguments );
@@ -2274,7 +2263,7 @@ component accessors="true" singleton threadSafe {
* @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
*/
- function linkToParentPage( page, text = "" ){
+ function linkToParentPage( page, text = "" ) {
// verify incoming page
if ( !structKeyExists( arguments, "page" ) ) {
arguments.page = getCurrentPage();
@@ -2282,7 +2271,10 @@ component accessors="true" singleton threadSafe {
// link if parent found.
if ( arguments.page.hasParent() ) {
if ( !len( arguments.text ) ) {
- arguments.text = arguments.page.getParent().getTitle();
+ arguments.text = arguments
+ .page
+ .getParent()
+ .getTitle();
}
// build link
return "#arguments.text# ";
@@ -2296,12 +2288,13 @@ component accessors="true" singleton threadSafe {
* @page Optional page to create link for, else look for current page
* @separator Breadcrumb separator, defaults to '>'
*/
- function breadCrumbs( any page, string separator = ">" ){
+ function breadCrumbs( any page, string separator = ">" ) {
// verify incoming page
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 *********************************************/
@@ -2309,14 +2302,14 @@ component accessors="true" singleton threadSafe {
/**
* Detects if the incoming request is from a mobile device or NOT.
*/
- boolean function isMobile(){
+ boolean function isMobile() {
return mobileDetector.isMobile();
}
/**
* Return the current system flash scope
*/
- any function getFlash(){
+ any function getFlash() {
return controller.getRequestService().getFlashScope();
}
@@ -2335,10 +2328,10 @@ component accessors="true" singleton threadSafe {
string locale,
any values,
string bundle
- ){
+ ) {
// check for resource@bundle convention:
if ( find( "@", arguments.resource ) ) {
- arguments.bundle = listLast( arguments.resource, "@" );
+ arguments.bundle = listLast( arguments.resource, "@" );
arguments.resource = listFirst( arguments.resource, "@" );
}
return variables.cbResourceService.getResource( argumentCollection = arguments );
@@ -2347,16 +2340,82 @@ component accessors="true" singleton threadSafe {
/**
* utility to strip HTML
*/
- function stripHTML( required stringTarget ){
- return encodeForHTML( reReplaceNoCase( arguments.stringTarget, "<[^>]*>", "", "ALL" ) );
+ function stripHTML( required stringTarget ) {
+ return encodeForHTML(
+ reReplaceNoCase(
+ arguments.stringTarget,
+ "<[^>]*>",
+ "",
+ "ALL"
+ )
+ );
}
/**
* removes CR LF TAB double spaces from string
*/
- function stripWhitespace( required stringTarget ){
- arguments.stringTarget = reReplace( arguments.stringTarget, "\s", " ", "ALL" );
- return trim( reReplace( arguments.stringTarget, "\s{2,}", " ", "ALL" ) );
+ function stripWhitespace( required stringTarget ) {
+ arguments.stringTarget = reReplace(
+ arguments.stringTarget,
+ "\s",
+ " ",
+ "ALL"
+ );
+ return trim(
+ reReplace(
+ arguments.stringTarget,
+ "\s{2,}",
+ " ",
+ "ALL"
+ )
+ );
+ }
+
+ /**
+ * Get the site URL separator depending if you have an entry point or not
+ */
+ private function sep() {
+ return "/";
+ }
+
+ /**
+ * Builds out a level of a custom menu
+ *
+ * @items An array of menu items for this level
+ * @listType The type of list to create (derived from owning menu)
+ * @slugCache The cache of menu slugs already used in this request
+ */
+ private string function buildProviderMenuLevel(
+ required array items,
+ required string listType = "ul",
+ required array slugCache = [],
+ string listClass = ""
+ ) {
+ var menuString = "";
+ // loop over items to build out level
+ for ( var item in arguments.items ) {
+ var extras = {
+ slugCache: arguments.slugCache,
+ listType : arguments.listType
+ };
+ // check that item can be added
+ if ( item.canDisplay( options = extras ) ) {
+ // get template from provider
+ menuString &= "#item.getProvider().getDisplayTemplate( item,
+ extras )#";
+ // if this menu item has children...
+ if ( item.hasChild() ) {
+ // recurse, recurse, recurse!
+ menuString &= "<#arguments.listType# class='#arguments.listClass#'>#buildProviderMenuLevel(
+ items = item.getChildren(),
+ listType = arguments.listType,
+ slugCache = arguments.slugCache
+ )##"#arguments.listType#>"#";
+ }
+ menuString &= " ";
+ }
+ }
+ return menuString;
}
/************************************** PRIVATE *********************************************/
@@ -2374,34 +2433,34 @@ component accessors="true" singleton threadSafe {
parentClass = "parent",
activeClass = "active",
activeShowChildren = false
- ){
+ ) {
// Levels = *, then create big enough integer
- if ( arguments.levels eq "*" ) {
+ if ( arguments.levels EQ "*" ) {
arguments.levels = "999999";
}
// check type?
if ( !reFindNoCase( "^(ul|ol|li|data|none)$", arguments.type ) ) {
arguments.type = "ul";
}
- var pageResults = arguments.pageRecords;
+ var pageResults = arguments.pageRecords;
// buffer
- var b = createObject( "java", "java.lang.StringBuilder" ).init( "" );
+ var b = createObject( "java", "java.lang.StringBuilder" ).init( "" );
// current page?
- var prc = getRequestCollection( private = true );
+ var prc = getRequestCollection( private = true );
var pageAncestorContentIDs = "";
- var locPage = "";
+ var locPage = "";
// class text
- var classtext = [];
- var currentPageID = 0;
+ var classtext = [];
+ var currentPageID = 0;
// Get contentID
- if ( structKeyExists( prc, "page" ) and prc.page.isLoaded() ) {
- locPage = getCurrentPage();
- currentPageID = locPage.getContentID();
+ if ( structKeyExists( prc, "page" ) && prc.page.isLoaded() ) {
+ locPage = getCurrentPage();
+ currentPageID = locPage.getContentID();
pageAncestorContentIDs = locPage.getContentID();
// If this is subnav, add ancestry trail
while ( locPage.hasParent() ) {
- locPage = locPage.getParent();
+ locPage = locPage.getParent();
pageAncestorContentIDs = listAppend( pageAncestorContentIDs, locPage.getContentID() );
}
}
@@ -2411,25 +2470,28 @@ component accessors="true" singleton threadSafe {
b.append( "<#arguments.type# class=""#arguments.typeClass#"">" );
}
// data setup
- if ( arguments.type eq "data" ) {
+ if ( arguments.type EQ "data" ) {
var dataMenu = [];
}
// Iterate through pages and create sub menus
- for ( var x = 1; x lte pageResults.count; x++ ) {
+ for ( var x = 1; x LTE pageResults.count; x++ ) {
// Build up the element class into the current classText array list
if ( isSimpleValue( arguments.elementClass ) ) {
arguments.elementClass = listToArray( arguments.elementClass );
}
classText = duplicate( arguments.elementClass );
- if ( !len( arguments.excludes ) OR !listFindNoCase( arguments.excludes, pageResults.content[ x ][ "title" ] ) ) {
- // Do we need to nest?
+ if (
+ !len( arguments.excludes ) || !listFindNoCase( arguments.excludes, pageResults.content[ x ][ "title" ] )
+ ) {
+ // Do we need to nest? Check if page has children by fetching the entity
+ var thisPage = pageService.get( pageResults.content[ x ][ "contentID" ] );
var doNesting = (
- arguments.currentLevel lt arguments.levels AND pageResults.content[ x ][ "numberOfChildren" ] > 0
+ arguments.currentLevel LT arguments.levels && !isNull( thisPage ) && thisPage.hasChild()
);
// Is element active (or one of its decendants)
- var isElementActive = currentPageID eq pageResults.content[ x ][ "contentID" ];
+ var isElementActive = currentPageID EQ pageResults.content[ x ][ "contentID" ];
var isElementActiveAncestor = (
listFindNoCase( pageAncestorContentIDs, pageResults.content[ x ][ "contentID" ] )
);
@@ -2439,89 +2501,91 @@ component accessors="true" singleton threadSafe {
}
// list
- if ( arguments.type neq "none" and arguments.type neq "data" ) {
+ if ( arguments.type NEQ "none" && arguments.type NEQ "data" ) {
// Nested Levels?
if ( doNesting ) {
// Setup Parent class, we are going down the wormhole
arrayAppend( classText, arguments.parentClass );
// Start Embedded List
b.append(
- "#pageResults.content[ x ][ "title" ]# "
- );
+ "#pageResults.content[ x ][ "title" ]# "
+ );
// If type is "li" then guess to do a nested ul list
b.append(
- buildMenu(
- pageRecords = pageService.findPublishedContent(
- parent : pageResults.content[ x ][ "contentID" ],
- showInMenu: true,
- siteID : site().getsiteID(),
- properties: "contentID,slug,title,numberOfChildren",
- sortOrder : "order ASC, publishedDate ASC"
- ),
- excludes = arguments.excludes,
- type = ( arguments.type eq "li" ? "ul" : arguments.type ),
- typeClass = arguments.typeClass,
- elementClass = arguments.elementClass,
- showNone = arguments.showNone,
- levels = arguments.levels,
- currentLevel = arguments.currentLevel + 1,
- activeShowChildren = arguments.activeShowChildren
- )
- );
- }
- // Do we nest active and activeShowChildren flag is activated?
- else if (
- activeShowChildren AND ( isElementActive OR isElementActiveAncestor ) AND pageResults.content[ x ].hasChild()
+ buildMenu(
+ pageRecords = pageService.findPublishedContent(
+ parent = pageResults.content[ x ][ "contentID" ],
+ showInMenu = true,
+ siteID = site().getsiteID(),
+ properties = "contentID,slug,title",
+ sortOrder = "order ASC, publishedDate ASC"
+ ),
+ excludes = arguments.excludes,
+ type = ( arguments.type EQ "li" ? "ul" : arguments.type ),
+ typeClass = arguments.typeClass,
+ elementClass = arguments.elementClass,
+ showNone = arguments.showNone,
+ levels = arguments.levels,
+ currentLevel = arguments.currentLevel + 1,
+ activeShowChildren = arguments.activeShowChildren
+ )
+ );
+ } else if (
+ activeShowChildren && ( isElementActive || isElementActiveAncestor ) &&
+ pageResults.content[ x ].hasChild()
) {
// Setup Parent class, we are going down the wormhole
arrayAppend( classText, arguments.parentClass );
// Start Embedded List
b.append(
- "#pageResults.content[ x ][ "title" ]# "
- );
+ "#pageResults.content[ x ][ "title" ]# "
+ );
// If type is "li" then guess to do a nested ul list
b.append(
- buildMenu(
- pageRecords = pageService.findPublishedContent(
- parent : pageResults.content[ x ][ "contentID" ],
- showInMenu: true,
- siteID : site().getsiteID(),
- properties: "contentID,slug,title,numberOfChildren",
- sortOrder : "order ASC, publishedDate ASC"
- ),
- excludes = arguments.excludes,
- type = ( arguments.type eq "li" ? "ul" : arguments.type ),
- typeClass = arguments.typeClass,
- showNone = arguments.showNone,
- levels = 1,
- elementClass = arguments.elementClass,
- currentLevel = arguments.currentLevel + 1,
- activeShowChildren = activeShowChildren
- )
- );
+ buildMenu(
+ pageRecords = pageService.findPublishedContent(
+ parent = pageResults.content[ x ][ "contentID" ],
+ showInMenu = true,
+ siteID = site().getsiteID(),
+ properties = "contentID,slug,title",
+ sortOrder = "order ASC, publishedDate ASC"
+ ),
+ excludes = arguments.excludes,
+ type = ( arguments.type EQ "li" ? "ul" : arguments.type ),
+ typeClass = arguments.typeClass,
+ showNone = arguments.showNone,
+ levels = 1,
+ elementClass = arguments.elementClass,
+ currentLevel = arguments.currentLevel + 1,
+ activeShowChildren = activeShowChildren
+ )
+ );
} else {
// Start Embedded List
b.append(
- "#pageResults.content[ x ][ "title" ]# "
- );
+ "#pageResults.content[ x ][ "title" ]# "
+ );
}
// Close it
b.append( " " );
- } else if ( arguments.type eq "data" ) {
+ } else if ( arguments.type EQ "data" ) {
var pageData = {
- title : pageResults.content[ x ][ "title" ],
- link : linkPageWithSlug( pageResults.content[ x ][ "slug" ] )
+ title: pageResults.content[ x ][ "title" ],
+ link : linkPageWithSlug( pageResults.content[ x ][ "slug" ] )
};
if ( doNesting ) {
pageData.subPageMenu = buildMenu(
- pageRecords = pageService.findPublishedContent(
- parent : pageResults.content[ x ][ "contentID" ],
- showInMenu: true,
- siteID : site().getsiteID(),
- properties: "contentID,slug,title,numberOfChildren",
- sortOrder : "order ASC, publishedDate ASC"
- ),
+ pageRecords = pageService.findPublishedContent(
+ parent = pageResults.content[ x ][ "contentID" ],
+ showInMenu = true,
+ siteID = site().getsiteID(),
+ properties = "contentID,slug,title",
+ sortOrder = "order ASC, publishedDate ASC"
+ ),
excludes = arguments.excludes,
type = arguments.type,
typeClass = arguments.typeClass,
@@ -2531,19 +2595,15 @@ component accessors="true" singleton threadSafe {
currentLevel = arguments.currentLevel + 1,
activeShowChildren = arguments.activeShowChildren
);
- }
- // Do we nest active and activeShowChildren flag is activated?
- else if (
- activeShowChildren AND isElementActive AND pageResults.content[ x ][ "numberOfChildren" ] > 0
- ) {
+ } else if ( activeShowChildren && isElementActive && !isNull( thisPage ) && thisPage.hasChild() ) {
pageData.subPageMenu = buildMenu(
- pageRecords = pageService.findPublishedContent(
- parent : pageResults.content[ x ][ "contentID" ],
- showInMenu: true,
- siteID : site().getsiteID(),
- properties: "contentID,slug,title,numberOfChildren",
- sortOrder : "order ASC, publishedDate ASC"
- ),
+ pageRecords = pageService.findPublishedContent(
+ parent = pageResults.content[ x ][ "contentID" ],
+ showInMenu = true,
+ siteID = site().getsiteID(),
+ properties = "contentID,slug,title",
+ sortOrder = "order ASC, publishedDate ASC"
+ ),
excludes = arguments.excludes,
type = arguments.type,
typeClass = arguments.typeClass,
@@ -2557,18 +2617,19 @@ component accessors="true" singleton threadSafe {
arrayAppend( dataMenu, pageData );
} else {
b.append(
- "#pageResults.content[ x ][ "title" ]# #arguments.separator#"
- );
+ "#pageResults.content[ x ][ "title" ]# #arguments.separator#"
+ );
}
}
}
- if ( arguments.type eq "data" ) {
+ if ( arguments.type EQ "data" ) {
return dataMenu;
}
// None?
- if ( pageResults.count eq 0 and arguments.showNone ) {
+ if ( pageResults.count EQ 0 && arguments.showNone ) {
b.append( "No Sub Pages " );
}
@@ -2581,4 +2642,4 @@ component accessors="true" singleton threadSafe {
return b.toString();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/EmailTemplateHelper.cfc b/modules/contentbox/models/system/EmailTemplateHelper.cfc
index d7c101cce5..05321de3d0 100644
--- a/modules/contentbox/models/system/EmailTemplateHelper.cfc
+++ b/modules/contentbox/models/system/EmailTemplateHelper.cfc
@@ -6,20 +6,19 @@
* A helper to create standard email template sections
*/
component singleton {
-
// DI
property name="avatar" inject="Avatar@contentbox";
/**
- * Constructor
+ * Constructor
*/
- EmailTemplateHelper function init(){
+ EmailTemplateHelper function init() {
// Return instance
return this;
}
- public string function author( required string email, required string content ){
- var gravatar = variables.avatar.renderAvatar( email = arguments.email, size = 40 );
+ public string function author( required string email, required string content ) {
+ var gravatar = variables.avatar.renderAvatar( email = arguments.email, size = 40 );
savecontent variable="authorContent" {
writeOutput(
text(
@@ -56,31 +55,33 @@ component singleton {
required string borderColor = "DDDDDD",
required string borderStyle = "solid",
required numeric borderWidth = 1
- ){
+ ) {
// cfformat-ignore-start
- savecontent variable="dividerContent" {
- writeoutput('
-
- ');
- }
+ savecontent variable="dividerContent" {
+writeoutput(
+"
+
+ "
+);
+}
// cfformat-ignore-end
-return dividerContent;
+ return dividerContent;
}
/**
@@ -96,19 +97,19 @@ return dividerContent;
required string level = "h2",
required string color = "777",
required numeric fontSize = 20
- ){
+ ) {
// cfformat-ignore-start
- savecontent variable="headingContent" {
- writeoutput('
- <#arguments.level# style="color: ###arguments.color#; display: block; font-family: Helvetica; font-size: #arguments.fontSize#px; font-style: normal; font-weight: bold; line-height: 110%; letter-spacing: normal; margin: 0; margin-bottom: 9px; text-align: left">
- #arguments.content#
- #arguments.level#>
- ');
- }
+ savecontent variable="headingContent" {
+writeoutput(
+"
+ <#arguments.level# style=""color: ###arguments.color#; display: block; font-family: Helvetica; font-size: #arguments.fontSize#px; font-style: normal; font-weight: bold; line-height: 110%; letter-spacing: normal; margin: 0; margin-bottom: 9px; text-align: left"">
+ #arguments.content#
+ #arguments.level#>
+ "
+);
+}
// cfformat-ignore-end
-return text(
- headingContent
- );
+ return text( headingContent );
}
/**
@@ -117,41 +118,50 @@ return text(
* @content.hint Content for the text area
* @callout.hint If true, will wrap content in a callout box
*/
- public string function text( required string content, required boolean callout = false ){
+ public string function text(
+ required string content,
+ required boolean callout = false
+ ) {
// cfformat-ignore-start
- savecontent variable="textContent" {
- writeoutput('
-
-
-
-
-
-
-
-
- ');
- if( arguments.callout ) {
- writeoutput( '
-
- ');
- }
- writeoutput( '#arguments.content#' );
- if( arguments.callout ) {
- writeoutput( '
' );
- }
- writeoutput('
-
-
-
-
-
-
-
-
- ');
- }
+ savecontent variable="textContent" {
+writeoutput(
+"
+
+
+
+
+
+
+
+
+ "
+);
+if ( arguments.callout ) {
+writeoutput(
+"
+
+ "
+);
+}
+writeoutput( "#arguments.content#" );
+if ( arguments.callout ) {
+writeoutput( "
" );
+}
+writeoutput(
+"
+
+
+
+
+
+
+
+
+ "
+);
+}
// cfformat-ignore-end
-return textContent;
+ return textContent;
}
/**
@@ -159,69 +169,85 @@ return textContent;
*
* @buttons.hint Array of buttons to add to the button bar
*/
- public string function buttonBar( required Array buttons ){
+ public string function buttonBar( required Array buttons ) {
// cfformat-ignore-start
- savecontent variable="buttonBarContent" {
- writeoutput('
- #divider( 18, 18, 5, 18 )#
-
- #divider( 0, 18, 18, 18 )#
- ');
- }
+ savecontent variable="buttonBarContent" {
+writeoutput(
+"
+ #divider(
+18,
+18,
+5,
+18
+)#
+
+
+
+
+
+
+
+
+
+
+
+
+ "
+);
+// loop over buttons
+for ( var button in arguments.buttons ) {
+writeoutput(
+"
+
+
+ "
+);
+}
+// close off bar
+writeoutput(
+"
+
+
+
+
+
+
+
+
+
+
+
+
+ #divider(
+0,
+18,
+18,
+18
+)#
+ "
+);
+}
// cfformat-ignore-end
-return buttonBarContent;
+ return buttonBarContent;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/EmailTemplateService.cfc b/modules/contentbox/models/system/EmailTemplateService.cfc
index 73399e4614..d763c7ca2f 100644
--- a/modules/contentbox/models/system/EmailTemplateService.cfc
+++ b/modules/contentbox/models/system/EmailTemplateService.cfc
@@ -1,37 +1,37 @@
-/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-* Manage the system's email templates for admin purposes
-*/
+/**
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * Manage the system's email templates for admin purposes
+ */
component accessors="true" singleton {
-
// Dependecnies
property name="moduleSettings" inject="coldbox:setting:modules";
+
property name="log" inject="logbox:logger:{this}";
// Local properties
property name="templatesPath" type="string";
- EmailTemplateService function init(){
+ EmailTemplateService function init() {
templatesPath = "";
return this;
}
@@ -39,21 +39,21 @@ component accessors="true" singleton {
/**
* onDIComplete
*/
- function onDIComplete(){
+ function onDIComplete() {
setTemplatesPath( moduleSettings[ "contentbox" ].path & "/email_templates" );
}
/**
* Check if template exists
*/
- boolean function templateExists( required string name ){
+ boolean function templateExists( required string name ) {
return fileExists( getTemplatesPath() & "/#arguments.name#.cfm" );
}
/**
* Get installed templates
*/
- query function getTemplates(){
+ query function getTemplates() {
var templates = directoryList(
getTemplatesPath(),
false,
@@ -64,4 +64,4 @@ component accessors="true" singleton {
return templates;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/EventHandler.cfc b/modules/contentbox/models/system/EventHandler.cfc
index daee5cfc02..e0ce9cc119 100644
--- a/modules/contentbox/models/system/EventHandler.cfc
+++ b/modules/contentbox/models/system/EventHandler.cfc
@@ -1,37 +1,36 @@
/**
-********************************************************************************
-ContentBox - A Modular Content Platform
-Copyright 2012 by Luis Majano and Ortus Solutions, Corp
-www.ortussolutions.com
-********************************************************************************
-Apache License, Version 2.0
-
-Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
-
-Licensed under the Apache License, Version 2.0 (the "License" );
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-********************************************************************************
-********************************************************************************
-Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
-www.coldbox.org | www.luismajano.com | www.ortussolutions.com
-********************************************************************************
-
-Author : Luis Majano
-Date : 10/16/2007
-Description :
- A ColdBox Enabled Hibernate Event Handler that ties to the ColdBox proxy for ColdBox Operations.
-
-*/
+ * ********************************************************************************
+ * ContentBox - A Modular Content Platform
+ * Copyright 2012 by Luis Majano and Ortus Solutions, Corp
+ * www.ortussolutions.com
+ * ********************************************************************************
+ * Apache License, Version 2.0
+ *
+ * Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License" );
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ********************************************************************************
+ * ********************************************************************************
+ * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
+ * www.coldbox.org | www.luismajano.com | www.ortussolutions.com
+ * ********************************************************************************
+ *
+ * Author : Luis Majano
+ * Date : 10/16/2007
+ * Description :
+ * A ColdBox Enabled Hibernate Event Handler that ties to the ColdBox proxy for ColdBox Operations.
+ *
+ */
component extends="cborm.models.EventHandler" {
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/NotificationService.cfc b/modules/contentbox/models/system/NotificationService.cfc
index 4e0bff9b0d..1a79fe1599 100755
--- a/modules/contentbox/models/system/NotificationService.cfc
+++ b/modules/contentbox/models/system/NotificationService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,20 +10,25 @@
* - Page Saving and removals
* - ContentStore saving and removals
*/
-component extends="coldbox.system.Interceptor" accessors="true" {
-
+component extends ="coldbox.system.Interceptor" accessors="true" {
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="securityService" inject="securityService@contentbox";
+
property name="mailService" inject="mailService@cbmailservices";
+
property name="renderer" inject="coldbox:renderer";
+
property name="CBHelper" inject="CBHelper@contentbox";
/**
* Configure the Service
*/
- function configure(){
+ function configure() {
+
}
/**
@@ -33,54 +38,54 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_postNewAuthorSave( event, data, buffer ){
- var author = arguments.data.author;
+ function cbadmin_postNewAuthorSave( event, data, buffer ) {
+ var author = arguments.data.author;
var settings = variables.settingService.getAllSettings();
// Only new authors are announced, not updates, and also verify author notifications are online.
- if ( NOT settings.cb_notify_author ) {
+ if ( !settings.cb_notify_author ) {
return;
}
// get current logged in author performing the action
var currentAuthor = variables.securityService.getAuthorSession();
- var defaultSite = variables.siteService.getDefaultSite();
+ var defaultSite = variables.siteService.getDefaultSite();
// get mail payload
var bodyTokens = {
- authorName : author.getFullName(),
- authorRole : author.getRole().getRole(),
- permissionGroups : author.getPermissionGroupsList(),
- authorEmail : author.getEmail(),
- authorURL : CBHelper.linkAdmin(
- event = "authors.editor.authorID.#author.getAuthorID()#",
- ssl = settings.cb_admin_ssl
- ),
- currentAuthor : currentauthor.getFullName(),
- currentAuthorEmail : currentAuthor.getEmail()
+ authorName : author.getFullName(),
+ authorRole : author.getRole().getRole(),
+ permissionGroups: author.getPermissionGroupsList(),
+ authorEmail : author.getEmail(),
+ authorURL : CBHelper.linkAdmin(
+ event = "authors.editor.authorID.#author.getAuthorID()#",
+ ssl = settings.cb_admin_ssl
+ ),
+ currentAuthor : currentauthor.getFullName(),
+ currentAuthorEmail: currentAuthor.getEmail()
};
var mail = variables.mailservice.newMail(
- to = settings.cb_site_email,
- from = settings.cb_site_outgoingEmail,
- subject = "#defaultSite.getName()# - Author Created - #bodyTokens.authorName#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = settings.cb_site_email,
+ from = settings.cb_site_outgoingEmail,
+ subject = "#defaultSite.getName()# - Author Created - #bodyTokens.authorName#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/author_new",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/author_new",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -93,50 +98,50 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_preAuthorRemove( event, data, buffer ){
- var author = arguments.data.author;
+ function cbadmin_preAuthorRemove( event, data, buffer ) {
+ var author = arguments.data.author;
// Get settings
var settings = variables.settingService.getAllSettings();
// Only notify when enabled.
- if ( NOT settings.cb_notify_author ) {
+ if ( !settings.cb_notify_author ) {
return;
}
// get current logged in author performing the action
var currentAuthor = variables.securityService.getAuthorSession();
- var defaultSite = variables.siteService.getDefaultSite();
+ var defaultSite = variables.siteService.getDefaultSite();
// get mail payload
var bodyTokens = {
- authorName : author.getFullName(),
- authorRole : author.getRole().getRole(),
- authorEmail : author.getEmail(),
- currentAuthor : currentauthor.getFullName(),
- currentAuthorEmail : currentAuthor.getEmail()
+ authorName : author.getFullName(),
+ authorRole : author.getRole().getRole(),
+ authorEmail : author.getEmail(),
+ currentAuthor : currentauthor.getFullName(),
+ currentAuthorEmail: currentAuthor.getEmail()
};
var mail = variables.mailservice.newMail(
- to = settings.cb_site_email,
- from = settings.cb_site_outgoingEmail,
- subject = "#defaultSite.getName()# - Author Removed - #bodyTokens.authorName#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = settings.cb_site_email,
+ from = settings.cb_site_outgoingEmail,
+ subject = "#defaultSite.getName()# - Author Removed - #bodyTokens.authorName#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/author_remove",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/author_remove",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
}
@@ -148,15 +153,15 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_postEntrySave( event, data, buffer ){
+ function cbadmin_postEntrySave( event, data, buffer ) {
// Only new entries are announced, not updates, and also verify entry notifications are online.
- if ( NOT arguments.data.isNew ) {
+ if ( !arguments.data.isNew ) {
return;
}
// Setup the entry + site
- var entry = arguments.data.content;
- var site = entry.getSite();
+ var entry = arguments.data.content;
+ var site = entry.getSite();
var settings = variables.settingService.getAllSettings();
// Only notify when enabled.
@@ -169,14 +174,14 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// get mail payload
var bodyTokens = {
- entryTitle : entry.getTitle(),
- entryExcerpt : "",
- entryURL : CBHelper.linkEntry( entry = entry, ssl = site.getIsSSL() ),
- entryAuthor : currentauthor.getFullName(),
- entryAuthorEmail : currentAuthor.getEmail(),
- entryIsPublished : entry.getIsPublished(),
- entryPublishedDate : entry.getDisplayPublishedDate(),
- entryExpireDate : entry.getDisplayExpireDate()
+ entryTitle : entry.getTitle(),
+ entryExcerpt : "",
+ entryURL : CBHelper.linkEntry( entry = entry, ssl = site.getIsSSL() ),
+ entryAuthor : currentauthor.getFullName(),
+ entryAuthorEmail : currentAuthor.getEmail(),
+ entryIsPublished : entry.getIsPublished(),
+ entryPublishedDate: entry.getDisplayPublishedDate(),
+ entryExpireDate : entry.getDisplayExpireDate()
};
if ( entry.hasExcerpt() ) {
@@ -186,27 +191,27 @@ component extends="coldbox.system.Interceptor" accessors="true" {
}
var mail = variables.mailservice.newMail(
- to : getNotifiers( site, settings ),
- from : settings.cb_site_outgoingEmail,
- subject : "#site.getName()# - Blog Entry Created - #bodyTokens.entryTitle#",
- bodyTokens: bodyTokens,
- type : "html",
- server : settings.cb_site_mail_server,
- username : settings.cb_site_mail_username,
- password : settings.cb_site_mail_password,
- port : settings.cb_site_mail_smtp,
- useTLS : settings.cb_site_mail_tls,
- useSSL : settings.cb_site_mail_ssl
- );
+ to = getNotifiers( site, settings ),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# - Blog Entry Created - #bodyTokens.entryTitle#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/entry_new",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/entry_new",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -219,9 +224,9 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_preEntryRemove( event, data, buffer ){
- var entry = arguments.data.content;
- var site = entry.getSite();
+ function cbadmin_preEntryRemove( event, data, buffer ) {
+ var entry = arguments.data.content;
+ var site = entry.getSite();
// Get settings
var settings = variables.settingService.getAllSettings();
@@ -235,11 +240,11 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// get mail payload
var bodyTokens = {
- entryTitle : entry.getTitle(),
- entryExcerpt : "",
- entryURL : CBHelper.linkEntry( entry = entry, ssl = site.getIsSSL() ),
- entryAuthor : currentauthor.getFullName(),
- entryAuthorEmail : currentAuthor.getEmail()
+ entryTitle : entry.getTitle(),
+ entryExcerpt : "",
+ entryURL : CBHelper.linkEntry( entry = entry, ssl = site.getIsSSL() ),
+ entryAuthor : currentauthor.getFullName(),
+ entryAuthorEmail: currentAuthor.getEmail()
};
if ( entry.hasExcerpt() ) {
bodyTokens.entryExcerpt = entry.renderExcerpt();
@@ -248,27 +253,27 @@ component extends="coldbox.system.Interceptor" accessors="true" {
}
var mail = variables.mailservice.newMail(
- to = getNotifiers( site, settings ),
- from = settings.cb_site_outgoingEmail,
- subject = "#site.getName()# - Entry Removed - #bodyTokens.entryTitle#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = getNotifiers( site, settings ),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# - Entry Removed - #bodyTokens.entryTitle#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/entry_remove",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/entry_remove",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
}
@@ -280,14 +285,14 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_postPageSave( event, data, buffer ){
+ function cbadmin_postPageSave( event, data, buffer ) {
// Only new pages are announced, not updates, and also verify page notifications are online.
- if ( NOT arguments.data.isNew ) {
+ if ( !arguments.data.isNew ) {
return;
}
- var page = arguments.data.content;
- var site = page.getSite();
+ var page = arguments.data.content;
+ var site = page.getSite();
var settings = variables.settingService.getAllSettings();
// Only notify when enabled.
@@ -300,13 +305,13 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// get mail payload
var bodyTokens = {
- pageTitle : page.getTitle(),
- pageURL : CBHelper.linkPage( page = page, ssl = site.getIsSSL() ),
- pageAuthor : currentauthor.getFullName(),
- pageAuthorEmail : currentAuthor.getEmail(),
- pageIsPublished : page.getIsPublished(),
- pagePublishedDate : page.getDisplayPublishedDate(),
- pageExpireDate : page.getDisplayExpireDate()
+ pageTitle : page.getTitle(),
+ pageURL : CBHelper.linkPage( page = page, ssl = site.getIsSSL() ),
+ pageAuthor : currentauthor.getFullName(),
+ pageAuthorEmail : currentAuthor.getEmail(),
+ pageIsPublished : page.getIsPublished(),
+ pagePublishedDate: page.getDisplayPublishedDate(),
+ pageExpireDate : page.getDisplayExpireDate()
};
if ( page.hasExcerpt() ) {
@@ -316,27 +321,27 @@ component extends="coldbox.system.Interceptor" accessors="true" {
}
var mail = variables.mailservice.newMail(
- to = getNotifiers( site, settings ),
- from = settings.cb_site_outgoingEmail,
- subject = "#site.getName()# - Page Created - #bodyTokens.pageTitle#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = getNotifiers( site, settings ),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# - Page Created - #bodyTokens.pageTitle#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/page_new",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/page_new",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -349,9 +354,9 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_prePageRemove( event, data, buffer ){
- var page = arguments.data.content;
- var site = page.getSite();
+ function cbadmin_prePageRemove( event, data, buffer ) {
+ var page = arguments.data.content;
+ var site = page.getSite();
// Get settings
var settings = variables.settingService.getAllSettings();
@@ -365,11 +370,11 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// get mail payload
var bodyTokens = {
- pageTitle : page.getTitle(),
- pageExcerpt : "",
- pageURL : CBHelper.linkPage( page = page, ssl = site.getIsSSL() ),
- pageAuthor : currentauthor.getFullName(),
- pageAuthorEmail : currentAuthor.getEmail()
+ pageTitle : page.getTitle(),
+ pageExcerpt : "",
+ pageURL : CBHelper.linkPage( page = page, ssl = site.getIsSSL() ),
+ pageAuthor : currentauthor.getFullName(),
+ pageAuthorEmail: currentAuthor.getEmail()
};
if ( page.hasExcerpt() ) {
bodyTokens.pageExcerpt = page.renderExcerpt();
@@ -378,27 +383,27 @@ component extends="coldbox.system.Interceptor" accessors="true" {
}
var mail = variables.mailservice.newMail(
- to = getNotifiers( site, settings ),
- from = settings.cb_site_outgoingEmail,
- subject = "#site.getName()# - Page Removed - #bodyTokens.pageTitle#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = getNotifiers( site, settings ),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# - Page Removed - #bodyTokens.pageTitle#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/page_remove",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/page_remove",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -411,14 +416,14 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_postContentStoreSave( event, data, buffer ){
+ function cbadmin_postContentStoreSave( event, data, buffer ) {
// Only new pages are announced, not updates
- if ( NOT arguments.data.isNew ) {
+ if ( !arguments.data.isNew ) {
return;
}
- var content = arguments.data.content;
- var site = content.getSite();
+ var content = arguments.data.content;
+ var site = content.getSite();
var settings = variables.settingService.getAllSettings();
// Only notify when enabled.
@@ -431,42 +436,42 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// get mail payload
var bodyTokens = {
- contentTitle : content.getTitle(),
- contentDescription : content.getDescription(),
- contentAuthor : currentauthor.getFullName(),
- contentAuthorEmail : currentAuthor.getEmail(),
- contentIsPublished : content.getIsPublished(),
- contentPublishedDate : content.getDisplayPublishedDate(),
- contentExpireDate : content.getDisplayExpireDate(),
- contentURL : arguments.event.buildLink(
- to = "#CBHelper.adminRoot()#.contentStore.export/contentID/#content.getContentID()#",
- ssl = settings.cb_admin_ssl
- ),
- contentExcerpt : content.renderContentSilent( content.getActiveContent().getContent() )
+ contentTitle : content.getTitle(),
+ contentDescription : content.getDescription(),
+ contentAuthor : currentauthor.getFullName(),
+ contentAuthorEmail : currentAuthor.getEmail(),
+ contentIsPublished : content.getIsPublished(),
+ contentPublishedDate: content.getDisplayPublishedDate(),
+ contentExpireDate : content.getDisplayExpireDate(),
+ contentURL : arguments.event.buildLink(
+ to = "#CBHelper.adminRoot()#.contentStore.export/contentID/#content.getContentID()#",
+ ssl = settings.cb_admin_ssl
+ ),
+ contentExcerpt: content.renderContentSilent( content.getActiveContent().getContent() )
};
var mail = variables.mailservice.newMail(
- to = getNotifiers( site, settings ),
- from = settings.cb_site_outgoingEmail,
- subject = "#site.getName()# - ContentStore Created - #bodyTokens.contentTitle#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = getNotifiers( site, settings ),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# - ContentStore Created - #bodyTokens.contentTitle#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/contentstore_new",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/contentstore_new",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -479,9 +484,9 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @data Intercept Data
* @buffer Output buffer
*/
- function cbadmin_preContentStoreRemove( event, data, buffer ){
- var content = arguments.data.content;
- var site = content.getSite();
+ function cbadmin_preContentStoreRemove( event, data, buffer ) {
+ var content = arguments.data.content;
+ var site = content.getSite();
// Get settings
var settings = variables.settingService.getAllSettings();
@@ -495,42 +500,42 @@ component extends="coldbox.system.Interceptor" accessors="true" {
// get mail payload
var bodyTokens = {
- contentTitle : content.getTitle(),
- contentDescription : content.getDescription(),
- contentAuthor : currentauthor.getFullName(),
- contentAuthorEmail : currentAuthor.getEmail(),
- contentIsPublished : content.getIsPublished(),
- contentPublishedDate : content.getDisplayPublishedDate(),
- contentExpireDate : content.getDisplayExpireDate(),
- contentURL : arguments.event.buildLink(
- to = "#CBHelper.adminRoot()#.contentStore.export/contentID/#content.getContentID()#",
- ssl = settings.cb_admin_ssl
- ),
- contentExcerpt : content.renderContentSilent( content.getActiveContent().getContent() )
+ contentTitle : content.getTitle(),
+ contentDescription : content.getDescription(),
+ contentAuthor : currentauthor.getFullName(),
+ contentAuthorEmail : currentAuthor.getEmail(),
+ contentIsPublished : content.getIsPublished(),
+ contentPublishedDate: content.getDisplayPublishedDate(),
+ contentExpireDate : content.getDisplayExpireDate(),
+ contentURL : arguments.event.buildLink(
+ to = "#CBHelper.adminRoot()#.contentStore.export/contentID/#content.getContentID()#",
+ ssl = settings.cb_admin_ssl
+ ),
+ contentExcerpt: content.renderContentSilent( content.getActiveContent().getContent() )
};
var mail = variables.mailservice.newMail(
- to = getNotifiers( site, settings ),
- from = settings.cb_site_outgoingEmail,
- subject = "#site.getName()# - ContentStore Removed - #bodyTokens.contentTitle#",
- bodyTokens = bodyTokens,
- type = "html",
- server = settings.cb_site_mail_server,
- username = settings.cb_site_mail_username,
- password = settings.cb_site_mail_password,
- port = settings.cb_site_mail_smtp,
- useTLS = settings.cb_site_mail_tls,
- useSSL = settings.cb_site_mail_ssl
- );
+ to = getNotifiers( site, settings ),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# - ContentStore Removed - #bodyTokens.contentTitle#",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
// generate content for email from template
mail.setBody(
- renderer.layout(
- view = "/contentbox/email_templates/contentstore_remove",
- layout = "/contentbox/email_templates/layouts/email",
- args = { gravatarEmail : currentAuthor.getEmail() }
- )
- );
+ renderer.layout(
+ view = "/contentbox/email_templates/contentstore_remove",
+ layout = "/contentbox/email_templates/layouts/email",
+ args = { gravatarEmail: currentAuthor.getEmail() }
+ )
+ );
// send it out
variables.mailService.send( mail );
@@ -542,7 +547,7 @@ component extends="coldbox.system.Interceptor" accessors="true" {
* @site The site the notification is from
* @settings The global settings
*/
- private function getNotifiers( required site, required settings ){
+ private function getNotifiers( required site, required settings ) {
var notifiers = "";
// Site Notifiers
if ( arguments.site.getNotifyOnEntries() ) {
@@ -555,4 +560,4 @@ component extends="coldbox.system.Interceptor" accessors="true" {
return notifiers;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/Setting.cfc b/modules/contentbox/models/system/Setting.cfc
index 8a18a948e3..eb8af843e0 100755
--- a/modules/contentbox/models/system/Setting.cfc
+++ b/modules/contentbox/models/system/Setting.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -15,77 +15,67 @@ component
cachename ="cbSetting"
cacheuse ="read-write"
{
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
property
- name ="settingID"
- column ="settingID"
+ name="settingID"
+ column="settingID"
fieldtype="id"
generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
+ length="36"
+ ormtype="string"
+ update="false";
- property
- name ="name"
- column ="name"
- notnull="true"
- length ="100";
+ property name="name" column="name" notnull="true" length="100";
- property
- name ="value"
- column ="value"
- notnull="true"
- ormtype="text";
+ property name="value" column="value" notnull="true" ormtype="text";
property
- name ="isCore"
- column ="isCore"
+ name="isCore"
+ column="isCore"
ormtype="boolean"
notnull="true"
default="false"
- index ="idx_core";
+ index="idx_core";
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
// M20 -> The site this setting belongs to
property
- name ="site"
- notnull ="false"
- cfc ="contentbox.models.system.Site"
+ name="site"
+ notnull="false"
+ cfc="contentbox.models.system.Site"
fieldtype="many-to-one"
- fkcolumn ="FK_siteID"
- lazy ="true";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + Memento
- ********************************************************************* */
+ fkcolumn="FK_siteID"
+ lazy="true";
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + Memento
+ **********************************************************************/
this.pk = "settingID";
this.constraints = {
- "name" : { required : true, size : "1..100" },
- "value" : { required : true }
+ "name" : { required: true, size: "1..100" },
+ "value": { required: true }
};
this.memento = {
- defaultIncludes : [ "name", "value", "isCore", "siteSnapshot:site" ],
- defaultExcludes : [ "site" ]
+ defaultIncludes: [ "name", "value", "isCore", "siteSnapshot:site"],
+ defaultExcludes: [ "site"]
};
- /* *********************************************************************
- ** PUBLIC METHODS
- ********************************************************************* */
+ /**********************************************************************
+ * ** PUBLIC METHODS
+ **********************************************************************/
/**
* Constructor
*/
- function init(){
+ function init() {
variables.isCore = false;
super.init();
@@ -96,7 +86,7 @@ component
/**
* Build a site snapshot
*/
- struct function getSiteSnapshot(){
+ struct function getSiteSnapshot() {
return ( hasSite() ? getSite().getInfoSnapshot() : {} );
}
@@ -105,11 +95,11 @@ component
*
* @return The associated site id or empty if none
*/
- function getSiteID(){
+ function getSiteID() {
if ( hasSite() ) {
return getSite().getsiteID();
}
return "";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/SettingService.cfc b/modules/contentbox/models/system/SettingService.cfc
index 00760f57b6..925468e1c2 100755
--- a/modules/contentbox/models/system/SettingService.cfc
+++ b/modules/contentbox/models/system/SettingService.cfc
@@ -7,22 +7,21 @@
* All settings are cached as a struct constructed using the following format:
* - global : { name : value } // global settings
* - sites : {
- * slug : { name : value }
+ * slug : { name : value }
* }
*/
-component
- extends ="cborm.models.VirtualEntityService"
- accessors="true"
- threadsafe
- singleton
-{
-
+component extends ="cborm.models.VirtualEntityService" accessors="true" threadsafe singleton {
// DI properties
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}";
/**
@@ -34,123 +33,119 @@ component
/**
* Bit that detects if CB has been installed or not
*/
- property
- name ="CBReadyFlag"
- default="false"
- type ="boolean";
-
+ property name="CBReadyFlag" default="false" type="boolean";
// Global Setting Defaults
this.DEFAULTS = {
// ContentBox Global Version
- "cb_version" : "@version.number@+@build.number@",
+ "cb_version" : "@version.number@+@build.number@",
// Installation security salt
- "cb_salt" : hash( createUUID() & getTickCount() & now(), "SHA-512" ),
+ "cb_salt" : hash( createUUID() & getTickCount() & now(), "SHA-512" ),
// Global Notifications
- "cb_site_email" : "",
- "cb_notify_author" : "true",
- "cb_notify_entry" : "true",
- "cb_notify_page" : "true",
- "cb_notify_contentstore" : "true",
+ "cb_site_email" : "",
+ "cb_notify_author" : "true",
+ "cb_notify_entry" : "true",
+ "cb_notify_page" : "true",
+ "cb_notify_contentstore" : "true",
// Outgoing email
- "cb_site_outgoingEmail" : "",
+ "cb_site_outgoingEmail" : "",
// Blog Entry Point
- "cb_site_blog_entrypoint" : "blog",
+ "cb_site_blog_entrypoint" : "blog",
// Caching
- "cb_site_settings_cache" : "template",
+ "cb_site_settings_cache" : "template",
// Security Settings
- "cb_security_min_password_length" : "8",
- "cb_security_password_reset_expiration" : "60",
- "cb_security_login_blocker" : "true",
- "cb_security_max_attempts" : "5",
- "cb_security_blocktime" : "5",
- "cb_security_max_auth_logs" : "500",
- "cb_security_latest_logins" : "10",
- "cb_security_rate_limiter" : "true",
- "cb_security_rate_limiter_logging" : "true",
- "cb_security_rate_limiter_count" : "4",
- "cb_security_rate_limiter_duration" : "1",
- "cb_security_rate_limiter_bots_only" : "true",
- "cb_security_rate_limiter_message" : "You are making too many requests too fast, please slow down and wait {duration} seconds
",
- "cb_security_rate_limiter_redirectURL" : "",
- "cb_security_2factorAuth_force" : "false",
- "cb_security_2factorAuth_provider" : "email",
- "cb_security_2factorAuth_trusted_days" : "30",
- "cb_security_login_signout_url" : "",
- "cb_security_login_signin_text" : "",
+ "cb_security_min_password_length" : "8",
+ "cb_security_password_reset_expiration": "60",
+ "cb_security_login_blocker" : "true",
+ "cb_security_max_attempts" : "5",
+ "cb_security_blocktime" : "5",
+ "cb_security_max_auth_logs" : "500",
+ "cb_security_latest_logins" : "10",
+ "cb_security_rate_limiter" : "true",
+ "cb_security_rate_limiter_logging" : "true",
+ "cb_security_rate_limiter_count" : "4",
+ "cb_security_rate_limiter_duration" : "1",
+ "cb_security_rate_limiter_bots_only" : "true",
+ "cb_security_rate_limiter_message" : "You are making too many requests too fast, please slow down and wait {duration} seconds
",
+ "cb_security_rate_limiter_redirectURL" : "",
+ "cb_security_2factorAuth_force" : "false",
+ "cb_security_2factorAuth_provider" : "email",
+ "cb_security_2factorAuth_trusted_days" : "30",
+ "cb_security_login_signout_url" : "",
+ "cb_security_login_signin_text" : "",
// Admin settings
- "cb_admin_ssl" : "false",
- "cb_admin_quicksearch_max" : "5",
- "cb_admin_theme" : "contentbox-default",
+ "cb_admin_ssl" : "false",
+ "cb_admin_quicksearch_max" : "5",
+ "cb_admin_theme" : "contentbox-default",
// Paging Defaults
- "cb_paging_maxrows" : "20",
- "cb_paging_bandgap" : "5",
- "cb_paging_maxentries" : "10",
- "cb_paging_maxRSSComments" : "10",
+ "cb_paging_maxrows" : "20",
+ "cb_paging_bandgap" : "5",
+ "cb_paging_maxentries" : "10",
+ "cb_paging_maxRSSComments" : "10",
// Gravatar
- "cb_gravatar_display" : "true",
- "cb_gravatar_rating" : "PG",
+ "cb_gravatar_display" : "true",
+ "cb_gravatar_rating" : "PG",
// Dashboard Settings
- "cb_dashboard_recentEntries" : "5",
- "cb_dashboard_recentPages" : "5",
- "cb_dashboard_recentComments" : "5",
- "cb_dashboard_recentcontentstore" : "5",
- "cb_dashboard_newsfeed" : "https://www.ortussolutions.com/blog/rss",
- "cb_dashboard_newsfeed_count" : "5",
- "cb_dashboard_welcome_title" : "Dashboard",
- "cb_dashboard_welcome_body" : "",
+ "cb_dashboard_recentEntries" : "5",
+ "cb_dashboard_recentPages" : "5",
+ "cb_dashboard_recentComments" : "5",
+ "cb_dashboard_recentcontentstore" : "5",
+ "cb_dashboard_newsfeed" : "https://www.ortussolutions.com/blog/rss",
+ "cb_dashboard_newsfeed_count" : "5",
+ "cb_dashboard_welcome_title" : "Dashboard",
+ "cb_dashboard_welcome_body" : "",
// Global Comment Settings
- "cb_comments_whoisURL" : "http://whois.arin.net/ui/query.do?q",
+ "cb_comments_whoisURL" : "http://whois.arin.net/ui/query.do?q",
// Mail Settings
- "cb_site_mail_server" : "",
- "cb_site_mail_username" : "",
- "cb_site_mail_password" : "",
- "cb_site_mail_smtp" : "25",
- "cb_site_mail_tls" : "false",
- "cb_site_mail_ssl" : "false",
+ "cb_site_mail_server" : "",
+ "cb_site_mail_username" : "",
+ "cb_site_mail_password" : "",
+ "cb_site_mail_smtp" : "25",
+ "cb_site_mail_tls" : "false",
+ "cb_site_mail_ssl" : "false",
// RSS Feeds
- "cb_rss_maxEntries" : "10",
- "cb_rss_maxComments" : "10",
- "cb_rss_caching" : "true",
- "cb_rss_cachingTimeout" : "60",
- "cb_rss_cachingTimeoutIdle" : "15",
- "cb_rss_cacheName" : "Template",
- "cb_rss_title" : "RSS Feed by ContentBox",
- "cb_rss_generator" : "ContentBox by Ortus Solutions",
- "cb_rss_copyright" : "Ortus Solutions, Corp (www.ortussolutions.com)",
- "cb_rss_description" : "ContentBox RSS Feed",
- "cb_rss_webmaster" : "",
+ "cb_rss_maxEntries" : "10",
+ "cb_rss_maxComments" : "10",
+ "cb_rss_caching" : "true",
+ "cb_rss_cachingTimeout" : "60",
+ "cb_rss_cachingTimeoutIdle" : "15",
+ "cb_rss_cacheName" : "Template",
+ "cb_rss_title" : "RSS Feed by ContentBox",
+ "cb_rss_generator" : "ContentBox by Ortus Solutions",
+ "cb_rss_copyright" : "Ortus Solutions, Corp (www.ortussolutions.com)",
+ "cb_rss_description" : "ContentBox RSS Feed",
+ "cb_rss_webmaster" : "",
// Content Caching and options
- "cb_content_caching" : "true",
- "cb_entry_caching" : "true",
- "cb_contentstore_caching" : "true",
- "cb_content_cachingTimeout" : "60",
- "cb_content_cachingTimeoutIdle" : "15",
- "cb_content_cacheName" : "Template",
- "cb_page_excerpts" : "true",
- "cb_content_uiexport" : "true",
- "cb_content_cachingHeader" : "true",
+ "cb_content_caching" : "true",
+ "cb_entry_caching" : "true",
+ "cb_contentstore_caching" : "true",
+ "cb_content_cachingTimeout" : "60",
+ "cb_content_cachingTimeoutIdle" : "15",
+ "cb_content_cacheName" : "Template",
+ "cb_page_excerpts" : "true",
+ "cb_content_uiexport" : "true",
+ "cb_content_cachingHeader" : "true",
// Content Hit Tracking
- "cb_content_hit_count" : "true",
- "cb_content_hit_ignore_bots" : "false",
- "cb_content_bot_regex" : "Googlebot(?:[\/-](\w+))?|AdsBot-Google(?:-(\w+)|[^-]?) |Feedfetcher-Google|Mediapartners-Google|Mediapartners \(Googlebot\)|APIs-Google|Google-InspectionTool|Storebot-Google|GoogleOther|bingbot|Slurp|[wW]get|LinkedInBot|Python-urllib|python-requests|aiohttp|httpx|libwww-perl|httpunit|Nutch|Go-http-client|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|BIGLOTRON|Teoma|convera|seekbot|Gigabot|Gigablast|exabot|ia_archiver|GingerCrawler|webmon |HTTrack|grub\.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|findlink|msrbot|panscient|yacybot|AISearchBot|ips-agent|tagoobot|MJ12bot|woriobot|yanga|buzzbot|mlbot|yandex\.com\/bots|purebot|Linguee Bot|CyberPatrol|voilabot|Baiduspider|citeseerxbot|spbot|twengabot|postrank|Turnitin|scribdbot|page2rss|sitebot|linkdex|Adidxbot|ezooms|dotbot|Mail\.RU_Bot|discobot|heritrix|findthatfile|europarchive\.org|NerdByNature\.Bot|(sistrix|SISTRIX) [cC]rawler|Ahrefs(Bot|SiteAudit)|fuelbot|CrunchBot|IndeedBot|mappydata|woobot|ZoominfoBot|PrivacyAwareBot|Multiviewbot|SWIMGBot|Grobbot|eright|Apercite|semanticbot|Aboundex|domaincrawler|wbsearchbot|summify|CCBot|edisterbot|SeznamBot|ec2linkfinder|gslfbot|aiHitBot|intelium_bot|facebookexternalhit|Yeti|RetrevoPageAnalyzer|lb-spider|Sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net\.com\.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|it2media-domain-crawler|ip-web-crawler\.com|siteexplorer\.info|elisabot|proximic|changedetection|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|CC Metadata Scaper|g00g1e\.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Twitterbot|cXensebot|smtbot|bnf\.fr_bot|A6-Indexer|ADmantX|Facebot|OrangeBot\/|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive\.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|S[eE][mM]rushBot|yoozBot|lipperhey|Y!J|Domain Re-Animator Bot|AddThis|Screaming Frog SEO Spider|MetaURI|Scrapy|Livelap[bB]ot|OpenHoseBot|CapsuleChecker|collection@infegy\.com|IstellaBot|DeuSu\/|betaBot|Cliqzbot\/|MojeekBot\/|netEstate NE Crawler|SafeSearch microdata crawler|Gluten Free Crawler\/|Sonic|Sysomos|Trove|deadlinkchecker|Slack-ImgProxy|Embedly|RankActiveLinkBot|iskanie|SafeDNSBot|SkypeUriPreview|Veoozbot|Slackbot|redditbot|datagnionbot|Google-Adwords-Instant|adbeat_bot|WhatsApp|contxbot|pinterest\.com\/bot|electricmonk|GarlikCrawler|BingPreview\/|vebidoobot|FemtosearchBot|Yahoo Link Preview|MetaJobBot|DomainStatsBot|mindUpBot|Daum\/|Jugendschutzprogramm-Crawler|Xenu Link Sleuth|Pcore-HTTP|moatbot|KosmioBot|[pP]ingdom|AppInsights|PhantomJS|Gowikibot|PiplBot|Discordbot|TelegramBot|Jetslide|newsharecounts|James BOT|Bark[rR]owler|TinEye|SocialRankIOBot|trendictionbot|Ocarinabot|epicbot|Primalbot|DuckDuckGo-Favicons-Bot|GnowitNewsbot|Leikibot|LinkArchiver|YaK\/|PaperLiBot|Digg Deeper|dcrawl|Snacktory|AndersPinkBot|Fyrebot|EveryoneSocialBot|Mediatoolkitbot|Luminator-robots|ExtLinksBot|SurveyBot|NING\/|okhttp|Nuzzel|omgili|PocketParser|YisouSpider|um-LN|ToutiaoSpider|MuckRack|Jamie's Spider|AHC\/|NetcraftSurveyAgent|Laserlikebot|^Apache-HttpClient|AppEngine-Google|Jetty|Upflow|Thinklab|Traackr\.com|Twurly|Mastodon|http_get|DnyzBot|botify|007ac9 Crawler|BehloolBot|BrandVerity|check_http|BDCbot|ZumBot|EZID|ICC-Crawler|ArchiveBot|^LCC |filterdb\.iss\.net\/crawler|BLP_bbot|BomboraBot|Buck\/|Companybook-Crawler|Genieo|magpie-crawler|MeltwaterNews|Moreover|newspaper\/|ScoutJet|(^| )sentry\/|StorygizeBot|UptimeRobot|OutclicksBot|seoscanners|Hatena|Google Web Preview|MauiBot|AlphaBot|SBL-BOT|IAS crawler|adscanner|Netvibes|acapbot|Baidu-YunGuanCe|bitlybot|blogmuraBot|Bot\.AraTurka\.com|bot-pge\.chlooe\.com|BoxcarBot|BTWebClient|ContextAd Bot|Digincore bot|Disqus|Feedly|Fetch\/|Fever|Flamingo_SearchEngine|FlipboardProxy|g2reader-bot|G2 Web Services|imrbot|K7MLWCBot|Kemvibot|Landau-Media-Spider|linkapediabot|vkShare|Siteimprove\.com|BLEXBot\/|DareBoost|ZuperlistBot\/|Miniflux\/|Feedspot|Diffbot\/|SEOkicks|tracemyfile|Nimbostratus-Bot|zgrab|PR-CY\.RU|AdsTxtCrawler|Datafeedwatch|Zabbix|TangibleeBot|google-xrawler|axios|Amazon CloudFront|Pulsepoint|CloudFlare-AlwaysOnline|Cloudflare-Healthchecks|Cloudflare-Traffic-Manager|CloudFlare-Prefetch|Cloudflare-SSLDetector|https:\/\/developers\.cloudflare\.com\/security-center\/|Google-Structured-Data-Testing-Tool|WordupInfoSearch|WebDataStats|HttpUrlConnection|ZoomBot|VelenPublicWebCrawler|MoodleBot|jpg-newsbot|outbrain|W3C_Validator|Validator\.nu|W3C-checklink|W3C-mobileOK|W3C_I18n-Checker|FeedValidator|W3C_CSS_Validator|W3C_Unicorn|Google-PhysicalWeb|Blackboard|ICBot\/|BazQux|Twingly|Rivva|Experibot|awesomecrawler|Dataprovider\.com|GroupHigh\/|theoldreader\.com|AnyEvent|Uptimebot\.org|Nmap Scripting Engine|2ip\.ru|Clickagy|Caliperbot|MBCrawler|online-webceo-bot|B2B Bot|AddSearchBot|Google Favicon|HubSpot|Chrome-Lighthouse|HeadlessChrome|CheckMarkNetwork\/|www\.uptime\.com|Streamline3Bot\/|serpstatbot\/|MixnodeCache\/|^curl|SimpleScraper|RSSingBot|Jooblebot|fedoraplanet|Friendica|NextCloud|Tiny Tiny RSS|RegionStuttgartBot|Bytespider|Datanyze|Google-Site-Verification|TrendsmapResolver|tweetedtimes|NTENTbot|Gwene|SimplePie|SearchAtlas|Superfeedr|feedbot|UT-Dorkbot|Amazonbot|SerendeputyBot|Eyeotabot|officestorebot|Neticle Crawler|SurdotlyBot|LinkisBot|AwarioSmartBot|AwarioRssBot|RyteBot|FreeWebMonitoring SiteChecker|AspiegelBot|NAVER Blog Rssbot|zenback bot|SentiBot|Domains Project\/|Pandalytics|VKRobot|bidswitchbot|tigerbot|NIXStatsbot|Atom Feed Robot|[Cc]urebot|PagePeeker\/|Vigil\/|rssbot\/|startmebot\/|JobboerseBot|seewithkids|NINJA bot|Cutbot|BublupBot|BrandONbot|RidderBot|Taboolabot|Dubbotbot|FindITAnswersbot|infoobot|Refindbot|BlogTraffic\/\d\.\d+ Feed-Fetcher|SeobilityBot|Cincraw|Dragonbot|VoluumDSP-content-bot|FreshRSS|BitBot|^PHP-Curl-Class|Google-Certificates-Bridge|centurybot|Viber|e\.ventures Investment Crawler|evc-batch|PetalBot|virustotal|(^| )PTST\/|minicrawler|Cookiebot|trovitBot|seostar\.co|IonCrawl|Uptime-Kuma|Seekport|FreshpingBot|Feedbin|CriteoBot|Snap URL Preview Service|Better Uptime Bot|RuxitSynthetic|Google-Read-Aloud|Valve\/Steam|OdklBot\/|GPTBot|ChatGPT-User|OAI-SearchBot|YandexRenderResourcesBot\/|LightspeedSystemsCrawler|ev-crawler\/|BitSightBot\/|woorankreview\/|Google-Safety|AwarioBot|DataForSeoBot|Linespider|WellKnownBot|A Patent Crawler|StractBot|search\.marginalia\.nu|YouBot|Nicecrawler|Neevabot|BrightEdge Crawler|SiteCheckerBotCrawler|TombaPublicWebCrawler|CrawlyProjectCrawler|KomodiaBot|KStandBot|CISPA Webcrawler|MTRobot|hyscore\.io|AlexandriaOrgBot|2ip bot|Yellowbrandprotectionbot|SEOlizer|vuhuvBot|INETDEX-BOT|Synapse|t3versionsBot|deepnoc|Cocolyzebot|hypestat|ReverseEngineeringBot|sempi\.tech|Iframely|MetaInspector|node-fetch|lkxscan|python-opengraph|OpenGraphCheck|developers\.google\.com\/\+\/web\/snippet|SenutoBot|MaCoCu|NewsBlur|inoreader|NetSystemsResearch|PageThing|WordPress\/|PhxBot|ImagesiftBot|Expanse|InternetMeasurement|^BW\/|GeedoBot|Audisto Crawler|PerplexityBot\/|[cC]laude[bB]ot|Monsidobot|GroupMeBot|Vercelbot|vercel-screenshot|facebookcatalog\/|meta-externalagent\/|meta-externalfetcher\/|AcademicBotRTU|KeybaseBot|Lemmy|CookieHubScan|Hydrozen\.io|HTTP Banner Detection|SummalyBot|MicrosoftPreview\/",
+ "cb_content_hit_count" : "true",
+ "cb_content_hit_ignore_bots" : "false",
+ "cb_content_bot_regex" : "Googlebot(?:[\/-](\w+))?|AdsBot-Google(?:-(\w+)|[^-]?) |Feedfetcher-Google|Mediapartners-Google|Mediapartners \(Googlebot\)|APIs-Google|Google-InspectionTool|Storebot-Google|GoogleOther|bingbot|Slurp|[wW]get|LinkedInBot|Python-urllib|python-requests|aiohttp|httpx|libwww-perl|httpunit|Nutch|Go-http-client|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|BIGLOTRON|Teoma|convera|seekbot|Gigabot|Gigablast|exabot|ia_archiver|GingerCrawler|webmon |HTTrack|grub\.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|findlink|msrbot|panscient|yacybot|AISearchBot|ips-agent|tagoobot|MJ12bot|woriobot|yanga|buzzbot|mlbot|yandex\.com\/bots|purebot|Linguee Bot|CyberPatrol|voilabot|Baiduspider|citeseerxbot|spbot|twengabot|postrank|Turnitin|scribdbot|page2rss|sitebot|linkdex|Adidxbot|ezooms|dotbot|Mail\.RU_Bot|discobot|heritrix|findthatfile|europarchive\.org|NerdByNature\.Bot|(sistrix|SISTRIX) [cC]rawler|Ahrefs(Bot|SiteAudit)|fuelbot|CrunchBot|IndeedBot|mappydata|woobot|ZoominfoBot|PrivacyAwareBot|Multiviewbot|SWIMGBot|Grobbot|eright|Apercite|semanticbot|Aboundex|domaincrawler|wbsearchbot|summify|CCBot|edisterbot|SeznamBot|ec2linkfinder|gslfbot|aiHitBot|intelium_bot|facebookexternalhit|Yeti|RetrevoPageAnalyzer|lb-spider|Sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net\.com\.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|it2media-domain-crawler|ip-web-crawler\.com|siteexplorer\.info|elisabot|proximic|changedetection|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|CC Metadata Scaper|g00g1e\.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Twitterbot|cXensebot|smtbot|bnf\.fr_bot|A6-Indexer|ADmantX|Facebot|OrangeBot\/|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive\.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|S[eE][mM]rushBot|yoozBot|lipperhey|Y!J|Domain Re-Animator Bot|AddThis|Screaming Frog SEO Spider|MetaURI|Scrapy|Livelap[bB]ot|OpenHoseBot|CapsuleChecker|collection@infegy\.com|IstellaBot|DeuSu\/|betaBot|Cliqzbot\/|MojeekBot\/|netEstate NE Crawler|SafeSearch microdata crawler|Gluten Free Crawler\/|Sonic|Sysomos|Trove|deadlinkchecker|Slack-ImgProxy|Embedly|RankActiveLinkBot|iskanie|SafeDNSBot|SkypeUriPreview|Veoozbot|Slackbot|redditbot|datagnionbot|Google-Adwords-Instant|adbeat_bot|WhatsApp|contxbot|pinterest\.com\/bot|electricmonk|GarlikCrawler|BingPreview\/|vebidoobot|FemtosearchBot|Yahoo Link Preview|MetaJobBot|DomainStatsBot|mindUpBot|Daum\/|Jugendschutzprogramm-Crawler|Xenu Link Sleuth|Pcore-HTTP|moatbot|KosmioBot|[pP]ingdom|AppInsights|PhantomJS|Gowikibot|PiplBot|Discordbot|TelegramBot|Jetslide|newsharecounts|James BOT|Bark[rR]owler|TinEye|SocialRankIOBot|trendictionbot|Ocarinabot|epicbot|Primalbot|DuckDuckGo-Favicons-Bot|GnowitNewsbot|Leikibot|LinkArchiver|YaK\/|PaperLiBot|Digg Deeper|dcrawl|Snacktory|AndersPinkBot|Fyrebot|EveryoneSocialBot|Mediatoolkitbot|Luminator-robots|ExtLinksBot|SurveyBot|NING\/|okhttp|Nuzzel|omgili|PocketParser|YisouSpider|um-LN|ToutiaoSpider|MuckRack|Jamie's Spider|AHC\/|NetcraftSurveyAgent|Laserlikebot|^Apache-HttpClient|AppEngine-Google|Jetty|Upflow|Thinklab|Traackr\.com|Twurly|Mastodon|http_get|DnyzBot|botify|007ac9 Crawler|BehloolBot|BrandVerity|check_http|BDCbot|ZumBot|EZID|ICC-Crawler|ArchiveBot|^LCC |filterdb\.iss\.net\/crawler|BLP_bbot|BomboraBot|Buck\/|Companybook-Crawler|Genieo|magpie-crawler|MeltwaterNews|Moreover|newspaper\/|ScoutJet|(^| )sentry\/|StorygizeBot|UptimeRobot|OutclicksBot|seoscanners|Hatena|Google Web Preview|MauiBot|AlphaBot|SBL-BOT|IAS crawler|adscanner|Netvibes|acapbot|Baidu-YunGuanCe|bitlybot|blogmuraBot|Bot\.AraTurka\.com|bot-pge\.chlooe\.com|BoxcarBot|BTWebClient|ContextAd Bot|Digincore bot|Disqus|Feedly|Fetch\/|Fever|Flamingo_SearchEngine|FlipboardProxy|g2reader-bot|G2 Web Services|imrbot|K7MLWCBot|Kemvibot|Landau-Media-Spider|linkapediabot|vkShare|Siteimprove\.com|BLEXBot\/|DareBoost|ZuperlistBot\/|Miniflux\/|Feedspot|Diffbot\/|SEOkicks|tracemyfile|Nimbostratus-Bot|zgrab|PR-CY\.RU|AdsTxtCrawler|Datafeedwatch|Zabbix|TangibleeBot|google-xrawler|axios|Amazon CloudFront|Pulsepoint|CloudFlare-AlwaysOnline|Cloudflare-Healthchecks|Cloudflare-Traffic-Manager|CloudFlare-Prefetch|Cloudflare-SSLDetector|https:\/\/developers\.cloudflare\.com\/security-center\/|Google-Structured-Data-Testing-Tool|WordupInfoSearch|WebDataStats|HttpUrlConnection|ZoomBot|VelenPublicWebCrawler|MoodleBot|jpg-newsbot|outbrain|W3C_Validator|Validator\.nu|W3C-checklink|W3C-mobileOK|W3C_I18n-Checker|FeedValidator|W3C_CSS_Validator|W3C_Unicorn|Google-PhysicalWeb|Blackboard|ICBot\/|BazQux|Twingly|Rivva|Experibot|awesomecrawler|Dataprovider\.com|GroupHigh\/|theoldreader\.com|AnyEvent|Uptimebot\.org|Nmap Scripting Engine|2ip\.ru|Clickagy|Caliperbot|MBCrawler|online-webceo-bot|B2B Bot|AddSearchBot|Google Favicon|HubSpot|Chrome-Lighthouse|HeadlessChrome|CheckMarkNetwork\/|www\.uptime\.com|Streamline3Bot\/|serpstatbot\/|MixnodeCache\/|^curl|SimpleScraper|RSSingBot|Jooblebot|fedoraplanet|Friendica|NextCloud|Tiny Tiny RSS|RegionStuttgartBot|Bytespider|Datanyze|Google-Site-Verification|TrendsmapResolver|tweetedtimes|NTENTbot|Gwene|SimplePie|SearchAtlas|Superfeedr|feedbot|UT-Dorkbot|Amazonbot|SerendeputyBot|Eyeotabot|officestorebot|Neticle Crawler|SurdotlyBot|LinkisBot|AwarioSmartBot|AwarioRssBot|RyteBot|FreeWebMonitoring SiteChecker|AspiegelBot|NAVER Blog Rssbot|zenback bot|SentiBot|Domains Project\/|Pandalytics|VKRobot|bidswitchbot|tigerbot|NIXStatsbot|Atom Feed Robot|[Cc]urebot|PagePeeker\/|Vigil\/|rssbot\/|startmebot\/|JobboerseBot|seewithkids|NINJA bot|Cutbot|BublupBot|BrandONbot|RidderBot|Taboolabot|Dubbotbot|FindITAnswersbot|infoobot|Refindbot|BlogTraffic\/\d\.\d+ Feed-Fetcher|SeobilityBot|Cincraw|Dragonbot|VoluumDSP-content-bot|FreshRSS|BitBot|^PHP-Curl-Class|Google-Certificates-Bridge|centurybot|Viber|e\.ventures Investment Crawler|evc-batch|PetalBot|virustotal|(^| )PTST\/|minicrawler|Cookiebot|trovitBot|seostar\.co|IonCrawl|Uptime-Kuma|Seekport|FreshpingBot|Feedbin|CriteoBot|Snap URL Preview Service|Better Uptime Bot|RuxitSynthetic|Google-Read-Aloud|Valve\/Steam|OdklBot\/|GPTBot|ChatGPT-User|OAI-SearchBot|YandexRenderResourcesBot\/|LightspeedSystemsCrawler|ev-crawler\/|BitSightBot\/|woorankreview\/|Google-Safety|AwarioBot|DataForSeoBot|Linespider|WellKnownBot|A Patent Crawler|StractBot|search\.marginalia\.nu|YouBot|Nicecrawler|Neevabot|BrightEdge Crawler|SiteCheckerBotCrawler|TombaPublicWebCrawler|CrawlyProjectCrawler|KomodiaBot|KStandBot|CISPA Webcrawler|MTRobot|hyscore\.io|AlexandriaOrgBot|2ip bot|Yellowbrandprotectionbot|SEOlizer|vuhuvBot|INETDEX-BOT|Synapse|t3versionsBot|deepnoc|Cocolyzebot|hypestat|ReverseEngineeringBot|sempi\.tech|Iframely|MetaInspector|node-fetch|lkxscan|python-opengraph|OpenGraphCheck|developers\.google\.com\/\+\/web\/snippet|SenutoBot|MaCoCu|NewsBlur|inoreader|NetSystemsResearch|PageThing|WordPress\/|PhxBot|ImagesiftBot|Expanse|InternetMeasurement|^BW\/|GeedoBot|Audisto Crawler|PerplexityBot\/|[cC]laude[bB]ot|Monsidobot|GroupMeBot|Vercelbot|vercel-screenshot|facebookcatalog\/|meta-externalagent\/|meta-externalfetcher\/|AcademicBotRTU|KeybaseBot|Lemmy|CookieHubScan|Hydrozen\.io|HTTP Banner Detection|SummalyBot|MicrosoftPreview\/",
// Media Manager
- "cb_media_directoryRoot" : "/contentbox-custom/_content",
- "cb_media_createFolders" : "true",
- "cb_media_allowDelete" : "true",
- "cb_media_allowDownloads" : "true",
- "cb_media_allowUploads" : "true",
- "cb_media_acceptMimeTypes" : "",
- "cb_media_quickViewWidth" : "400",
+ "cb_media_directoryRoot" : "/contentbox-custom/_content",
+ "cb_media_createFolders" : "true",
+ "cb_media_allowDelete" : "true",
+ "cb_media_allowDownloads" : "true",
+ "cb_media_allowUploads" : "true",
+ "cb_media_acceptMimeTypes" : "",
+ "cb_media_quickViewWidth" : "400",
// HTML5 Media Manager
- "cb_media_html5uploads_maxFileSize" : "100",
- "cb_media_html5uploads_maxFiles" : "25",
+ "cb_media_html5uploads_maxFileSize" : "100",
+ "cb_media_html5uploads_maxFiles" : "25",
// Media Services
- "cb_media_provider" : "CFContentMediaProvider",
- "cb_media_provider_caching" : "true",
+ "cb_media_provider" : "CFContentMediaProvider",
+ "cb_media_provider_caching" : "true",
// Editor Manager
- "cb_editors_default" : "ckeditor",
- "cb_editors_markup" : "HTML",
- "cb_editors_ckeditor_toolbar" : "[
+ "cb_editors_default" : "ckeditor",
+ "cb_editors_markup" : "HTML",
+ "cb_editors_ckeditor_toolbar" : "[
{ ""name"": ""document"", ""items"" : [ ""Source"",""-"",""Maximize"",""ShowBlocks"" ] },
{ ""name"": ""clipboard"", ""items"" : [ ""Cut"",""Copy"",""Paste"",""PasteText"",""PasteFromWord"",""-"",""Undo"",""Redo"" ] },
{ ""name"": ""editing"", ""items"" : [ ""Find"",""Replace"",""SpellChecker""] },
@@ -165,7 +160,7 @@ component
{ ""name"": ""insert"", ""items"" : [ ""Image"",""Table"",""HorizontalRule"",""Smiley"",""SpecialChar"",""Iframe"",""InsertPre""] },
{ ""name"": ""contentbox"", ""items"" : [ ""MediaEmbed"",""cbIpsumLorem"",""cbWidgets"",""cbContentStore"",""cbLinks"",""cbEntryLinks"" ] }
]",
- "cb_editors_ckeditor_excerpt_toolbar" : "
+ "cb_editors_ckeditor_excerpt_toolbar": "
[
{ ""name"": ""document"", ""items"" : [ ""Source"",""-"",""Maximize"",""ShowBlocks"" ] },
{ ""name"": ""basicstyles"", ""items"" : [ ""Bold"",""Italic"",""Underline"",""Strike"",""Subscript"",""Superscript""] },
@@ -174,58 +169,58 @@ component
{ ""name"": ""insert"", ""items"" : [ ""Image"",""Flash"",""Table"",""HorizontalRule"",""Smiley"",""SpecialChar"" ] },
{ ""name"": ""contentbox"", ""items"" : [ ""MediaEmbed"",""cbIpsumLorem"",""cbWidgets"",""cbContentStore"",""cbLinks"",""cbEntryLinks"" ] }
]",
- "cb_editors_ckeditor_extraplugins" : "cbKeyBinding,cbWidgets,cbLinks,cbEntryLinks,cbContentStore,cbIpsumLorem,wsc,mediaembed,insertpre,justify,colorbutton,showblocks,find,div,smiley,specialchar,iframe",
+ "cb_editors_ckeditor_extraplugins": "cbKeyBinding,cbWidgets,cbLinks,cbEntryLinks,cbContentStore,cbIpsumLorem,wsc,mediaembed,insertpre,justify,colorbutton,showblocks,find,div,smiley,specialchar,iframe",
// Search Settings
- "cb_search_adapter" : "contentbox.models.search.DBSearch",
- "cb_search_maxResults" : "20",
+ "cb_search_adapter" : "contentbox.models.search.DBSearch",
+ "cb_search_maxResults" : "20",
// Site Maintenance
- "cb_site_maintenance_message" : "This site is down for maintenance. Please check back again soon. ",
- "cb_site_maintenance" : "false",
+ "cb_site_maintenance_message" : "This site is down for maintenance. Please check back again soon. ",
+ "cb_site_maintenance" : "false",
// Versioning
- "cb_versions_max_history" : "",
- "cb_versions_commit_mandatory" : "false"
+ "cb_versions_max_history" : "",
+ "cb_versions_commit_mandatory" : "false"
};
// Site Defaults
this.SITE_DEFAULTS = {
// Global HTML: Panel Section
- "cb_html_beforeHeadEnd" : "",
- "cb_html_afterBodyStart" : "",
- "cb_html_beforeBodyEnd" : "",
- "cb_html_beforeContent" : "",
- "cb_html_afterContent" : "",
- "cb_html_beforeSideBar" : "",
- "cb_html_afterSideBar" : "",
- "cb_html_afterFooter" : "",
- "cb_html_preEntryDisplay" : "",
- "cb_html_postEntryDisplay" : "",
- "cb_html_preIndexDisplay" : "",
- "cb_html_postIndexDisplay" : "",
- "cb_html_preArchivesDisplay" : "",
- "cb_html_postArchivesDisplay" : "",
- "cb_html_preCommentForm" : "",
- "cb_html_postCommentForm" : "",
- "cb_html_prePageDisplay" : "",
- "cb_html_postPageDisplay" : "",
+ "cb_html_beforeHeadEnd" : "",
+ "cb_html_afterBodyStart" : "",
+ "cb_html_beforeBodyEnd" : "",
+ "cb_html_beforeContent" : "",
+ "cb_html_afterContent" : "",
+ "cb_html_beforeSideBar" : "",
+ "cb_html_afterSideBar" : "",
+ "cb_html_afterFooter" : "",
+ "cb_html_preEntryDisplay" : "",
+ "cb_html_postEntryDisplay" : "",
+ "cb_html_preIndexDisplay" : "",
+ "cb_html_postIndexDisplay" : "",
+ "cb_html_preArchivesDisplay" : "",
+ "cb_html_postArchivesDisplay" : "",
+ "cb_html_preCommentForm" : "",
+ "cb_html_postCommentForm" : "",
+ "cb_html_prePageDisplay" : "",
+ "cb_html_postPageDisplay" : "",
// Site Comment Settings
- "cb_comments_enabled" : "true",
- "cb_comments_maxDisplayChars" : "500",
- "cb_comments_notify" : "true",
- "cb_comments_moderation_notify" : "true",
- "cb_comments_notifyemails" : "",
- "cb_comments_moderation" : "true",
- "cb_comments_moderation_whitelist" : "true",
- "cb_comments_moderation_blacklist" : "",
- "cb_comments_moderation_blockedlist" : "",
- "cb_comments_moderation_expiration" : "30"
+ "cb_comments_enabled" : "true",
+ "cb_comments_maxDisplayChars" : "500",
+ "cb_comments_notify" : "true",
+ "cb_comments_moderation_notify" : "true",
+ "cb_comments_notifyemails" : "",
+ "cb_comments_moderation" : "true",
+ "cb_comments_moderation_whitelist" : "true",
+ "cb_comments_moderation_blacklist" : "",
+ "cb_comments_moderation_blockedlist": "",
+ "cb_comments_moderation_expiration" : "30"
};
/**
* Constructor
*/
- SettingService function init(){
- variables.oSystem = createObject( "java", "java.lang.System" );
- variables.CBReadyFlag = false;
+ SettingService function init() {
+ variables.oSystem = createObject( "java", "java.lang.System" );
+ variables.CBReadyFlag = false;
variables.cacheProviderName = "template";
// init it
@@ -238,17 +233,18 @@ component
* This method will go over all system settings and make sure that there are no missing default core settings.
* If they are, we will create the core settings with the appropriate defaults: this.DEFAULTS
*/
- SettingService function preFlightCheck(){
+ SettingService function preFlightCheck() {
// Log it
variables.log.info( "> Running ContentBox pre flight checks..." );
var sTime = getTickCount();
// Iterate over default core settings and check they exist
lock
- name ="contentbox-pre-flight",
- timeout = "10"
+ name ="contentbox-pre-flight"
+ timeout ="10"
throwOnTimeout="true"
- type ="exclusive" {
+ type ="exclusive"
+ {
// Check what's missing for the global settings
transaction {
// Get all core, non-deleted settings
@@ -256,68 +252,90 @@ component
.isNull( "site" )
.isFalse( "isDeleted" )
.isTrue( "isCore" )
- .withProjections( property: "name" )
+ .withProjections( property = "name" )
.list( sortOrder = "name" );
// Verify defaults exist
- this.DEFAULTS
+ this
+ .DEFAULTS
+ .filter(
+ function( key, value ) {
+ return !arrayContainsNoCase( loadedSettings, arguments.key );
+ }
+ )
// only process defaults that do not exist in the database
- .filter( function( key, value ){
- return !arrayContainsNoCase( loadedSettings, arguments.key );
- } )
+
// Create the missing global setting
- .each( function( key, value ){
- variables.log.info( "- Missing core setting (#arguments.key#) found in pre-flight, adding it!" );
- entitySave(
- this.new( {
- name : arguments.key,
- value : trim( arguments.value ),
- isCore : true
- } )
- );
- } );
+ .each(
+ function( key, value ) {
+ variables.log.info(
+ "- Missing core setting (#arguments.key#) found in pre-flight, adding it!"
+ );
+ entitySave(
+ this.new(
+ {
+ name : arguments.key,
+ value : trim( arguments.value ),
+ isCore: true
+ }
+ )
+ );
+ }
+ );
// Get all site core settings in the database
var dbSiteSettings = newCriteria()
.isFalse( "isDeleted" )
.isTrue( "isCore" )
.joinTo( "site", "site" )
- .withProjections( property: "name,site.slug:siteSlug" )
+ .withProjections( property = "name,site.slug:siteSlug" )
.asStruct()
.list( sortOrder = "site.slug,name" );
// Get all Sites and process them for core settings
- variables.siteService
+ variables
+ .siteService
.getAll()
- .each( function( site ){
- var targetSite = arguments.site;
- // Ensure Site Media Folder
- variables.siteService.ensureSiteMediaFolder( targetSite );
- // Setup Site Settings
- this.SITE_DEFAULTS
- // only process defaults that do not exist in the database
- .filter( function( key, value ){
- return arrayFilter( dbSiteSettings, function( item ){
- return (
- arguments.item[ "name" ] == key && arguments.item[ "siteSlug" ] == targetSite.getSlug()
- );
- } ).isEmpty();
- } )
- // Create the missing site setting
- .each( function( key, value ){
- variables.log.info(
- "- Site (#targetSite.getSlug()#) missing setting (#arguments.key#), adding it!"
- );
- entitySave(
- this.new( {
- name : arguments.key,
- value : trim( arguments.value ),
- isCore : true,
- site : targetSite
- } )
+ .each(
+ function( site ) {
+ var targetSite = arguments.site;
+
+ variables.siteService.ensureSiteMediaFolder( targetSite );
+
+ this
+ .SITE_DEFAULTS
+ .filter(
+ function( key, value ) {
+ return arrayFilter(
+ dbSiteSettings,
+ function( item ) {
+ return (
+ arguments.item[ "name" ] == key &&
+ arguments.item[ "siteSlug" ] == targetSite.getSlug()
+ );
+ }
+ ).isEmpty();
+ }
+ )
+ .each(
+ function( key, value ) {
+ variables.log.info(
+ "- Site (#targetSite.getSlug()#) missing setting (#arguments.key#), adding it!"
+ );
+ entitySave(
+ this.new(
+ {
+ name : arguments.key,
+ value : trim( arguments.value ),
+ isCore: true,
+ site : targetSite
+ }
+ )
+ );
+ }
);
- } );
- } );
+ }
+ );
}
// end transaction
@@ -325,7 +343,9 @@ component
loadCacheProviderName();
}
- variables.log.info( "√ ContentBox pre flight checks done in (#getTickCount() - sTime#)ms!" );
+ variables.log.info(
+ "√ ContentBox pre flight checks done in (#getTickCount() - sTime#)ms!"
+ );
return this;
}
@@ -333,24 +353,29 @@ component
/**
* Get a collection (struct) of settings that represent the defaults for a site in ContentBox
*/
- struct function getSiteSettingDefaults(){
+ struct function getSiteSettingDefaults() {
return this.SITE_DEFAULTS;
}
/**
* The static key used for caching all the settings of this installation
*/
- string function getSettingsCacheKey(){
- return "cb-settings-container-#reReplace( variables.appName, "\s", "-", "all" )#";
+ string function getSettingsCacheKey() {
+ return "cb-settings-container-#reReplace(
+ variables.appName,
+ "\s",
+ "-",
+ "all"
+ )#";
}
/**
* Check if the installer is present
*/
- boolean function isInstallationPresent(){
+ boolean function isInstallationPresent() {
if (
- structKeyExists( variables.moduleSettings, "contentbox-installer" ) AND
- directoryExists( variables.moduleSettings[ "contentbox-installer" ].path )
+ structKeyExists( variables.moduleSettings, "contentbox-installer" ) &&
+ directoryExists( variables.moduleSettings[ "contentbox-installer" ].path )
) {
return true;
}
@@ -361,10 +386,10 @@ component
/**
* Delete the installer module
*/
- boolean function deleteInstaller(){
+ boolean function deleteInstaller() {
if (
- structKeyExists( variables.moduleSettings, "contentbox-installer" ) AND
- directoryExists( variables.moduleSettings[ "contentbox-installer" ].path )
+ structKeyExists( variables.moduleSettings, "contentbox-installer" ) &&
+ directoryExists( variables.moduleSettings[ "contentbox-installer" ].path )
) {
directoryDelete( variables.moduleSettings[ "contentbox-installer" ].path, true );
return true;
@@ -376,7 +401,7 @@ component
* Check if contentbox has been installed by checking if there are no settings and no cb_active ONLY
* If the query comes back with active, it will not run it again.
*/
- boolean function isCBReady(){
+ boolean function isCBReady() {
// Short circuit caching
if ( variables.CBReadyFlag ) {
return true;
@@ -396,8 +421,8 @@ component
/**
* Mark cb as ready to serve
*/
- SettingService function activateCB(){
- save( this.new( { name : "cb_active", value : "true" } ) );
+ SettingService function activateCB() {
+ save( this.new( { name: "cb_active", value: "true" } ) );
return this;
}
@@ -411,7 +436,7 @@ component
*
* @throws SettingNotFoundException
*/
- function getSetting( required name, defaultValue ){
+ function getSetting( required name, defaultValue ) {
var allSettings = getAllSettings();
// verify it exists
@@ -426,9 +451,9 @@ component
// nothing we can do
throw(
- message: "Setting #arguments.name# not found in settings collection",
- detail : "Registered settings are: #structKeyList( allSettings )#",
- type : "SettingNotFoundException"
+ message = "Setting #arguments.name# not found in settings collection",
+ detail = "Registered settings are: #structKeyList( allSettings )#",
+ type = "SettingNotFoundException"
);
}
@@ -443,7 +468,7 @@ component
*
* @throws SettingNotFoundException
*/
- function getSiteSetting( required siteSlug, required name, defaultValue ){
+ function getSiteSetting( required siteSlug, required name, defaultValue ) {
var allSettings = getAllSiteSettings( arguments.siteSlug );
// verify it exists
@@ -458,9 +483,9 @@ component
// nothing we can do
throw(
- message: "Site setting #arguments.name# not found in site collection",
- detail : "Registered settings are: #structKeyList( allSettings )#",
- type : "SettingNotFoundException"
+ message = "Site setting #arguments.name# not found in site collection",
+ detail = "Registered settings are: #structKeyList( allSettings )#",
+ type = "SettingNotFoundException"
);
}
@@ -469,7 +494,7 @@ component
*
* @force To force clear the cache
*/
- struct function getAllSettings( boolean force = false ){
+ struct function getAllSettings( boolean force = false ) {
return getSettingsContainer( arguments.force ).global;
}
@@ -479,7 +504,7 @@ component
* @slug The site slug to use to retrieve the settings
* @force To force clear the cache
*/
- struct function getAllSiteSettings( required siteSlug, boolean force = false ){
+ struct function getAllSiteSettings( required siteSlug, boolean force = false ) {
return getSettingsContainer( arguments.force ).sites[ arguments.siteSlug ];
}
@@ -488,7 +513,7 @@ component
*
* @force To force clear the cache
*/
- struct function getDefaultSiteSettings( boolean force = false ){
+ struct function getDefaultSiteSettings( boolean force = false ) {
return getSettingsContainer( arguments.force ).sites[ "default" ];
}
@@ -497,7 +522,7 @@ component
*
* @force Force build
*/
- struct function getSettingsContainer( boolean force = false ){
+ struct function getSettingsContainer( boolean force = false ) {
// Force Clear
if ( arguments.force ) {
flushSettingsCache();
@@ -505,13 +530,13 @@ component
// Get or set
return getSettingsCacheProvider().getOrSet(
- getSettingsCacheKey(),
- function(){
- log.info( "Settings container not cached, rebuilding from DB!" );
- return buildSettingsContainer();
- },
- 7200
- );
+ getSettingsCacheKey(),
+ function() {
+ log.info( "Settings container not cached, rebuilding from DB!" );
+ return buildSettingsContainer();
+ },
+ 7200
+ );
}
/**
@@ -522,7 +547,7 @@ component
*
* @return The setting object or null
*/
- function findSiteSetting( required site, required name ){
+ function findSiteSetting( required site, required name ) {
return newCriteria()
.isEq( "site", arguments.site )
.isEq( "name", arguments.name )
@@ -534,14 +559,14 @@ component
*
* @return struct of { global : {}, sites : { slug : {} } }
*/
- struct function buildSettingsContainer(){
- var allSites = variables.siteService.getAllFlat();
- var container = { "global" : {}, "sites" : {} };
+ struct function buildSettingsContainer() {
+ var allSites = variables.siteService.getAllFlat();
+ var container = { "global": {}, "sites": {} };
// Initialize site setting containers from defaults
container.sites = arrayReduce(
allSites,
- function( result, item ){
+ function( result, item ) {
result[ item[ "slug" ] ] = duplicate( this.SITE_DEFAULTS );
return result;
},
@@ -552,14 +577,15 @@ component
newCriteria()
.isFalse( "isDeleted" )
.list( sortOrder = "site,name" )
- .each( function( item ){
- if ( item.hasSite() ) {
- // Store the setting
- container.sites[ item.getSite().getSlug() ][ item.getName() ] = item.getValue();
- } else {
- container.global[ item.getName() ] = item.getValue();
+ .each(
+ function( item ) {
+ if ( item.hasSite() ) {
+ container.sites[ item.getSite().getSlug() ][ item.getName() ] = item.getValue();
+ } else {
+ container.global[ item.getName() ] = item.getValue();
+ }
}
- } );
+ );
return container;
}
@@ -568,20 +594,20 @@ component
* This will store the incoming structure as the settings in cache.
* Usually this method is used for major overrides.
*/
- SettingService function storeSettings( struct settings ){
+ SettingService function storeSettings( struct settings ) {
// cache them for 5 days, usually app timeout
getSettingsCacheProvider().set(
- getSettingsCacheKey(),
- arguments.settings,
- 7200
- );
+ getSettingsCacheKey(),
+ arguments.settings,
+ 7200
+ );
return this;
}
/**
* flush settings cache for current multi-tenant host
*/
- SettingService function flushSettingsCache(){
+ SettingService function flushSettingsCache() {
// Info
variables.log.info( "Settings Flush Executed!" );
// Clear out the settings cache
@@ -604,39 +630,43 @@ component
*
* @return SettingService
*/
- SettingService function bulkSave( struct memento, site ){
- var settings = isNull( arguments.site ) ? getAllSettings() : getAllSiteSettings( arguments.site.getSlug() );
+ SettingService function bulkSave( struct memento, site ) {
+ var settings = isNull( arguments.site ) ? getAllSettings() : getAllSiteSettings( arguments.site.getSlug() );
var newSettings = [];
- arguments.memento
+ arguments
+ .memento
+ .filter(
+ function( key, value ) {
+ return settings.keyExists( key );
+ }
+ )
// Only save, saveable keys
- .filter( function( key, value ){
- return settings.keyExists( key );
- } )
+
// Build out array of settings to save
- .each( function( key, value ){
- var thisSetting = "";
- // Find the setting globally or by site, depending on the context
- if ( isNull( site ) ) {
- thisSetting = findWhere( { name : key } );
- } else {
- thisSetting = findSiteSetting( site, key );
- }
+ .each(
+ function( key, value ) {
+ var thisSetting = "";
- // Maybe it's a new setting :)
- if ( isNull( thisSetting ) ) {
- thisSetting = new ( { name : key } );
- }
+ if ( isNull( site ) ) {
+ thisSetting = findWhere( { name: key } );
+ } else {
+ thisSetting = findSiteSetting( site, key );
+ }
- thisSetting.setValue( toString( value ) );
+ if ( isNull( thisSetting ) ) {
+ thisSetting = new( { name: key } );
+ }
- // Site mapping
- if ( !isNull( site ) ) {
- thisSetting.setSite( site );
- }
+ thisSetting.setValue( toString( value ) );
+
+ if ( !isNull( site ) ) {
+ thisSetting.setSite( site );
+ }
- newSettings.append( thisSetting );
- } );
+ newSettings.append( thisSetting );
+ }
+ );
// save new settings and flush cache
saveAll( newSettings );
@@ -650,31 +680,31 @@ component
*
* @return struct
*/
- struct function buildFileBrowserSettings(){
+ struct function buildFileBrowserSettings() {
var cbSettings = getAllSettings();
- var settings = {
- directoryRoot : expandPath( cbSettings.cb_media_directoryRoot ),
- createFolders : cbSettings.cb_media_createFolders,
- deleteStuff : cbSettings.cb_media_allowDelete,
- allowDownload : cbSettings.cb_media_allowDownloads,
- allowUploads : cbSettings.cb_media_allowUploads,
- acceptMimeTypes : cbSettings.cb_media_acceptMimeTypes,
- quickViewWidth : cbSettings.cb_media_quickViewWidth,
- loadJQuery : false,
- useMediaPath : true,
- html5uploads : {
- maxFileSize : cbSettings.cb_media_html5uploads_maxFileSize,
- maxFiles : cbSettings.cb_media_html5uploads_maxFiles
+ var settings = {
+ directoryRoot : expandPath( cbSettings.cb_media_directoryRoot ),
+ createFolders : cbSettings.cb_media_createFolders,
+ deleteStuff : cbSettings.cb_media_allowDelete,
+ allowDownload : cbSettings.cb_media_allowDownloads,
+ allowUploads : cbSettings.cb_media_allowUploads,
+ acceptMimeTypes: cbSettings.cb_media_acceptMimeTypes,
+ quickViewWidth : cbSettings.cb_media_quickViewWidth,
+ loadJQuery : false,
+ useMediaPath : true,
+ html5uploads : {
+ maxFileSize: cbSettings.cb_media_html5uploads_maxFileSize,
+ maxFiles : cbSettings.cb_media_html5uploads_maxFiles
}
};
// Base MediaPath
- var mediaPath = "";
+ var mediaPath = "";
// add the entry point
var entryPoint = moduleSettings[ "contentbox-ui" ].entryPoint;
mediaPath &= ( len( entryPoint ) ? "#entryPoint#/" : "" ) & "__media";
// Store it
- mediaPath = ( left( mediaPath, 1 ) == "/" ? mediaPath : "/" & mediaPath );
+ mediaPath = ( left( mediaPath, 1 ) == "/" ? mediaPath : "/" & mediaPath );
settings.mediaPath = mediaPath;
return settings;
@@ -697,25 +727,30 @@ component
offset = 0,
sortOrder = "name asc",
siteID = ""
- ){
- var results = { "count" : 0, "settings" : [] };
- var c = newCriteria()
- // Search Criteria
- .when( len( arguments.search ), function( c ){
- c.like( "name", "%#search#%" );
- } )
+ ) {
+ var results = { "count": 0, "settings": [] };
+ var c = newCriteria().when(
+ len( arguments.search ),
+ function( c ) {
+ c.like( "name", "%#search#%" );
+ }
+ )// Search Criteria
+
// Site Filter
- .when( len( arguments.siteID ), function( c ){
- c.isEq( "site.siteID", siteID );
- } );
+ .when(
+ len( arguments.siteID ),
+ function( c ) {
+ c.isEq( "site.siteID", siteID );
+ }
+ );
// run criteria query and projections count
- results.count = c.count( "settingID" );
+ results.count = c.count( "settingID" );
results.settings = c.list(
- offset : arguments.offset,
- max : arguments.max,
- sortOrder: arguments.sortOrder
- );
+ offset = arguments.offset,
+ max = arguments.max,
+ sortOrder = arguments.sortOrder
+ );
return results;
}
@@ -723,10 +758,12 @@ component
/**
* Get all data prepared for export
*/
- array function getAllForExport(){
- return getAll().map( function( thisItem ){
- return thisItem.getMemento( profile: "export" );
- } );
+ array function getAllForExport() {
+ return getAll().map(
+ function( thisItem ) {
+ return thisItem.getMemento( profile = "export" );
+ }
+ );
}
/**
@@ -739,14 +776,17 @@ component
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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 }
@@ -772,26 +812,28 @@ component
required importData,
boolean override = false,
importLog
- ){
+ ) {
var allSettings = [];
var siteService = getWireBox().getInstance( "siteService@contentbox" );
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ arguments.importData = [ arguments.importData];
}
transaction {
// iterate and import
for ( var thisSetting in arguments.importData ) {
// Site Setting or Global Setting
- var oSetting = findWhere( {
- name : thisSetting.name,
- site : isNull( thisSetting.site.siteID ) ? javacast( "null", "" ) : siteService.get(
- thisSetting.site.siteID
- )
- } );
- oSetting = ( isNull( oSetting ) ? new () : oSetting );
+ var oSetting = findWhere(
+ {
+ name: thisSetting.name,
+ site: isNull( thisSetting.site.siteID )
+ ? javacast( "null", "" )
+ : siteService.get( thisSetting.site.siteID )
+ }
+ );
+ oSetting = ( isNull( oSetting ) ? new() : oSetting );
// Check for boolean values
if ( isSimpleValue( thisSetting.value ) && isBoolean( thisSetting.value ) ) {
@@ -800,11 +842,11 @@ component
// populate content from data
getBeanPopulator().populateFromStruct(
- target : oSetting,
- memento : thisSetting,
- exclude : "settingID,site",
- composeRelationships: false
- );
+ target = oSetting,
+ memento = thisSetting,
+ exclude = "settingID,site",
+ composeRelationships = false
+ );
// Link the site if it exists
if ( !isNull( thisSetting.site.slug ) ) {
@@ -815,7 +857,7 @@ component
if ( !oSetting.isLoaded() ) {
arguments.importLog.append( "New setting imported: #thisSetting.name# " );
arrayAppend( allSettings, oSetting );
- } else if ( oSetting.isLoaded() and arguments.override ) {
+ } else if ( oSetting.isLoaded() && arguments.override ) {
arguments.importLog.append( "Persisted setting overriden: #thisSetting.name# " );
arrayAppend( allSettings, oSetting );
} else {
@@ -830,8 +872,8 @@ component
arguments.importLog.append( "Saved all imported and overriden settings!" );
} else {
arguments.importLog.append(
- "No settings imported as none where found or able to be overriden from the import file."
- );
+ "No settings imported as none where found or able to be overriden from the import file."
+ );
}
}
// end of transaction
@@ -844,7 +886,7 @@ component
*
* @return coldbox.system.cache.ICacheProvider
*/
- function getSettingsCacheProvider(){
+ function getSettingsCacheProvider() {
// Return the cache to use
return cacheBox.getCache( variables.cacheProviderName );
}
@@ -852,19 +894,21 @@ component
/**
* Load up config overrides
*/
- function loadConfigOverrides(){
+ function loadConfigOverrides() {
// Global Settings
if (
- structKeyExists( variables.contentboxSettings, "settings" )
- &&
- structKeyExists( variables.contentboxSettings.settings, "global" )
+ structKeyExists( variables.contentboxSettings, "settings" ) &&
+ structKeyExists( variables.contentboxSettings.settings, "global" )
) {
var settingsContainer = getSettingsContainer();
// Append and override
structAppend(
settingsContainer.global,
- variables.contentboxSettings.settings.global,
+ variables
+ .contentboxSettings
+ .settings
+ .global,
true
);
@@ -872,12 +916,14 @@ component
storeSettings( settingsContainer );
// Log it
- variables.log.info(
- "ContentBox global config overrides loaded.",
- variables.contentboxSettings.settings.global
- );
+ variables.log.info( "ContentBox global config overrides loaded.",
+ variables
+ .contentboxSettings
+ .settings
+ .global );
}
+
// TODO: Site Settings
}
@@ -886,14 +932,18 @@ component
* The pattern to look is `contentbox.{site}.{setting}`
* Example: contentbox.default.cb_media_directoryRoot
*/
- function loadEnvironmentOverrides(){
+ function loadEnvironmentOverrides() {
var environmentSettings = variables.oSystem.getEnv();
- var overrides = {};
+ var overrides = {};
// iterate and override
for ( var thisKey in environmentSettings ) {
if ( reFindNoCase( "^contentbox\_", thisKey ) ) {
- overrides[ reReplaceNoCase( thisKey, "^contentbox\_", "" ) ] = environmentSettings[ thisKey ];
+ overrides[ reReplaceNoCase(
+ thisKey,
+ "^contentbox\_",
+ ""
+ ) ] = environmentSettings[ thisKey ];
}
}
@@ -906,7 +956,11 @@ component
var settingsContainer = getSettingsContainer();
// Append and override
- structAppend( settingsContainer.global, overrides, true );
+ structAppend(
+ settingsContainer.global,
+ overrides,
+ true
+ );
// Store them back in
storeSettings( settingsContainer );
@@ -920,7 +974,7 @@ component
/**
* Load the cache provider name from DB or default value
*/
- private SettingService function loadCacheProviderName(){
+ private SettingService function loadCacheProviderName() {
// query db for cache name
var oProvider = newCriteria().isEq( "name", "cb_site_settings_cache" ).get();
// Check if setting in DB already, else default it
@@ -933,4 +987,4 @@ component
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/system/Site.cfc b/modules/contentbox/models/system/Site.cfc
index 25703e9f3c..7c0df99339 100644
--- a/modules/contentbox/models/system/Site.cfc
+++ b/modules/contentbox/models/system/Site.cfc
@@ -6,647 +6,633 @@
* I model a ContentBox site for multi-site support
*/
component
- persistent="true"
- entityname="cbSite"
- table ="cb_site"
- extends ="contentbox.models.BaseEntity"
- cachename ="cbSite"
- cacheuse ="read-write"
+ persistent="true"
+ entityname="cbSite"
+ table="cb_site"
+ extends="contentbox.models.BaseEntity"
+ cachename="cbSite"
+ cacheuse="read-write"
{
- /* *********************************************************************
- ** DI
- ********************************************************************* */
-
- property
- name ="contentService"
- inject ="provider:contentService@contentbox"
- persistent="false";
-
- /* *********************************************************************
- ** PROPERTIES
- ********************************************************************* */
-
- property
- name ="siteID"
- column ="siteID"
- fieldtype="id"
- generator="uuid"
- length ="36"
- ormtype ="string"
- update ="false";
-
- property
- name ="name"
- column ="name"
- ormtype="string"
- notnull="true"
- length ="255"
- default="";
-
- property
- name ="slug"
- column ="slug"
- ormtype="string"
- notnull="true"
- length ="255"
- unique ="true"
- default=""
- index ="idx_siteSlug";
-
- property
- name ="description"
- column ="description"
- ormtype="string"
- notnull="false"
- default=""
- length ="500";
-
- property
- name ="keywords"
- column ="keywords"
- ormtype="string"
- notnull="false"
- default=""
- length ="255";
-
- property
- name ="domain"
- column ="domain"
- ormtype="string"
- notnull="false"
- default=""
- length ="255";
-
- property
- name ="domainRegex"
- column ="domainRegex"
- ormtype="string"
- notnull="false"
- default=""
- length ="255";
-
- property
- name ="domainAliases"
- column ="domainAliases"
- ormtype="text"
- notnull="false"
- length ="8000"
- default="";
-
- property
- name ="tagline"
- column ="tagline"
- ormtype="string"
- notnull="false"
- default=""
- length ="255";
-
- property
- name ="homepage"
- column ="homepage"
- ormtype="string"
- notnull="false"
- default="cbBlog"
- length ="255";
-
- property
- name ="isBlogEnabled"
- column ="isBlogEnabled"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="isSitemapEnabled"
- column ="isSitemapEnabled"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="poweredByHeader"
- column ="poweredByHeader"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="adminBar"
- column ="adminBar"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="isSSL"
- column ="isSSL"
- ormtype="boolean"
- notnull="true"
- default="false";
-
- property
- name ="isActive"
- column ="isActive"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="activeTheme"
- column ="activeTheme"
- ormtype="string"
- notnull="false"
- default=""
- length ="255";
-
- property
- name ="notificationEmails"
- column ="notificationEmails"
- ormtype="string"
- notnull="false"
- default=""
- length ="500";
-
- property
- name ="notifyOnEntries"
- column ="notifyOnEntries"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="notifyOnPages"
- column ="notifyOnPages"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="notifyOnContentStore"
- column ="notifyOnContentStore"
- ormtype="boolean"
- notnull="true"
- default="true";
-
- property
- name ="mediaDisk"
- column ="mediaDisk"
- ormtype="string"
- notnull="false"
- default="contentbox"
- length ="50";
-
- /* *********************************************************************
- ** RELATIONSHIPS
- ********************************************************************* */
-
- // O2M -> Settings
- property
- name ="settings"
- singularName="setting"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- orderby ="name"
- cfc ="contentbox.models.system.Setting"
- fkcolumn ="FK_siteID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- // O2M -> Categories
- property
- name ="categories"
- singularName="category"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- orderby ="slug"
- cfc ="contentbox.models.content.Category"
- fkcolumn ="FK_siteID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- // O2M -> Entries
- property
- name ="entries"
- singularName="entry"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- orderby ="createdDate desc"
- cfc ="contentbox.models.content.Entry"
- fkcolumn ="FK_siteID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- // O2M -> Pages
- property
- name ="pages"
- singularName="page"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- orderby ="parent"
- cfc ="contentbox.models.content.Page"
- fkcolumn ="FK_siteID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- // O2M -> ContentStore
- property
- name ="contentStore"
- fieldtype="one-to-many"
- type ="array"
- lazy ="true"
- orderby ="parent"
- cfc ="contentbox.models.content.ContentStore"
- fkcolumn ="FK_siteID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- // O2M -> menus
- property
- name ="menus"
- singularName="menu"
- fieldtype ="one-to-many"
- type ="array"
- lazy ="true"
- orderby ="createdDate desc"
- cfc ="contentbox.models.menu.Menu"
- fkcolumn ="FK_siteID"
- inverse ="true"
- cascade ="all-delete-orphan";
-
- /* *********************************************************************
- ** CALUCLATED FIELDS
- ********************************************************************* */
-
- property
- name ="numberOfEntries"
- formula="select count(*)
+ /**********************************************************************
+ * ** DI
+ **********************************************************************/
+
+ property name="contentService" inject="provider:contentService@contentbox" persistent="false";
+
+ /**********************************************************************
+ * ** PROPERTIES
+ **********************************************************************/
+
+ property
+ name="siteID"
+ column="siteID"
+ fieldtype="id"
+ generator="uuid"
+ length="36"
+ ormtype="string"
+ update="false";
+
+ property
+ name="name"
+ column="name"
+ ormtype="string"
+ notnull="true"
+ length="255"
+ default="";
+
+ property
+ name="slug"
+ column="slug"
+ ormtype="string"
+ notnull="true"
+ length="255"
+ unique="true"
+ default=""
+ index="idx_siteSlug";
+
+ property
+ name="description"
+ column="description"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="500";
+
+ property
+ name="keywords"
+ column="keywords"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="255";
+
+ property
+ name="domain"
+ column="domain"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="255";
+
+ property
+ name="domainRegex"
+ column="domainRegex"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="255";
+
+ property
+ name="domainAliases"
+ column="domainAliases"
+ ormtype="text"
+ notnull="false"
+ length="8000"
+ default="";
+
+ property
+ name="tagline"
+ column="tagline"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="255";
+
+ property
+ name="homepage"
+ column="homepage"
+ ormtype="string"
+ notnull="false"
+ default="cbBlog"
+ length="255";
+
+ property
+ name="isBlogEnabled"
+ column="isBlogEnabled"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="isSitemapEnabled"
+ column="isSitemapEnabled"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="poweredByHeader"
+ column="poweredByHeader"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="adminBar"
+ column="adminBar"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="isSSL"
+ column="isSSL"
+ ormtype="boolean"
+ notnull="true"
+ default="false";
+
+ property
+ name="isActive"
+ column="isActive"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="activeTheme"
+ column="activeTheme"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="255";
+
+ property
+ name="notificationEmails"
+ column="notificationEmails"
+ ormtype="string"
+ notnull="false"
+ default=""
+ length="500";
+
+ property
+ name="notifyOnEntries"
+ column="notifyOnEntries"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="notifyOnPages"
+ column="notifyOnPages"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="notifyOnContentStore"
+ column="notifyOnContentStore"
+ ormtype="boolean"
+ notnull="true"
+ default="true";
+
+ property
+ name="mediaDisk"
+ column="mediaDisk"
+ ormtype="string"
+ notnull="false"
+ default="contentbox"
+ length="50";
+
+ /**********************************************************************
+ * ** RELATIONSHIPS
+ **********************************************************************/
+
+ // O2M -> Settings
+ property
+ name="settings"
+ singularName="setting"
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ orderby="name"
+ cfc="contentbox.models.system.Setting"
+ fkcolumn="FK_siteID"
+ inverse="true"
+ cascade="all-delete-orphan";
+
+ // O2M -> Categories
+ property
+ name="categories"
+ singularName="category"
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ orderby="slug"
+ cfc="contentbox.models.content.Category"
+ fkcolumn="FK_siteID"
+ inverse="true"
+ cascade="all-delete-orphan";
+
+ // O2M -> Entries
+ property
+ name="entries"
+ singularName="entry"
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ orderby="createdDate desc"
+ cfc="contentbox.models.content.Entry"
+ fkcolumn="FK_siteID"
+ inverse="true"
+ cascade="all-delete-orphan";
+
+ // O2M -> Pages
+ property
+ name="pages"
+ singularName="page"
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ orderby="parent"
+ cfc="contentbox.models.content.Page"
+ fkcolumn="FK_siteID"
+ inverse="true"
+ cascade="all-delete-orphan";
+
+ // O2M -> ContentStore
+ property
+ name="contentStore"
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ orderby="parent"
+ cfc="contentbox.models.content.ContentStore"
+ fkcolumn="FK_siteID"
+ inverse="true"
+ cascade="all-delete-orphan";
+
+ // O2M -> menus
+ property
+ name="menus"
+ singularName="menu"
+ fieldtype="one-to-many"
+ type="array"
+ lazy="true"
+ orderby="createdDate desc"
+ cfc="contentbox.models.menu.Menu"
+ fkcolumn="FK_siteID"
+ inverse="true"
+ cascade="all-delete-orphan";
+
+ /**********************************************************************
+ * ** CALUCLATED FIELDS
+ **********************************************************************/
+
+ property
+ name="numberOfEntries"
+ formula="select count(*)
from cb_entry as entry, cb_content as content
where entry.contentID=content.contentID
and content.FK_siteID = siteID";
- property
- name ="numberOfPages"
- formula="select count(*)
+ property
+ name="numberOfPages"
+ formula="select count(*)
from cb_page as page, cb_content as content
where page.contentID=content.contentID
and content.FK_siteID = siteID";
- property
- name ="numberOfContentStore"
- formula="select count(*)
+ property
+ name="numberOfContentStore"
+ formula="select count(*)
from cb_contentStore as contentStore, cb_content as content
where contentStore.contentID=content.contentID
and content.FK_siteID = siteID";
- property
- name ="numberOfMenus"
- formula="select count(*)
+ property
+ name="numberOfMenus"
+ formula="select count(*)
from cb_menu as menu
where menu.FK_siteID = siteID";
- property
- name ="numberOfCategories"
- formula="select count(*)
+ property
+ name="numberOfCategories"
+ formula="select count(*)
from cb_category as category
where category.FK_siteID = siteID";
-
- /* *********************************************************************
- ** PK + CONSTRAINTS + MEMENTO
- ********************************************************************* */
-
- this.pk = "siteID";
-
- this.memento = {
- defaultIncludes : [
- "activeTheme",
- "adminBar",
- "description",
- "domain",
- "domainregex",
- "domainAliases",
- "homepage",
- "isActive",
- "isBlogEnabled",
- "isSitemapEnabled",
- "isSSL",
- "keywords",
- "name",
- "notificationEmails",
- "notifyOnContentStore",
- "notifyOnEntries",
- "notifyOnPages",
- "numberOfCategories",
- "numberOfContentStore",
- "numberOfEntries",
- "numberOfMenus",
- "numberOfPages",
- "poweredByHeader",
- "slug",
- "tagline"
- ],
- defaultExcludes : [
- "categories",
- "contentStore",
- "entries",
- "menus",
- "pages",
- "settings"
- ],
- profiles : {
- export : {
- defaultIncludes : [
- "categories",
- "contentStore",
- "entries",
- "menus",
- "pages",
- "settings"
- ],
- defaultExcludes : [
- "settings.siteSnapshot",
- "menus.siteSnapshot:site"
- ]
- }
- }
- };
-
- this.constraints = {
- "name" : { required : true, size : "2..255" },
- "slug" : {
- required : true,
- size : "2..255",
- validator : "UniqueValidator@cborm"
- },
- "description" : { required : false, size : "0..500" },
- "keywords" : { required : false, size : "0..255" },
- "domain" : { required : true, size : "1..255" },
- "domainRegex" : { required : true, size : "1..255" },
- "domainAliases" : { required : false, type : "array" },
- "tagline" : { required : false, size : "0..255" },
- "homepage" : { required : false, size : "0..255" },
- "isBlogEnabled" : { required : true, type : "boolean" },
- "isSitemapEnabled" : { required : true, type : "boolean" },
- "poweredByHeader" : { required : true, type : "boolean" },
- "adminBar" : { required : true, type : "boolean" },
- "isSSL" : { required : true, type : "boolean" },
- "isActive" : { required : true, type : "boolean" },
- "activeTheme" : { required : true, size : "0..255" }
- };
-
- /* *********************************************************************
- ** PUBLIC METHODS
- ********************************************************************* */
-
- /**
- * Constructor
- */
- function init(){
- variables.settings = [];
- variables.categories = [];
- variables.entries = [];
- variables.pages = [];
- variables.contentStore = [];
- variables.domainAliases = "[]";
-
- super.init();
-
- // Incorporate all includes to the export profile
- this.memento.profiles.export.defaultIncludes.append( this.memento.defaultIncludes, true );
-
- return this;
- }
-
- /**
- * Get the total number of content items in this site
- */
- numeric function getNumberOfContent(){
- return variables.contentService.getTotalContentCount( getsiteID() );
- }
-
- /**
- * I remove all setting associations
- */
- Site function removeAllSettings(){
- if ( hasSetting() ) {
- variables.settings.clear();
- } else {
- variables.settings = [];
- }
- return this;
- }
-
- /**
- * I remove all category associations
- */
- Site function removeAllCategories(){
- if ( hasCategory() ) {
- variables.categories.clear();
- } else {
- variables.categories = [];
- }
- return this;
- }
-
- /**
- * I remove all entry associations
- */
- Site function removeAllEntries(){
- if ( hasEntry() ) {
- variables.entries.clear();
- } else {
- variables.entries = [];
- }
- return this;
- }
-
- /**
- * I remove all menu associations
- */
- Site function removeAllMenus(){
- if ( hasMenu() ) {
- variables.menus.clear();
- } else {
- variables.menus = [];
- }
- return this;
- }
-
- /**
- * I remove all page associations
- */
- Site function removeAllPages(){
- if ( hasPage() ) {
- variables.pages.clear();
- } else {
- variables.pages = [];
- }
- return this;
- }
-
- /**
- * I remove all contentStore associations
- */
- Site function removeAllContentStore(){
- if ( hasContentStore() ) {
- variables.contentStore.clear();
- } else {
- variables.contentStore = [];
- }
- return this;
- }
-
- /**
- * Get the site root URL as defined per the settings
- */
- String function getSiteRoot(){
- var serverPort = getServerPort();
- var domainName = this.getDomain();
-
- // Return the appropriate site alias Uri from the domain aliases
- // If the domain alias matches the incoming server host name
- if (
- getDomainAliases().some( ( alias ) => alias.keyExists( "domainRegex" ) && reFindNoCase( alias.domainRegex, this.getServerName() ) )
- ) {
- domainName = this.getServerName();
- }
-
- // Return the appropriate site Uri
- return arrayToList(
- [
- "http",
- ( this.getIsSSL() ? "s" : "" ),
- "://",
- domainName,
- ( listFind( "80,443", serverPort ) ? "" : ":#serverPort#" )
- ],
- ""
- );
- }
-
- /**
- * 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;
- }
-
- /**
- * Get the server host according to lookup order
- * 1. x-forwarded-host header
- * 2. cgi.server_host
- */
- private function getServerName(){
- var headers = getHTTPRequestData( false ).headers;
- if ( structKeyExists( headers, "x-forwarded-host" ) && len( headers[ "x-forwarded-host" ] ) ) {
- return headers[ "x-forwarded-host" ];
- }
- return cgi.server_name;
- }
-
- /**
- * A nice snapshot of this entity used for mementifications
- */
- struct function getInfoSnapshot(){
- if ( isLoaded() ) {
- return {
- "siteID" : getId(),
- "slug" : getSlug(),
- "name" : getName()
- };
- }
- return {};
- }
-
- /**
- * Tries to get a category object by slug if assigned to this site
- *
- * @return The category object or null if not found
- */
- function getCategory( required slug ){
- if ( hasCategory() ) {
- var aFound = variables.categories.filter( function( thisCategory ){
- return arguments.thisCategory.getSlug() == slug;
- } );
- if ( aFound.len() ) {
- return aFound[ 1 ];
- }
- }
- }
-
- /**
- * We make sure we only return pages that have no parent to simulate the root hierarchy.
- *
- * @override
- * @root Show only root level pages if enabled
- */
- function getPages( boolean root = true ){
- if ( !arguments.root ) {
- return variables.pages;
- }
- return variables.pages.filter( function( thisPage ){
- return !arguments.thisPage.hasParent();
- } );
- }
-
- /**
- * We make sure we only return contentStore that have no parent to simulate the root hierarchy.
- *
- * @override
- * @root Show only root level contentStore if enabled
- */
- function getContentStore( boolean root = true ){
- if ( !arguments.root ) {
- return variables.contentStore;
- }
- return variables.contentStore.filter( function( thisContent ){
- return !arguments.thisContent.hasParent();
- } );
- }
-
- /**
- * Get the domain aliases
- *
- * @return The domain aliases as an array
- */
- array function getDomainAliases(){
- return (
- !isNull( variables.domainAliases ) AND isJSON( variables.domainAliases ) ? deserializeJSON(
- variables.domainAliases
- ) : []
- );
- }
-
- /**
- * Get the domain aliases as a string
- *
- * @return The domain aliases as a json string
- */
- string function getDomainAliasesAsJSON(){
- return isNull( variables.domainAliases ) ? "[]" : variables.domainAliases;
- }
-
- /**
- * Set the domain aliases. If the value is an array, it will be serialized to JSON
- * as domain aliases are stored as a JSON string.
- *
- * @aliases The domain aliases as an array or a JSON array string
- */
- Site function setDomainAliases( any aliases = [] ){
- variables.domainAliases = isSimpleValue( arguments.aliases ) ? arguments.aliases : serializeJSON(
- arguments.aliases
- );
- return this;
- }
+ /**********************************************************************
+ * ** PK + CONSTRAINTS + MEMENTO
+ **********************************************************************/
+
+ this.pk = 'siteID';
+
+ this.memento = {
+ defaultIncludes: [
+ 'activeTheme',
+ 'adminBar',
+ 'description',
+ 'domain',
+ 'domainregex',
+ 'domainAliases',
+ 'homepage',
+ 'isActive',
+ 'isBlogEnabled',
+ 'isSitemapEnabled',
+ 'isSSL',
+ 'keywords',
+ 'name',
+ 'notificationEmails',
+ 'notifyOnContentStore',
+ 'notifyOnEntries',
+ 'notifyOnPages',
+ 'numberOfCategories',
+ 'numberOfContentStore',
+ 'numberOfEntries',
+ 'numberOfMenus',
+ 'numberOfPages',
+ 'poweredByHeader',
+ 'slug',
+ 'tagline'
+ ],
+ defaultExcludes: [
+ 'categories',
+ 'contentStore',
+ 'entries',
+ 'menus',
+ 'pages',
+ 'settings'
+ ],
+ profiles: {
+ export: {
+ defaultIncludes: [
+ 'categories',
+ 'contentStore',
+ 'entries',
+ 'menus',
+ 'pages',
+ 'settings'
+ ],
+ defaultExcludes: ['settings.siteSnapshot', 'menus.siteSnapshot:site']
+ }
+ }
+ };
+
+ this.constraints = {
+ 'name': {required: true, size: '2..255'},
+ 'slug': {required: true, size: '2..255', validator: 'UniqueValidator@cborm'},
+ 'description': {required: false, size: '0..500'},
+ 'keywords': {required: false, size: '0..255'},
+ 'domain': {required: true, size: '1..255'},
+ 'domainRegex': {required: true, size: '1..255'},
+ 'domainAliases': {required: false, type: 'array'},
+ 'tagline': {required: false, size: '0..255'},
+ 'homepage': {required: false, size: '0..255'},
+ 'isBlogEnabled': {required: true, type: 'boolean'},
+ 'isSitemapEnabled': {required: true, type: 'boolean'},
+ 'poweredByHeader': {required: true, type: 'boolean'},
+ 'adminBar': {required: true, type: 'boolean'},
+ 'isSSL': {required: true, type: 'boolean'},
+ 'isActive': {required: true, type: 'boolean'},
+ 'activeTheme': {required: true, size: '0..255'}
+ };
+
+ /**********************************************************************
+ * ** PUBLIC METHODS
+ **********************************************************************/
+
+ /**
+ * Constructor
+ */
+ function init() {
+ variables.settings = [];
+ variables.categories = [];
+ variables.entries = [];
+ variables.pages = [];
+ variables.contentStore = [];
+ variables.domainAliases = '[]';
+
+ super.init();
+
+ // Incorporate all includes to the export profile
+ this.memento.profiles.export.defaultIncludes.append(this.memento.defaultIncludes, true);
+
+ return this;
+ }
+
+ /**
+ * Get the total number of content items in this site
+ */
+ numeric function getNumberOfContent() {
+ return variables.contentService.getTotalContentCount(getsiteID());
+ }
+
+ /**
+ * I remove all setting associations
+ */
+ Site function removeAllSettings() {
+ if (hasSetting()) {
+ variables.settings.clear();
+ } else {
+ variables.settings = [];
+ }
+ return this;
+ }
+
+ /**
+ * I remove all category associations
+ */
+ Site function removeAllCategories() {
+ if (hasCategory()) {
+ variables.categories.clear();
+ } else {
+ variables.categories = [];
+ }
+ return this;
+ }
+
+ /**
+ * I remove all entry associations
+ */
+ Site function removeAllEntries() {
+ if (hasEntry()) {
+ variables.entries.clear();
+ } else {
+ variables.entries = [];
+ }
+ return this;
+ }
+
+ /**
+ * I remove all menu associations
+ */
+ Site function removeAllMenus() {
+ if (hasMenu()) {
+ variables.menus.clear();
+ } else {
+ variables.menus = [];
+ }
+ return this;
+ }
+
+ /**
+ * I remove all page associations
+ */
+ Site function removeAllPages() {
+ if (hasPage()) {
+ variables.pages.clear();
+ } else {
+ variables.pages = [];
+ }
+ return this;
+ }
+
+ /**
+ * I remove all contentStore associations
+ */
+ Site function removeAllContentStore() {
+ if (hasContentStore()) {
+ variables.contentStore.clear();
+ } else {
+ variables.contentStore = [];
+ }
+ return this;
+ }
+
+ /**
+ * Get the site root URL as defined per the settings
+ */
+ string function getSiteRoot() {
+ var serverPort = getServerPort();
+ var domainName = this.getDomain();
+
+ // Return the appropriate site alias Uri from the domain aliases
+ // If the domain alias matches the incoming server host name
+ if (
+ getDomainAliases().some((alias) => alias.keyExists('domainRegex') &&
+ reFindNoCase(alias.domainRegex, getServerName()))
+ ) {
+ domainName = getServerName();
+ }
+
+ // Return the appropriate site Uri
+ return arrayToList(
+ [
+ 'http',
+ (this.getIsSSL() ? 's' : ''),
+ '://',
+ domainName,
+ (listFind('80,443', serverPort) ? '' : ':#serverPort#')
+ ],
+ ''
+ );
+ }
+
+ /**
+ * A nice snapshot of this entity used for mementifications
+ */
+ struct function getInfoSnapshot() {
+ if (isLoaded()) {
+ return {'siteID': getId(), 'slug': getSlug(), 'name': getName()};
+ }
+ return {};
+ }
+
+ /**
+ * Tries to get a category object by slug if assigned to this site
+ *
+ * @return The category object or null if not found
+ */
+ function getCategory(required slug) {
+ if (hasCategory()) {
+ var aFound = variables.categories.filter(function(thisCategory) {
+ return arguments.thisCategory.getSlug() == slug;
+ });
+ if (aFound.len()) {
+ return aFound[1];
+ }
+ }
+ }
+
+ /**
+ * We make sure we only return pages that have no parent to simulate the root hierarchy.
+ *
+ * @override
+ * @root Show only root level pages if enabled
+ */
+ function getPages(boolean root = true) {
+ if (!arguments.root) {
+ return variables.pages;
+ }
+ return variables.pages.filter(function(thisPage) {
+ return !arguments.thisPage.hasParent();
+ });
+ }
+
+ /**
+ * We make sure we only return contentStore that have no parent to simulate the root hierarchy.
+ *
+ * @override
+ * @root Show only root level contentStore if enabled
+ */
+ function getContentStore(boolean root = true) {
+ if (!arguments.root) {
+ return variables.contentStore;
+ }
+ return variables.contentStore.filter(function(thisContent) {
+ return !arguments.thisContent.hasParent();
+ });
+ }
+
+ /**
+ * Get the domain aliases
+ *
+ * @return The domain aliases as an array
+ */
+ array function getDomainAliases() {
+ return (
+ !isNull(variables.domainAliases) && isJSON(variables.domainAliases)
+ ? deserializeJSON(variables.domainAliases)
+ : []
+ );
+ }
+
+ /**
+ * Get the domain aliases as a string
+ *
+ * @return The domain aliases as a json string
+ */
+ string function getDomainAliasesAsJSON() {
+ return isNull(variables.domainAliases) ? '[]' : variables.domainAliases;
+ }
+
+ /**
+ * Set the domain aliases. If the value is an array, it will be serialized to JSON
+ * as domain aliases are stored as a JSON string.
+ *
+ * @aliases The domain aliases as an array or a JSON array string
+ */
+ Site function setDomainAliases(any aliases = []) {
+ variables.domainAliases = isSimpleValue(arguments.aliases)
+ ? arguments.aliases
+ : serializeJSON(arguments.aliases);
+ return this;
+ }
+
+ /**
+ * 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;
+ }
+
+ /**
+ * Get the server host according to lookup order
+ * 1. x-forwarded-host header
+ * 2. cgi.server_host
+ */
+ private function getServerName() {
+ var headers = getHTTPRequestData(false).headers;
+ if (structKeyExists(headers, 'x-forwarded-host') && len(headers['x-forwarded-host'])) {
+ return headers['x-forwarded-host'];
+ }
+ return cgi.server_name;
+ }
}
diff --git a/modules/contentbox/models/system/SiteService.cfc b/modules/contentbox/models/system/SiteService.cfc
index f48315eef0..b4b77f0de0 100644
--- a/modules/contentbox/models/system/SiteService.cfc
+++ b/modules/contentbox/models/system/SiteService.cfc
@@ -5,30 +5,34 @@
* ---
* Manage sites in ContentBox
*/
-component
- extends ="cborm.models.VirtualEntityService"
- accessors="true"
- threadsafe
- singleton
-{
-
+component extends ="cborm.models.VirtualEntityService" accessors="true" threadsafe singleton {
// DI
property name="cacheStorage" inject="cacheStorage@cbStorages";
+
property name="cookieStorage" inject="cookieStorage@cbStorages";
+
property name="requestStorage" inject="requestStorage@cbStorages";
+
property name="loadedModules" inject="coldbox:setting:modules";
+
property name="requestService" inject="coldbox:requestService";
+
property name="settingService" inject="provider:settingService@contentbox";
+
property name="categoryService" inject="provider:categoryService@contentbox";
+
property name="contentService" inject="provider:contentService@contentbox";
+
property name="menuService" inject="provider:menuService@contentbox";
+
property name="themeService" inject="provider:themeService@contentbox";
+
property name="mediaService" inject="provider:mediaService@contentbox";
/**
* Constructor
*/
- SiteService function init(){
+ SiteService function init() {
// init it
super.init( entityName = "cbSite" );
return this;
@@ -39,12 +43,12 @@ component
*
* @siteID The site to store as the current working one
*/
- SiteService function setCurrentWorkingsiteID( required siteID ){
+ SiteService function setCurrentWorkingsiteID( required siteID ) {
variables.cookieStorage.set(
- name : "contentbox_admin_current_site",
- value : arguments.siteID,
- expires: "never"
- );
+ name = "contentbox_admin_current_site",
+ value = arguments.siteID,
+ expires = "never"
+ );
return this;
}
@@ -52,33 +56,36 @@ component
* Get the current working site in the admin UI. We look in the cache first,
* if none is set, we use the `default` site.
*/
- function getCurrentWorkingsiteID(){
- return variables.cookieStorage.get( name: "contentbox_admin_current_site", defaultValue: getDefaultsiteID() );
+ function getCurrentWorkingsiteID() {
+ return variables.cookieStorage.get(
+ name = "contentbox_admin_current_site",
+ defaultValue = getDefaultsiteID()
+ );
}
/**
* Get the current working site in the admin UI. We look in the cache first,
* if none is set, we use the `default` site.
*/
- Site function getCurrentWorkingSite(){
+ Site function getCurrentWorkingSite() {
// Use request storage for acceleration
return variables.requestStorage.getOrSet(
- name : "contentbox-current-working-site",
- produce: function(){
- var oSite = newCriteria().isEq( "siteID", getCurrentWorkingsiteID() ).get();
- // Check if null, just in case
- return ( !isNull( oSite ) ? oSite : getDefaultSite() );
- }
- );
+ name = "contentbox-current-working-site",
+ produce = function() {
+ var oSite = newCriteria().isEq( "siteID", getCurrentWorkingsiteID() ).get();
+
+ return ( !isNull( oSite ) ? oSite : getDefaultSite() );
+ }
+ );
}
/**
* Get the default site Identifier
*/
- string function getDefaultsiteID(){
+ string function getDefaultsiteID() {
return newCriteria()
.isEq( "slug", "default" )
- .withProjections( property: "siteID" )
+ .withProjections( property = "siteID" )
.get();
}
@@ -87,56 +94,16 @@ component
* we make sure all proper settings are created and configured.
*
* @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 ){
- // Added this due to issue in CFML engines and mixed quuery+orm nested transactions. Remove once issue is fixed
- if ( arguments.transactional ) {
- transaction {
- _save( arguments.site );
- }
- } else {
- _save( arguments.site );
+ Site function save( required site ) {
+ transaction {
+ _save( arguments.site )
}
// flush cache to rebuild site settings
- variables.settingService.flushSettingsCache();
-
- return arguments.site;
- }
-
- /**
- * Save operation called by the transactional `save()` method
- * Due to transactional issues on Lucee
- */
- private function _save( required site ){
- // Create all site settings if this is a new site
- if ( !arguments.site.isLoaded() ) {
- variables.settingService.saveAll(
- variables.settingService
- .getSiteSettingDefaults()
- .reduce( function( result, setting, value ){
- arguments.result.append(
- variables.settingService.new( {
- name : arguments.setting,
- value : trim( arguments.value ),
- isCore : true,
- site : site
- } )
- );
- return arguments.result;
- }, [] )
- );
- }
+ variables.settingService.flushSettingsCache()
- // Persist the site
- super.save( arguments.site );
-
- // Activate the site's theme
- variables.themeService.startupTheme( name: arguments.site.getActiveTheme(), site: arguments.site );
-
- // Create media root folder for the site
- ensureSiteMediaFolder( arguments.site );
+ return arguments.site
}
/**
@@ -147,8 +114,8 @@ component
*
* @return True if it created it, false if it already existed.
*/
- boolean function ensureSiteMediaFolder( required site ){
- var siteRoot = variables.mediaService.getCoreMediaRoot( absolute: true ) & "/sites/" & arguments.site.getSlug();
+ boolean function ensureSiteMediaFolder( required site ) {
+ var siteRoot = variables.mediaService.getCoreMediaRoot( absolute = true ) & "/sites/" & arguments.site.getSlug();
if ( !directoryExists( siteRoot ) ) {
directoryCreate( siteRoot );
return true;
@@ -161,16 +128,17 @@ component
*
* @site The site to remove
*/
- SiteService function delete( required site ){
+ SiteService function delete( required site ) {
transaction {
// If on Adobe, run hard deletes due to Hibernate issue with cascade on integration tests.
if ( !server.keyExists( "lucee" ) ) {
- variables.settingService.deleteWhere( site: arguments.site );
- variables.contentService.deleteWhere( site: arguments.site );
- variables.categoryService.deleteWhere( site: arguments.site );
- variables.menuService.deleteWhere( site: arguments.site );
+ variables.settingService.deleteWhere( site = arguments.site );
+ variables.contentService.deleteWhere( site = arguments.site );
+ variables.categoryService.deleteWhere( site = arguments.site );
+ variables.menuService.deleteWhere( site = arguments.site );
}
- arguments.site
+ arguments
+ .site
.removeAllSettings()
.removeAllEntries()
.removeAllPages()
@@ -188,7 +156,7 @@ component
/**
* Get the default site object
*/
- Site function getDefaultSite(){
+ Site function getDefaultSite() {
return newCriteria().isEq( "slug", "default" ).get();
}
@@ -199,12 +167,17 @@ component
*
* @return array of { siteID, name, slug, domainRegex, domainAliases, isActive }
*/
- array function getAllFlat( boolean isActive ){
+ array function getAllFlat( boolean isActive ) {
return newCriteria()
- .when( !isNull( arguments.isActive ), function( c ){
- arguments.c.isEq( "this.isActive", javacast( "boolean", isActive ) );
- } )
- .withProjections( property: "siteID,name,slug,domainRegex,domainAliases,isActive" )
+ .when(
+ !isNull( arguments.isActive ),
+ function( c ) {
+ arguments.c.isEq( "this.isActive", javacast( "boolean", isActive ) );
+ }
+ )
+ .withProjections(
+ property = "siteID,name,slug,domainRegex,domainAliases,isActive"
+ )
.asStruct()
.list( sortOrder = "name" );
}
@@ -214,10 +187,10 @@ component
*
* @return array of { activeTheme:string, siteID:numeric }
*/
- array function getAllSiteThemes(){
+ array function getAllSiteThemes() {
return newCriteria()
.isFalse( "isDeleted" )
- .withProjections( distinct: "activeTheme,siteID" )
+ .withProjections( distinct = "activeTheme,siteID" )
.asStruct()
.list( sortOrder = "siteID" );
}
@@ -229,14 +202,17 @@ component
*
* @throws EntityNotFound
*/
- function getOrFail( required siteID ){
+ function getOrFail( required siteID ) {
var site = newCriteria().isEq( "siteID", arguments.siteID ).get();
if ( !isNull( site ) ) {
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"
+ );
}
/**
@@ -246,14 +222,17 @@ component
*
* @throws EntityNotFound
*/
- function getBySlugOrFail( required slug ){
+ function getBySlugOrFail( required slug ) {
var site = newCriteria().isEq( "slug", arguments.slug ).get();
if ( !isNull( site ) ) {
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"
+ );
}
/**
@@ -267,14 +246,13 @@ component
*
* @return The site object
*/
- Site function discoverSite(){
+ Site function discoverSite() {
var event = variables.requestService.getContext();
// Are we in the admin?
if (
- structKeyExists( variables.loadedModules, "contentbox-admin" )
- &&
- findNoCase( variables.loadedModules[ "contentbox-admin" ].entryPoint, event.getCurrentRoutedUrl() )
+ structKeyExists( variables.loadedModules, "contentbox-admin" ) &&
+ findNoCase( variables.loadedModules[ "contentbox-admin" ].entryPoint, event.getCurrentRoutedUrl() )
) {
return getCurrentWorkingSite();
}
@@ -306,23 +284,27 @@ component
// Try to discover using the requested full URL including host + path + query string for added flexibility
// Verify the site is valid, else continue search
- var matchedSite = getAllFlat( isActive: true ).filter( function( thisSite ){
- // direct regex match
- if ( reFindNoCase( arguments.thisSite[ "domainRegex" ], event.getFullUrl() ) ) {
- return true;
- }
-
- // Look at the site Domain Aliases for a match
- if ( isJSON( arguments.thisSite[ "domainAliases" ] ) ) {
- return arraySome( deserializeJSON( arguments.thisSite[ "domainAliases" ] ), function( alias ){
- return (
- structKeyExists( alias, "domainRegex" ) && reFindNoCase( alias.domainRegex, event.getFullUrl() )
- );
- } );
- }
+ var matchedSite = getAllFlat( isActive = true ).filter(
+ function( thisSite ) {
+ if ( reFindNoCase( arguments.thisSite[ "domainRegex" ], event.getFullUrl() ) ) {
+ return true;
+ }
+
+ if ( isJSON( arguments.thisSite[ "domainAliases" ] ) ) {
+ return arraySome(
+ deserializeJSON( arguments.thisSite[ "domainAliases" ] ),
+ function( alias ) {
+ return (
+ structKeyExists( alias, "domainRegex" ) &&
+ reFindNoCase( alias.domainRegex, event.getFullUrl() )
+ );
+ }
+ );
+ }
- return false;
- } );
+ return false;
+ }
+ );
// Return the first matched site
if ( arrayLen( matchedSite ) ) {
@@ -336,10 +318,12 @@ component
/**
* Get all sites for export
*/
- function getAllForExport(){
- return getAll().map( function( thisItem ){
- return thisItem.getMemento( profile: "export" );
- } );
+ function getAllForExport() {
+ return getAll().map(
+ function( thisItem ) {
+ return thisItem.getMemento( profile = "export" );
+ }
+ );
}
/**
@@ -352,14 +336,17 @@ component
*
* @throws InvalidImportFormat
*/
- string function importFromFile( required importFile, boolean override = false ){
- var data = fileRead( arguments.importFile );
+ string function importFromFile( required importFile, boolean override = false ) {
+ var data = fileRead( arguments.importFile );
var importLog = createObject( "java", "java.lang.StringBuilder" ).init(
- "Starting import with override = #arguments.override#... "
- );
+ "Starting import with override = #arguments.override#... "
+ );
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." );
@@ -385,38 +372,40 @@ component
required any importData,
boolean override = false,
required any importLog
- ){
+ ) {
// if struct, inflate into an array
if ( isStruct( arguments.importData ) ) {
- arguments.importData = [ arguments.importData ];
+ 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
for ( var thisSite in arguments.importData ) {
- var oSite = this.findBySlug( slug: thisSite.slug );
- oSite = ( isNull( oSite ) ? new () : oSite );
+ var oSite = this.findBySlug( slug = thisSite.slug );
+ oSite = ( isNull( oSite ) ? new() : oSite );
// if new or persisted with override then save.
if ( !oSite.isLoaded() ) {
variables.logger.info( "+ New site will be imported: #thisSite.slug#" );
arguments.importLog.append( "New site will be imported: #thisSite.slug# " );
importSite(
- site : oSite,
- memento : thisSite,
- importLog: arguments.importLog,
- override : arguments.override
+ site = oSite,
+ memento = thisSite,
+ importLog = arguments.importLog,
+ override = arguments.override
);
- } else if ( oSite.isLoaded() and arguments.override ) {
+ } else if ( oSite.isLoaded() && arguments.override ) {
variables.logger.info( "+ Overidding site: #thisSite.slug#" );
arguments.importLog.append( "Overriding site: #thisSite.slug# " );
importSite(
- site : oSite,
- memento : thisSite,
- importLog: arguments.importLog,
- override : arguments.override
+ site = oSite,
+ memento = thisSite,
+ importLog = arguments.importLog,
+ override = arguments.override
);
} else {
variables.logger.info( "!! Skipping persisted site: #thisSite.slug#" );
@@ -449,18 +438,18 @@ component
required memento,
required importLog,
required override
- ){
+ ) {
// Setup logging function
- var logThis = function( message ){
+ var logThis = function( message ) {
variables.logger.info( arguments.message );
importLog.append( arguments.message & " " );
};
transaction {
// Aliases
- var oSite = arguments.site;
- var siteData = arguments.memento;
- var populator = getBeanPopulator();
+ var oSite = arguments.site;
+ var siteData = arguments.memento;
+ var populator = getBeanPopulator();
// populate content from data and ignore relationships, we need to build those manually.
var excludedFields = [
"categories",
@@ -472,11 +461,11 @@ component
"settings"
];
populator.populateFromStruct(
- target = oSite,
- memento = siteData,
- exclude = arrayToList( excludedFields ),
- composeRelationships = false
- );
+ target = oSite,
+ memento = siteData,
+ exclude = arrayToList( excludedFields ),
+ composeRelationships = false
+ );
// Import Settings
if ( oSite.isLoaded() ) {
@@ -484,98 +473,111 @@ component
// If persisted, do cleanups
// If on Adobe, run hard deletes due to Hibernate issue with cascade on integration tests.
if ( !server.keyExists( "lucee" ) ) {
- variables.settingService.deleteWhere( site: oSite );
+ variables.settingService.deleteWhere( site = oSite );
}
oSite.removeAllSettings();
}
oSite.setSettings(
- siteData.settings.map( function( thisSetting ){
- // Avoid the boolean casting to string of hell!!
- arguments.thisSetting.value = toString( arguments.thisSetting.value );
- logThis( "+ Importing setting: (#thisSetting.name#) to site #oSite.getSlug()#" );
- return populator
- .populateFromStruct(
- target = variables.settingService.new(),
- memento = thisSetting,
- exclude = "site",
- composeRelationships = false
+ siteData.settings.map(
+ function( thisSetting ) {
+ arguments.thisSetting.value = toString( arguments.thisSetting.value );
+ logThis(
+ "+ Importing setting: (#thisSetting.name#) to site #oSite.getSlug()#"
+ );
+ return populator.populateFromStruct(
+ target = variables.settingService.new(),
+ memento = thisSetting,
+ exclude = "site",
+ composeRelationships = false
+ ).setSite( oSite );
+ }
)
- .setSite( oSite );
- } )
- );
+ );
logThis( "+ Site settings for #oSite.getSlug()# imported." );
// IMPORT CATEGORIES
if ( arrayLen( siteData.categories ) ) {
oSite.setCategories(
- siteData.categories.map( function( thisCategory ){
- logThis( "+ Importing category: (#thisCategory.slug#) to site #oSite.getSlug()#" );
- if ( oSite.isLoaded() ) {
- return variables.categoryService.getOrCreateBySlug(
- category: thisCategory.slug,
- site : oSite
- );
- }
- return variables.categoryService.new( {
- category : arguments.thisCategory.category,
- slug : arguments.thisCategory.slug,
- site : oSite
- } );
- } )
- );
+ siteData.categories.map(
+ function( thisCategory ) {
+ logThis(
+ "+ Importing category: (#thisCategory.slug#) to site #oSite.getSlug()#"
+ );
+ if ( oSite.isLoaded() ) {
+ return variables.categoryService.getOrCreateBySlug( category = thisCategory.slug,
+ site = oSite );
+ }
+ return variables.categoryService.new(
+ {
+ category: arguments.thisCategory.category,
+ slug : arguments.thisCategory.slug,
+ site : oSite
+ }
+ );
+ }
+ )
+ );
logThis( "+ Site categories for #oSite.getSlug()# imported." );
}
// 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()#" );
- getWireBox()
- .getInstance( "menuService@contentbox" )
- .importFromData(
- importData: siteData.menus,
- override : arguments.override,
- importLog : arguments.importLog,
- site : oSite
+ logThis(
+ "+ Importing menus (#arrayLen( siteData.menus )#) to site #arguments.site.getSlug()#"
+ );
+ getWireBox().getInstance( "menuService@contentbox" ).importFromData(
+ importData = siteData.menus,
+ override = arguments.override,
+ importLog = arguments.importLog,
+ 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()#" );
- getWireBox()
- .getInstance( "entryService@contentbox" )
- .importFromData(
- importData: siteData.entries,
- override : arguments.override,
- importLog : arguments.importLog,
- site : oSite
+ logThis(
+ "+ Importing entries (#arrayLen( siteData.entries )#) to site #arguments.site.getSlug()#"
+ );
+ getWireBox().getInstance( "entryService@contentbox" ).importFromData(
+ importData = siteData.entries,
+ override = arguments.override,
+ 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()#" );
- getWireBox()
- .getInstance( "pageService@contentbox" )
- .importFromData(
- importData: siteData.pages,
- override : arguments.override,
- importLog : arguments.importLog,
- site : oSite
+ logThis(
+ "+ Importing pages (#arrayLen( siteData.pages )#) to site #arguments.site.getSlug()#"
+ );
+ getWireBox().getInstance( "pageService@contentbox" ).importFromData(
+ importData = siteData.pages,
+ override = arguments.override,
+ importLog = arguments.importLog,
+ 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..." );
}
@@ -585,13 +587,11 @@ component
logThis(
"+ Importing contentStore (#arrayLen( siteData.contentStore )#) to site #arguments.site.getSlug()#"
);
- getWireBox()
- .getInstance( "contentStoreService@contentbox" )
- .importFromData(
- importData: siteData.contentStore,
- override : arguments.override,
- importLog : arguments.importLog,
- site : oSite
+ getWireBox().getInstance( "contentStoreService@contentbox" ).importFromData(
+ importData = siteData.contentStore,
+ override = arguments.override,
+ importLog = arguments.importLog,
+ site = oSite
);
logThis(
@@ -601,7 +601,52 @@ component
logThis( "!! No contentStore found on import data, skipping..." );
}
}
+
+
// end site transaction
}
-}
+ /**
+ * Save operation called by the transactional `save()` method
+ * Due to transactional issues on Lucee
+ */
+ private function _save( required site ) {
+ // Create all site settings if this is a new site
+ if ( !arguments.site.isLoaded() ) {
+ arguments.site.setSettings(
+ variables
+ .settingService
+ .getSiteSettingDefaults()
+ .reduce(
+ ( result, setting, value ) => {
+ arguments.result.append(
+ variables.settingService.new(
+ {
+ name : arguments.setting,
+ value : trim( arguments.value ),
+ isCore: true,
+ site : site
+ }
+ )
+ )
+ return arguments.result
+ },
+ []
+ )
+ )
+ }
+
+ // Persist the site
+ super.save( arguments.site )
+
+ // Activate the site's theme
+ variables.themeService.startupTheme(
+ name = arguments.site.getActiveTheme(),
+ site = arguments.site
+ )
+
+ // Create media root folder for the site
+ ensureSiteMediaFolder( arguments.site )
+ }
+
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/AdminMenuService.cfc b/modules/contentbox/models/ui/AdminMenuService.cfc
index c14e8d201f..4e29a24152 100755
--- a/modules/contentbox/models/ui/AdminMenuService.cfc
+++ b/modules/contentbox/models/ui/AdminMenuService.cfc
@@ -6,59 +6,61 @@
* Manages the admin menu services for the header and top menu
*/
component accessors="true" threadSafe singleton {
-
/**
* This holds the top menu structure
*/
property name="topMenu" type="array";
+
/**
* This is a reference map of the topMenu array
*/
property name="topMenuMap" type="struct";
+
/**
* This holds the header menu structure
*/
property name="headerMenu" type="array";
+
/**
* This holds the support menu structure
*/
property name="supportMenu" type="array";
+
/**
* This holds the utils menu structure
*/
property name="utilsMenu" type="array";
+
/**
* This holds the profile menu structure
*/
property name="profileMenu" type="array";
+
/**
* This is a reference map of the headerMenu array
*/
property name="headerMenuMap" type="struct";
+
/**
* Injected Avatar
*/
- property
- name ="avatar"
- type ="any"
- inject="Avatar@contentbox";
+ property name="avatar" type="any" inject="Avatar@contentbox";
// DI
property name="log" inject="logbox:logger:{this}";
-
// Top Menu Slugs
- this.DASHBOARD = "dashboard";
- this.CONTENT = "content";
- this.COMMENTS = "comments";
- this.LOOK_FEEL = "lookAndFeel";
- this.MODULES = "modules";
- this.USERS = "users";
- this.TOOLS = "tools";
- this.SYSTEM = "system";
+ this.DASHBOARD = "dashboard";
+ this.CONTENT = "content";
+ this.COMMENTS = "comments";
+ this.LOOK_FEEL = "lookAndFeel";
+ this.MODULES = "modules";
+ this.USERS = "users";
+ this.TOOLS = "tools";
+ this.SYSTEM = "system";
this.ADMIN_ENTRYPOINT = "";
// Header Menu Slugs
- this.HEADER_ABOUT = "about";
+ this.HEADER_ABOUT = "about";
this.HEADER_PROFILE = "profile";
/**
@@ -69,33 +71,33 @@ component accessors="true" threadSafe singleton {
* @coldbox ColdBox Handler
* @coldbox.inject coldbox
*/
- AdminMenuService function init( required requestService, required coldbox ){
+ AdminMenuService function init( required requestService, required coldbox ) {
// init menu array
- variables.topMenu = [];
+ variables.topMenu = [];
// init top menu structure holders
- variables.topMenuMap = {};
+ variables.topMenuMap = {};
// init header menu array
- variables.headerMenu = [];
+ variables.headerMenu = [];
// init header menu array
- variables.supportMenu = [];
+ variables.supportMenu = [];
// init header menu array
- variables.utilsMenu = [];
+ variables.utilsMenu = [];
// init header menu array
- variables.profileMenu = [];
+ variables.profileMenu = [];
// init profile menu structure
- variables.headerMenuMap = {};
+ variables.headerMenuMap = {};
// top menu pointer
- variables.thisTopMenu = "";
+ variables.thisTopMenu = "";
// header menu pointer
variables.thisHeaderMenu = "";
// store request service
variables.requestService = arguments.requestService;
// store coldbox
- variables.coldbox = arguments.coldbox;
+ variables.coldbox = arguments.coldbox;
// Store admin entry point
- this.ADMIN_ENTRYPOINT = arguments.coldbox.getSetting( "modules" )[ "contentbox-admin" ].entryPoint;
+ this.ADMIN_ENTRYPOINT = arguments.coldbox.getSetting( "modules" )[ "contentbox-admin" ].entryPoint;
// store module info
- variables.moduleConfig = arguments.coldbox.getSetting( "modules" )[ "contentbox" ];
+ variables.moduleConfig = arguments.coldbox.getSetting( "modules" )[ "contentbox" ];
// create default menus
createHeaderMenu();
createDefaultMenu();
@@ -108,13 +110,17 @@ component accessors="true" threadSafe singleton {
* @event The event context
* @menu The menu struct
*/
- function buildLIAttributes( required any event, required any menu ){
- var attributes = { "class" : "#menu.class#", "data-name" : "#menu.name#" };
+ function buildLIAttributes( required any event, required any menu ) {
+ var attributes = { "class": "#menu.class#", "data-name": "#menu.name#" };
if ( structKeyExists( menu, "id" ) && len( menu.id ) ) {
attributes[ "id" ] = menu.id;
}
if ( event.getPrivateValue( name = "tab#menu.name#", defaultValue = false ) ) {
- listAppend( attributes.class, "active", " " );
+ listAppend(
+ attributes.class,
+ "active",
+ " "
+ );
}
return createAttributeList( attributes );
}
@@ -130,8 +136,8 @@ component accessors="true" threadSafe singleton {
required any event,
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#";
@@ -182,7 +188,7 @@ component accessors="true" threadSafe singleton {
*
* @attributes The struct of attributes to build the list from
*/
- function createAttributeList( required struct attributes ){
+ function createAttributeList( required struct attributes ) {
var attributeList = "";
for ( var key in arguments.attributes ) {
attributeList &= "#key#=""#attributes[ key ]#""";
@@ -193,13 +199,13 @@ component accessors="true" threadSafe singleton {
/**
* Create the default ContentBox header menu contributions
*/
- AdminMenuService function createHeaderMenu(){
+ AdminMenuService function createHeaderMenu() {
var event = requestService.getContext();
// Exit Handlers
- var xehMyProfile = "#this.ADMIN_ENTRYPOINT#.authors.myprofile";
- var xehDoLogout = "#this.ADMIN_ENTRYPOINT#.security.doLogout";
- var xehAbout = "#this.ADMIN_ENTRYPOINT#.dashboard.about";
+ var xehMyProfile = "#this.ADMIN_ENTRYPOINT#.authors.myprofile";
+ var xehDoLogout = "#this.ADMIN_ENTRYPOINT#.security.doLogout";
+ var xehAbout = "#this.ADMIN_ENTRYPOINT#.dashboard.about";
var xehAdminAction = "#this.ADMIN_ENTRYPOINT#.dashboard.reload";
// Register Profile Menu
@@ -214,15 +220,14 @@ component accessors="true" threadSafe singleton {
label = " My Profile",
href = variables.buildLink,
href_to = xehMyProfile,
- data = { keybinding : "ctrl+shift+a" }
- )
- .addHeaderSubMenu(
+ data = { keybinding: "ctrl+shift+a" }
+ ).addHeaderSubMenu(
name = "logout",
title = "ctrl+shift+L",
label = " Logout",
href = variables.buildLink,
href_to = xehDoLogout,
- data = { keybinding : "ctrl+shift+l" }
+ data = { keybinding: "ctrl+shift+l" }
);
// Register modules reload menu
@@ -233,13 +238,14 @@ component accessors="true" threadSafe singleton {
itemType = "button",
itemClass = "btn btn-more options toggle",
permissions = "RELOAD_MODULES,RELOAD_CACHES",
- data = { placement : "right" },
+ data = { placement: "right" },
title = "Admin Actions"
- ).addHeaderSubMenu(
+ )
+ .addHeaderSubMenu(
name = "rsscache",
label = "Clear RSS Caches",
permissions = "RELOAD_CACHES",
- href = function( required menu, required event ){
+ href = function( required menu, required event ) {
return "javascript:adminAction( 'rss-purge', '#arguments.event.buildLink( xehAdminAction )#' )";
}
)
@@ -247,7 +253,7 @@ component accessors="true" threadSafe singleton {
name = "contentpurge",
label = "Clear Content Caches",
permissions = "RELOAD_CACHES",
- href = function( required menu, required event ){
+ href = function( required menu, required event ) {
return "javascript:adminAction( 'content-purge', '#arguments.event.buildLink( xehAdminAction )#' )";
}
)
@@ -255,7 +261,7 @@ component accessors="true" threadSafe singleton {
name = "cachepurge",
label = "Clear Template Cache",
permissions = "RELOAD_CACHES",
- href = function( required menu, required event ){
+ href = function( required menu, required event ) {
return "javascript:adminAction( 'cache-purge', '#arguments.event.buildLink( xehAdminAction )#' )";
}
)
@@ -263,7 +269,7 @@ component accessors="true" threadSafe singleton {
name = "app",
label = "Reload Application",
permissions = "RELOAD_MODULES",
- href = function( required menu, required event ){
+ href = function( required menu, required event ) {
return "javascript:adminAction( 'app', '#arguments.event.buildLink( xehAdminAction )#' )";
}
)
@@ -271,11 +277,11 @@ component accessors="true" threadSafe singleton {
name = "orm",
label = "Reload ORM",
permissions = "RELOAD_MODULES",
- href = function( required menu, required event ){
+ href = function( required menu, required event ) {
return "javascript:adminAction( 'orm', '#arguments.event.buildLink( xehAdminAction )#' )";
}
- )
- ;
+ );
+
return this;
}
@@ -286,7 +292,7 @@ component accessors="true" threadSafe singleton {
* @menu The menu info
* @event The request context
*/
- function buildLink( required menu, required event ){
+ function buildLink( required menu, required event ) {
// Normal a links
if ( structKeyExists( arguments.menu, "href_to" ) ) {
return arguments.event.buildLink( arguments.menu.href_to );
@@ -299,17 +305,17 @@ component accessors="true" threadSafe singleton {
/**
* Dynamic menu label
*/
- function buildProfileLabel(){
+ function buildProfileLabel() {
var event = requestService.getContext();
- var prc = event.getCollection( private = true );
+ var prc = event.getCollection( private = true );
savecontent variable="profileLabel" {
writeOutput(
variables.avatar.renderAvatar(
- email = prc.oCurrentAuthor.getEmail(),
- size = "35",
- class = "img-circle"
- )
+ email = prc.oCurrentAuthor.getEmail(),
+ size = "35",
+ class = "img-circle"
+ )
);
writeOutput( " " );
}
@@ -320,45 +326,45 @@ component accessors="true" threadSafe singleton {
/**
* Create the default ContentBox menu
*/
- AdminMenuService function createDefaultMenu(){
+ AdminMenuService function createDefaultMenu() {
var event = requestService.getContext();
- var prc = {};
+ var prc = {};
// Global Admin Exit Handlers
prc.xehDashboard = "#this.ADMIN_ENTRYPOINT#.dashboard";
// Entries Tab
- prc.xehEntries = "#this.ADMIN_ENTRYPOINT#.entries";
+ prc.xehEntries = "#this.ADMIN_ENTRYPOINT#.entries";
prc.xehEntriesEditor = "#this.ADMIN_ENTRYPOINT#.entries.editor";
- prc.xehCategories = "#this.ADMIN_ENTRYPOINT#.categories";
- prc.xehTemplates = "#this.ADMIN_ENTRYPOINT#.contentTemplates";
+ prc.xehCategories = "#this.ADMIN_ENTRYPOINT#.categories";
+ prc.xehTemplates = "#this.ADMIN_ENTRYPOINT#.contentTemplates";
// Content Tab
- prc.xehPages = "#this.ADMIN_ENTRYPOINT#.pages";
- prc.xehPagesEditor = "#this.ADMIN_ENTRYPOINT#.pages.editor";
+ prc.xehPages = "#this.ADMIN_ENTRYPOINT#.pages";
+ prc.xehPagesEditor = "#this.ADMIN_ENTRYPOINT#.pages.editor";
prc.xehContentStore = "#this.ADMIN_ENTRYPOINT#.contentstore";
prc.xehMediaManager = "#this.ADMIN_ENTRYPOINT#.mediamanager";
- prc.xehMenuManager = "#this.ADMIN_ENTRYPOINT#.menus";
+ prc.xehMenuManager = "#this.ADMIN_ENTRYPOINT#.menus";
// Comments Tab
- prc.xehComments = "#this.ADMIN_ENTRYPOINT#.comments";
+ prc.xehComments = "#this.ADMIN_ENTRYPOINT#.comments";
prc.xehCommentsettings = "#this.ADMIN_ENTRYPOINT#.comments.settings";
- prc.xehSubscribers = "#this.ADMIN_ENTRYPOINT#.subscribers";
+ prc.xehSubscribers = "#this.ADMIN_ENTRYPOINT#.subscribers";
// Look and Feel Tab
- prc.xehThemes = "#this.ADMIN_ENTRYPOINT#.themes";
+ prc.xehThemes = "#this.ADMIN_ENTRYPOINT#.themes";
prc.xehactiveTheme = "#this.ADMIN_ENTRYPOINT#.themes.active";
- prc.xehWidgets = "#this.ADMIN_ENTRYPOINT#.widgets";
- prc.xehGlobalHTML = "#this.ADMIN_ENTRYPOINT#.globalHTML";
+ prc.xehWidgets = "#this.ADMIN_ENTRYPOINT#.widgets";
+ prc.xehGlobalHTML = "#this.ADMIN_ENTRYPOINT#.globalHTML";
// Modules
prc.xehModules = "#this.ADMIN_ENTRYPOINT#.modules";
// Authors Tab
- prc.xehAuthors = "#this.ADMIN_ENTRYPOINT#.authors";
- prc.xehAuthorEditor = "#this.ADMIN_ENTRYPOINT#.authors.editor";
- prc.xehPermissions = "#this.ADMIN_ENTRYPOINT#.permissions";
- prc.xehRoles = "#this.ADMIN_ENTRYPOINT#.roles";
+ prc.xehAuthors = "#this.ADMIN_ENTRYPOINT#.authors";
+ prc.xehAuthorEditor = "#this.ADMIN_ENTRYPOINT#.authors.editor";
+ prc.xehPermissions = "#this.ADMIN_ENTRYPOINT#.permissions";
+ prc.xehRoles = "#this.ADMIN_ENTRYPOINT#.roles";
prc.xehPermissionGroups = "#this.ADMIN_ENTRYPOINT#.permissionGroups";
// Tools
@@ -366,12 +372,12 @@ component accessors="true" threadSafe singleton {
prc.xehToolsExport = "#this.ADMIN_ENTRYPOINT#.tools.exporter";
// System
- prc.xehSettings = "#this.ADMIN_ENTRYPOINT#.settings";
- prc.xehSitesManager = "#this.ADMIN_ENTRYPOINT#.sites";
+ prc.xehSettings = "#this.ADMIN_ENTRYPOINT#.settings";
+ prc.xehSitesManager = "#this.ADMIN_ENTRYPOINT#.sites";
prc.xehSecurityRules = "#this.ADMIN_ENTRYPOINT#.securityrules";
- prc.xehRawSettings = "#this.ADMIN_ENTRYPOINT#.settings.raw";
- prc.xehAuthLogs = "#this.ADMIN_ENTRYPOINT#.settings.authLogs";
- prc.xehAbout = "#this.ADMIN_ENTRYPOINT#.about";
+ prc.xehRawSettings = "#this.ADMIN_ENTRYPOINT#.settings.raw";
+ prc.xehAuthLogs = "#this.ADMIN_ENTRYPOINT#.settings.authLogs";
+ prc.xehAbout = "#this.ADMIN_ENTRYPOINT#.about";
// Dashboard
addTopMenu(
@@ -382,7 +388,10 @@ component accessors="true" threadSafe singleton {
);
// Content
- addTopMenu( name = this.CONTENT, label = " Content" )
+ addTopMenu(
+ name = this.CONTENT,
+ label = " Content"
+ )
.addSubMenu(
name = "Pages",
label = "Sitemap",
@@ -435,7 +444,10 @@ component accessors="true" threadSafe singleton {
);
// Comments
- addTopMenu( name = this.COMMENTS, label = " Comments" )
+ addTopMenu(
+ name = this.COMMENTS,
+ label = " Comments"
+ )
.addSubMenu(
name = "Inbox",
label = "Inbox",
@@ -459,7 +471,10 @@ component accessors="true" threadSafe singleton {
);
// Look and Feel
- addTopMenu( name = this.LOOK_FEEL, label = " Look & Feel" )
+ addTopMenu(
+ name = this.LOOK_FEEL,
+ label = " Look & Feel"
+ )
.addSubMenu(
name = "activetheme",
label = "Active Theme",
@@ -495,11 +510,11 @@ component accessors="true" threadSafe singleton {
label = " Modules",
permissions = "MODULES_ADMIN"
).addSubMenu(
- name = "Manage",
- label = "Manage",
- href = variables.buildLink,
- href_to = prc.xehModules
- );
+ name = "Manage",
+ label = "Manage",
+ href = variables.buildLink,
+ href_to = prc.xehModules
+ );
// User
addTopMenu( name = this.USERS, label = " Users" )
@@ -533,15 +548,16 @@ component accessors="true" threadSafe singleton {
);
// Tools
- addTopMenu( name = this.TOOLS, label = " Tools" )
- .addSubMenu(
+ addTopMenu(
+ name = this.TOOLS,
+ label = " Tools"
+ ).addSubMenu(
name = "Import",
label = "Import",
href = variables.buildLink,
href_to = prc.xehToolsImport,
permissions = "TOOLS_IMPORT"
- )
- .addSubMenu(
+ ).addSubMenu(
name = "Export",
label = "Export",
href = variables.buildLink,
@@ -554,7 +570,8 @@ component accessors="true" threadSafe singleton {
name = this.SYSTEM,
label = " System",
permissions = "SYSTEM_TAB"
- ).addSubMenu(
+ )
+ .addSubMenu(
name = "AuthLogs",
label = "Auth Logs",
href = variables.buildLink,
@@ -581,7 +598,7 @@ component accessors="true" threadSafe singleton {
label = "Settings",
href = variables.buildLink,
href_to = prc.xehSettings,
- data = { "keybinding" : "ctrl+shift+c" }
+ data = { "keybinding": "ctrl+shift+c" }
)
.addSubMenu(
name = "SecurityRules",
@@ -613,23 +630,23 @@ component accessors="true" threadSafe singleton {
required string to,
queryString = "",
boolean ssl = false
- ){
+ ) {
var event = requestService.getContext();
// Remove by 6.x
if ( !isNull( arguments.linkTo ) ) {
arguments.to = arguments.linkTo;
}
return event.buildLink(
- to = "#this.ADMIN_ENTRYPOINT#.module.#arguments.module#.#arguments.to#",
- queryString = arguments.queryString,
- ssl = arguments.ssl
- );
+ to = "#this.ADMIN_ENTRYPOINT#.module.#arguments.module#.#arguments.to#",
+ queryString = arguments.queryString,
+ ssl = arguments.ssl
+ );
}
/**
* @name The name of the top menu
*/
- AdminMenuService function withTopMenu( required name ){
+ AdminMenuService function withTopMenu( required name ) {
thisTopMenu = arguments.name;
return this;
}
@@ -639,7 +656,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the header menu
*/
- AdminMenuService function withHeaderMenu( required name ){
+ AdminMenuService function withHeaderMenu( required name ) {
thisHeaderMenu = arguments.name;
return this;
}
@@ -673,11 +690,11 @@ component accessors="true" threadSafe singleton {
itemType = "a",
itemClass = "",
itemId = ""
- ){
+ ) {
// stash pointer
- variables.thisTopMenu = arguments.name;
+ variables.thisTopMenu = arguments.name;
// store new top menu in reference map
- variables.topMenuMap[ arguments.name ] = { submenu : [] };
+ variables.topMenuMap[ arguments.name ] = { submenu: [] };
structAppend(
variables.topMenuMap[ arguments.name ],
arguments,
@@ -718,11 +735,11 @@ component accessors="true" threadSafe singleton {
itemType = "a",
itemClass = "",
itemId = ""
- ){
+ ) {
// stash pointer
- variables.thisHeaderMenu = arguments.name;
+ variables.thisHeaderMenu = arguments.name;
// store new top menu in reference map
- variables.headerMenuMap[ arguments.name ] = { submenu : [] };
+ variables.headerMenuMap[ arguments.name ] = { submenu: [] };
structAppend(
variables.headerMenuMap[ arguments.name ],
@@ -766,20 +783,22 @@ component accessors="true" threadSafe singleton {
itemType = "a",
itemClass = "",
itemId = ""
- ){
+ ) {
// Check if thisTopMenu set?
- if ( !len( thisTopMenu ) AND !structKeyExists( arguments, "topMenu" ) ) {
+ if ( !len( thisTopMenu ) && !structKeyExists( arguments, "topMenu" ) ) {
throw( "No top menu passed or concatenated with" );
}
// check this pointer
- if ( len( thisTopMenu ) AND !structKeyExists( arguments, "topMenu" ) ) {
+ if ( len( thisTopMenu ) && !structKeyExists( arguments, "topMenu" ) ) {
arguments.topmenu = thisTopMenu;
}
// store in top menu
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;
@@ -816,14 +835,14 @@ component accessors="true" threadSafe singleton {
itemType = "a",
itemClass = "",
itemId = ""
- ){
+ ) {
// Check if thisTopMenu set?
- if ( !len( thisHeaderMenu ) AND !structKeyExists( arguments, "headerMenu" ) ) {
+ if ( !len( thisHeaderMenu ) && !structKeyExists( arguments, "headerMenu" ) ) {
throw( "No header menu passed or concatenated with" );
}
// check this pointer
- if ( len( thisHeaderMenu ) AND !structKeyExists( arguments, "headerMenu" ) ) {
+ if ( len( thisHeaderMenu ) && !structKeyExists( arguments, "headerMenu" ) ) {
arguments.headerMenu = thisHeaderMenu;
}
@@ -831,7 +850,9 @@ component accessors="true" threadSafe singleton {
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
@@ -844,17 +865,17 @@ component accessors="true" threadSafe singleton {
* @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
*/
- AdminMenuService function removeSubMenu( required topMenu, required name ){
+ AdminMenuService function removeSubMenu( required topMenu, required name ) {
// Verify top menu exists, else just return
if ( !variables.topMenuMap.keyExists( arguments.topMenu ) ) {
log.warn(
- "Cannot remove submenu (#arguments.name#) as the top menu requested (#arguments.topMenu#) does not exist"
- );
+ "Cannot remove submenu (#arguments.name#) as the top menu requested (#arguments.topMenu#) does not exist"
+ );
return this;
}
- for ( var x = 1; x lte arrayLen( variables.topMenuMap[ arguments.topMenu ].subMenu ); x++ ) {
- if ( variables.topMenuMap[ arguments.topMenu ].subMenu[ x ].name eq arguments.name ) {
+ for ( var x = 1; x LTE arrayLen( variables.topMenuMap[ arguments.topMenu ].subMenu ); x++ ) {
+ if ( variables.topMenuMap[ arguments.topMenu ].subMenu[ x ].name EQ arguments.name ) {
arrayDeleteAt( variables.topMenuMap[ arguments.topMenu ].subMenu, x );
break;
}
@@ -870,17 +891,17 @@ component accessors="true" threadSafe singleton {
* @headerMenu The optional header menu name to remove from
* @name The sub menu to remove
*/
- AdminMenuService function removeHeaderSubMenu( required headerMenu, required name ){
+ AdminMenuService function removeHeaderSubMenu( required headerMenu, required name ) {
// Verify top menu exists, else just return
if ( !variables.headerMenuMap.keyExists( arguments.headerMenu ) ) {
log.warn(
- "Cannot remove submenu (#arguments.name#) as the header menu requested (#arguments.headerMenu#) does not exist"
- );
+ "Cannot remove submenu (#arguments.name#) as the header menu requested (#arguments.headerMenu#) does not exist"
+ );
return this;
}
- for ( var x = 1; x lte arrayLen( variables.headerMenuMap[ arguments.headerMenu ].subMenu ); x++ ) {
- if ( variables.headerMenuMap[ arguments.headerMenu ].subMenu[ x ].name eq arguments.name ) {
+ 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;
}
@@ -895,11 +916,11 @@ component accessors="true" threadSafe singleton {
*
* @topMenu The optional top menu name to add this sub level menu to or if concatenated then it uses that one.
*/
- AdminMenuService function removeTopMenu( required topMenu ){
+ AdminMenuService function removeTopMenu( required topMenu ) {
var found = false;
- for ( var x = 1; x lte arrayLen( variables.topMenu ); x++ ) {
- if ( variables.topMenu[ x ].name eq arguments.topMenu ) {
+ for ( var x = 1; x LTE arrayLen( variables.topMenu ); x++ ) {
+ if ( variables.topMenu[ x ].name EQ arguments.topMenu ) {
found = true;
arrayDeleteAt( variables.topMenu, x );
structDelete( variables.topMenuMap, arguments.topMenu );
@@ -908,7 +929,9 @@ component accessors="true" threadSafe singleton {
}
if ( !found ) {
- log.warn( "Top menu: #arguments.topMenu# not found when calling removeTopMenu" );
+ log.warn(
+ "Top menu: #arguments.topMenu# not found when calling removeTopMenu"
+ );
}
// return
@@ -920,11 +943,11 @@ component accessors="true" threadSafe singleton {
*
* @headerMenu The header menu unique name to remove
*/
- AdminMenuService function removeHeaderMenu( required headerMenu ){
+ AdminMenuService function removeHeaderMenu( required headerMenu ) {
var found = false;
- for ( var x = 1; x lte arrayLen( variables.headerMenu ); x++ ) {
- if ( variables.headerMenu[ x ].name eq arguments.headerMenu ) {
+ for ( var x = 1; x LTE arrayLen( variables.headerMenu ); x++ ) {
+ if ( variables.headerMenu[ x ].name EQ arguments.headerMenu ) {
found = true;
arrayDeleteAt( variables.headerMenu, x );
structDelete( variables.headerMenuMap, arguments.headerMenu );
@@ -933,7 +956,9 @@ component accessors="true" threadSafe singleton {
}
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
@@ -941,12 +966,12 @@ component accessors="true" threadSafe singleton {
}
/**
- * Generate main top admin menu navigation bar
+ * Generate main top admin menu navigation bar
*/
- any function generateMenu(){
- var event = requestService.getContext();
- var prc = event.getCollection( private = true );
- var genMenu = "";
+ any function generateMenu() {
+ var event = requestService.getContext();
+ var prc = event.getCollection( private = true );
+ var genMenu = "";
var thisMenu = variables.topMenu;
savecontent variable="genMenu" {
@@ -960,10 +985,10 @@ component accessors="true" threadSafe singleton {
/**
* Generate the header menu
*/
- any function generateHeaderMenu(){
- var event = requestService.getContext();
- var prc = event.getCollection( private = true );
- var genMenu = "";
+ any function generateHeaderMenu() {
+ var event = requestService.getContext();
+ var prc = event.getCollection( private = true );
+ var genMenu = "";
var thisMenu = variables.headerMenu;
savecontent variable="genMenu" {
@@ -977,10 +1002,10 @@ component accessors="true" threadSafe singleton {
/**
* Generate the utility menu
*/
- any function generateUtilsMenu(){
- var event = requestService.getContext();
- var prc = event.getCollection( private = true );
- var genMenu = "";
+ any function generateUtilsMenu() {
+ var event = requestService.getContext();
+ var prc = event.getCollection( private = true );
+ var genMenu = "";
var thisMenu = variables.headerMenuMap[ "utils" ];
savecontent variable="genMenu" {
@@ -994,10 +1019,10 @@ component accessors="true" threadSafe singleton {
/**
* Generate dynamic profile menu
*/
- any function generateProfileMenu(){
- var event = requestService.getContext();
- var prc = event.getCollection( private = true );
- var genMenu = "";
+ any function generateProfileMenu() {
+ var event = requestService.getContext();
+ var prc = event.getCollection( private = true );
+ var genMenu = "";
var thisMenu = variables.headerMenuMap[ "profile" ];
savecontent variable="genMenu" {
@@ -1013,7 +1038,7 @@ component accessors="true" threadSafe singleton {
*
* @data The data struct
*/
- string function parseADataAttributes( required struct data ){
+ string function parseADataAttributes( required struct data ) {
var dataString = "";
for ( var dataKey in arguments.data ) {
@@ -1025,4 +1050,4 @@ component accessors="true" threadSafe singleton {
return dataString;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/Avatar.cfc b/modules/contentbox/models/ui/Avatar.cfc
index 37aa0c8829..31c26b77a5 100755
--- a/modules/contentbox/models/ui/Avatar.cfc
+++ b/modules/contentbox/models/ui/Avatar.cfc
@@ -1,16 +1,16 @@
-/*
+/*
* An avatar model object for ContentBox
*/
component singleton {
-
// DI
property name="requestService" inject="coldbox:requestService";
+
property name="requestStorage" inject="requestStorage@cbStorages";
/**
* Constructor
*/
- function init(){
+ function init() {
return this;
}
@@ -24,7 +24,7 @@ component singleton {
required email,
numeric size = 80,
rating = "PG"
- ){
+ ) {
return "//www.gravatar.com/avatar.php?gravatar_id=#lCase( hash( arguments.email ) )#&s=#arguments.size#&r=#rating#";
}
@@ -39,29 +39,38 @@ component singleton {
required email,
numeric size = 80,
string class = "gravatar"
- ){
+ ) {
// check settings
- var prc = variables.requestService.getContext().getPrivateCollection();
- if ( NOT prc.cbSettings.cb_gravatar_display ) {
+ var prc = variables
+ .requestService
+ .getContext()
+ .getPrivateCollection();
+ if ( !prc.cbSettings.cb_gravatar_display ) {
return "";
}
// Build out avatar
- return variables.requestStorage.getOrSet( "avatar-#hash( arguments.toString() )#", function(){
- // render it out
- savecontent variable="local.avatar" {
- writeOutput(
- "
+ return variables.requestStorage.getOrSet(
+ "avatar-#hash( arguments.toString() )#",
+ function() {
+ savecontent variable="local.avatar" {
+ writeOutput(
+ "
"
- );
- }
- return local.avatar;
- } );
+ );
+ }
+ return local.avatar;
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/BaseWidget.cfc b/modules/contentbox/models/ui/BaseWidget.cfc
index 93b3677422..3e527567ce 100644
--- a/modules/contentbox/models/ui/BaseWidget.cfc
+++ b/modules/contentbox/models/ui/BaseWidget.cfc
@@ -1,81 +1,70 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
* ---
* This is the base class for contentbox widgets which gives them access to ContentBox and ColdBox.
*/
-component accessors="true" extends="coldbox.system.FrameworkSupertype" {
-
+component accessors="true" extends ="coldbox.system.FrameworkSupertype" {
// Shared DI all widgets receive
property name="siteService" inject="siteService@contentbox";
+
property name="categoryService" inject="categoryService@contentbox";
+
property name="entryService" inject="entryService@contentbox";
+
property name="pageService" inject="pageService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
+
property name="contentVersionService" inject="contentVersionService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
+
property name="commentService" inject="commentService@contentbox";
+
property name="contentStoreService" inject="contentStoreService@contentbox";
+
property name="menuService" inject="menuService@contentbox";
+
property name="cb" inject="CBHelper@contentbox";
+
property name="securityService" inject="securityService@contentbox";
+
property name="html" inject="HTMLHelper@coldbox";
+
property name="controller" inject="coldbox";
+
property name="log" inject="logbox:logger:{this}";
// Local Properties
- property
- name ="name"
- type ="string"
- default="";
-
- property
- name ="version"
- type ="string"
- default="";
-
- property
- name ="description"
- type ="string"
- default="";
-
- property
- name ="author"
- type ="string"
- default="";
-
- property
- name ="authorURL"
- type ="string"
- default="";
-
- property
- name ="forgeBoxSlug"
- type ="string"
- default="";
-
- property
- name ="category"
- type ="string"
- default="";
-
- property
- name ="icon"
- type ="string"
- default="";
+ property name="name" type="string" default="";
+
+ property name="version" type="string" default="";
+
+ property name="description" type="string" default="";
+
+ property name="author" type="string" default="";
+
+ property name="authorURL" type="string" default="";
+
+ property name="forgeBoxSlug" type="string" default="";
+
+ property name="category" type="string" default="";
+
+ property name="icon" type="string" default="";
/**
* Base Constructor
*/
- function init(){
- variables.name = "";
- variables.version = "";
+ function init() {
+ variables.name = "";
+ variables.version = "";
variables.description = "";
- variables.author = "";
- variables.authorURL = "";
- variables.category = "";
- variables.icon = "";
+ variables.author = "";
+ variables.authorURL = "";
+ variables.category = "";
+ variables.icon = "";
return this;
}
@@ -85,8 +74,11 @@ 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" );
+ any function renderIt() {
+ throw(
+ message = "This is a base method that you must implement",
+ type = "BaseClassException"
+ );
}
/**
@@ -94,10 +86,10 @@ component accessors="true" extends="coldbox.system.FrameworkSupertype" {
*
* @return array
*/
- array function getPublicMethods(){
+ array function getPublicMethods() {
var publicMethods = [];
- var meta = getMetadata( this );
- var method = "";
+ var meta = getMetadata( this );
+ var method = "";
for ( var i = 1; i <= arrayLen( meta.functions ); i++ ) {
method = meta.functions[ i ];
@@ -108,9 +100,8 @@ component accessors="true" extends="coldbox.system.FrameworkSupertype" {
// Add conditions
if ( !listContains( "init,onMissingMethod", method.name ) ) {
if (
- !structKeyExists( method, "access" ) || (
- structKeyExists( method, "access" ) && !listContains( "private,package", method.access )
- )
+ !structKeyExists( method, "access" ) ||
+ ( structKeyExists( method, "access" ) && !listContains( "private,package", method.access ) )
) {
arrayAppend( publicMethods, method );
}
@@ -122,7 +113,7 @@ component accessors="true" extends="coldbox.system.FrameworkSupertype" {
/**
* Detect if we are in admin mode or in the UI, and retrieve the site accordingly
*/
- function getSite(){
+ function getSite() {
if ( findNoCase( variables.cb.adminRoot(), getRequestContext().getCurrentRoutedUrl() ) ) {
return variables.siteService.getCurrentWorkingSite();
}
@@ -130,4 +121,4 @@ component accessors="true" extends="coldbox.system.FrameworkSupertype" {
return variables.cb.site();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/Paging.cfc b/modules/contentbox/models/ui/Paging.cfc
index 9df7ab286a..4954a7f37b 100755
--- a/modules/contentbox/models/ui/Paging.cfc
+++ b/modules/contentbox/models/ui/Paging.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -41,23 +41,24 @@
* @author Luis Majano
*/
component accessors="true" singleton threadsafe {
-
// DI
property name="controller" inject="coldbox";
+
property name="settingService" inject="settingService@contentbox";
// Properties
property name="pagingMaxRows";
+
property name="PagingBandGap";
/**
* Constructor
*/
- function init(){
+ function init() {
return this;
}
- function onDIComplete(){
+ function onDIComplete() {
// Setup Paging Properties
setPagingMaxRows( variables.settingService.getSetting( "cb_paging_maxrows" ) );
setPagingBandGap( variables.settingService.getSetting( "cb_paging_bandgap" ) );
@@ -71,15 +72,15 @@ component accessors="true" singleton threadsafe {
*
* @return struct of { startrow:numeric, maxrow:numeric }
*/
- struct function getBoundaries( numeric pagingMaxRows, numeric page ){
- var boundaries = { "startrow" : 1, "maxrow" : 0 };
- var event = getController().getRequestService().getContext();
- var maxRows = !isNull( arguments.pagingMaxRows ) ? arguments.pagingMaxRows : getPagingMaxRows();
+ struct function getBoundaries( numeric pagingMaxRows, numeric page ) {
+ var boundaries = { "startrow": 1, "maxrow": 0 };
+ var event = getController().getRequestService().getContext();
+ var maxRows = !isNull( arguments.pagingMaxRows ) ? arguments.pagingMaxRows : getPagingMaxRows();
arguments.page = isNull( arguments.page ) ? event.getValue( "page", 1 ) : arguments.page;
boundaries.startrow = ( arguments.page * maxrows - maxRows ) + 1;
- boundaries.maxrow = boundaries.startrow + maxRows - 1;
+ boundaries.maxrow = boundaries.startrow + maxRows - 1;
return boundaries;
}
@@ -99,24 +100,33 @@ component accessors="true" singleton threadsafe {
numeric pagingMaxRows,
boolean asList = false,
numeric page
- ){
- var event = variables.controller.getRequestService().getContext();
- var currentPage = isNull( arguments.page ) ? event.getValue( "page", 1 ) : arguments.page;
+ ) {
+ var event = variables
+ .controller
+ .getRequestService()
+ .getContext();
+ var currentPage = isNull( arguments.page ) ? event.getValue( "page", 1 ) : arguments.page;
var pagingTabsUI = "";
- var maxRows = !isNull( arguments.pagingMaxRows ) ? arguments.pagingMaxRows : getPagingMaxRows();
- var bandGap = getPagingBandGap();
- var theLink = arguments.link;
- var pageFrom = 0;
- var pageTo = 0;
- var pageIndex = 0;
+ var maxRows = !isNull( arguments.pagingMaxRows ) ? arguments.pagingMaxRows : getPagingMaxRows();
+ var bandGap = getPagingBandGap();
+ var theLink = arguments.link;
+ var pageFrom = 0;
+ var pageTo = 0;
+ var pageIndex = 0;
// Only page if records found
if ( arguments.foundRows > 0 ) {
// Calculate Total Pages
var totalPages = ceiling( arguments.foundRows / maxRows );
- if ( currentPage gt totalPages ) {
- variables.controller.relocate( url: replace( theLink, "@page@", totalPages ) );
+ if ( currentPage GT totalPages ) {
+ variables.controller.relocate(
+ url = replace(
+ theLink,
+ "@page@",
+ totalPages
+ )
+ );
}
savecontent variable="pagingTabsUI" {
@@ -127,4 +137,4 @@ component accessors="true" singleton threadsafe {
return pagingTabsUI;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/Paging.cfm b/modules/contentbox/models/ui/Paging.cfm
index 92b958cf95..f489387921 100644
--- a/modules/contentbox/models/ui/Paging.cfm
+++ b/modules/contentbox/models/ui/Paging.cfm
@@ -1,60 +1,177 @@
-
-
-
-
- Showing #start# to #end# of #arguments.FoundRows# entries (#totalPages# pages)
-
+
+
+
+
+ Showing #start# to #end# of #arguments.FoundRows# entries (#totalPages# pages)
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <<
+
+
-
-
-
-
- <<
-
-
-
-
-
-
-
- 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1
...
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- " tabindex="0">
- class="selected active" >#pageIndex#
-
-
-
-
-
-
+
+
+
+
+ " tabindex="0">
+
+
+
+
+
+
+
+
+
+
+
+ class="selected active"
+
+
+
+
+
+ >#pageIndex#
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
...
- #totalPages#
-
-
+
#totalPages#
-
-
-
- >>
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/ThemeService.cfc b/modules/contentbox/models/ui/ThemeService.cfc
index f4ed0332e9..11f67dcb55 100644
--- a/modules/contentbox/models/ui/ThemeService.cfc
+++ b/modules/contentbox/models/ui/ThemeService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,18 +6,26 @@
* Manages ContentBox themes
*/
component accessors="true" threadSafe singleton {
-
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
// Provide this one in, due to chicken and the egg issues.
property name="widgetService" inject="provider:widgetService@contentbox";
+
property name="moduleSettings" inject="coldbox:setting:modules";
+
property name="interceptorService" inject="coldbox:interceptorService";
+
property name="log" inject="logbox:logger:{this}";
+
property name="wirebox" inject="wirebox";
+
property name="html" inject="HTMLHelper@coldbox";
+
property name="cbHelper" inject="provider:CBHelper@contentbox";
+
property name="moduleService" inject="coldbox:moduleService";
/**
@@ -43,12 +51,12 @@ component accessors="true" threadSafe singleton {
/**
* Constructor
*/
- ThemeService function init(){
+ ThemeService function init() {
// init properties
- variables.themeRegistry = {};
- variables.coreThemesPath = "";
+ variables.themeRegistry = {};
+ variables.coreThemesPath = "";
variables.customThemesPath = "";
- variables.widgetCache = {};
+ variables.widgetCache = {};
return this;
}
@@ -56,9 +64,9 @@ component accessors="true" threadSafe singleton {
/**
* onDIComplete startup the theming services according to loaded module data
*/
- void function onDIComplete(){
+ void function onDIComplete() {
// setup location paths
- variables.coreThemesPath = variables.moduleSettings[ "contentbox" ].path & "/themes";
+ variables.coreThemesPath = variables.moduleSettings[ "contentbox" ].path & "/themes";
variables.customThemesPath = variables.moduleSettings[ "contentbox-custom" ].path & "/_themes";
// Register all themes
@@ -68,18 +76,26 @@ component accessors="true" threadSafe singleton {
/**
* Does the current active theme have a maintenance view
*/
- boolean function themeMaintenanceViewExists(){
- return fileExists( expandPath( variables.CBHelper.themeRoot() & "/views/maintenance.cfm" ) );
+ boolean function themeMaintenanceViewExists() {
+ return fileExists(
+ expandPath( variables.CBHelper.themeRoot() & "/views/maintenance.cfm" )
+ );
}
/**
* Get the current active theme's maintenance layout
*/
- string function getThemeMaintenanceLayout(){
+ string function getThemeMaintenanceLayout() {
var layout = "pages";
// verify existence of convention
- if ( fileExists( expandPath( variables.CBHelper.themeRoot() & "/layouts/maintenance.cfm" ) ) ) {
+ if (
+ fileExists(
+ expandPath(
+ variables.CBHelper.themeRoot() & "/layouts/maintenance.cfm"
+ )
+ )
+ ) {
layout = "maintenance";
}
@@ -92,13 +108,19 @@ component accessors="true" threadSafe singleton {
* @format export format
* @layout layout name
*/
- string function getThemePrintLayout( required format, required layout ){
+ string function getThemePrintLayout( required format, required layout ) {
// some cleanup, just in case
- arguments.layout = replaceNoCase( arguments.layout, ".cfm", "" );
+ arguments.layout = replaceNoCase(
+ arguments.layout,
+ ".cfm",
+ ""
+ );
// 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#";
@@ -110,11 +132,15 @@ component accessors="true" threadSafe singleton {
/**
* Get the current theme's search layout
*/
- string function getThemeSearchLayout(){
+ string function getThemeSearchLayout() {
var layout = "pages";
// verify existence of convention
- if ( fileExists( expandPath( variables.CBHelper.themeRoot() & "/layouts/search.cfm" ) ) ) {
+ if (
+ fileExists(
+ expandPath( variables.CBHelper.themeRoot() & "/layouts/search.cfm" )
+ )
+ ) {
layout = "search";
}
@@ -126,14 +152,21 @@ component accessors="true" threadSafe singleton {
*
* @widgetName The name of the widget
*/
- string function getThemeWidgetInvocationPath( required string widgetName ){
- var path = "";
- var parsedName = replaceNoCase( arguments.widgetName, "~", "", "one" );
+ string function getThemeWidgetInvocationPath( required string widgetName ) {
+ var path = "";
+ var parsedName = replaceNoCase(
+ arguments.widgetName,
+ "~",
+ "",
+ "one"
+ );
// if requested widget exists in the cache, return the path
if ( structKeyExists( variables.widgetCache, parsedName ) ) {
path = variables.widgetCache[ parsedName ].invocationPath;
} else {
- log.error( "Could not find '#parsedName#' widget in the currently active theme." );
+ log.error(
+ "Could not find '#parsedName#' widget in the currently active theme."
+ );
}
return path;
}
@@ -142,13 +175,16 @@ component accessors="true" threadSafe singleton {
* This method is called from the UI module to make sure all site themes are online before
* serving requets
*/
- function startupSiteThemes(){
+ function startupSiteThemes() {
// Startup the themes
- variables.siteService
+ variables
+ .siteService
.getAllSiteThemes()
- .each( function( record ){
- startupTheme( name: arguments.record[ "activeTheme" ], site: arguments.record[ "siteID" ] );
- } );
+ .each(
+ function( record ) {
+ startupTheme( name = arguments.record[ "activeTheme" ], site = arguments.record[ "siteID" ] );
+ }
+ );
// Flush the settings now
variables.settingService.flushSettingsCache();
@@ -165,10 +201,10 @@ component accessors="true" threadSafe singleton {
required name,
boolean processWidgets = true,
any site = ""
- ){
+ ) {
// Get theme record information
var themeRecord = getThemeRecord( arguments.name );
- var oTheme = themeRecord.descriptor;
+ var oTheme = themeRecord.descriptor;
// Determine object or id
if ( isSimpleValue( arguments.site ) ) {
arguments.site = variables.siteService.getOrFail( arguments.site );
@@ -176,37 +212,42 @@ component accessors="true" threadSafe singleton {
// Register description as an interceptor with custom points
variables.interceptorService.registerInterceptor(
- interceptorObject: oTheme,
- interceptorName : "cbtheme-#arguments.name#-#arguments.site.getsiteID()#",
- customPoints : themeRecord.customInterceptionPoints
- );
+ interceptorObject = oTheme,
+ interceptorName = "cbtheme-#arguments.name#-#arguments.site.getsiteID()#",
+ customPoints = themeRecord.customInterceptionPoints
+ );
// Register theme settings?
if ( structKeyExists( oTheme, "settings" ) ) {
registerThemeSettings(
- name : arguments.name,
- settings: oTheme.settings,
- site : arguments.site
+ name = arguments.name,
+ settings = oTheme.settings,
+ site = arguments.site
);
}
// build widget cache for active theme
for ( var thisWidget in themeRecord.widgets.listToArray() ) {
- var widgetName = replaceNoCase( thisWidget, ".cfc", "", "one" );
+ var widgetName = replaceNoCase(
+ thisWidget,
+ ".cfc",
+ "",
+ "one"
+ );
variables.widgetCache[ widgetName ] = {
- name : widgetName,
- invocationPath : "#themeRecord.invocationPath#.widgets.#widgetName#",
- path : "#themeRecord.path#/#arguments.name#/widgets/#thisWidget#",
- theme : arguments.name
+ name : widgetName,
+ invocationPath: "#themeRecord.invocationPath#.widgets.#widgetName#",
+ path : "#themeRecord.path#/#arguments.name#/widgets/#thisWidget#",
+ theme : arguments.name
};
}
// activate theme modules
for ( var thisModule in themeRecord.modules.listToArray() ) {
variables.moduleService.registerAndActivateModule(
- moduleName : thisModule,
- invocationPath: "#themeRecord.invocationPath#.modules"
- );
+ moduleName = thisModule,
+ invocationPath = "#themeRecord.invocationPath#.modules"
+ );
}
// Register all widgets
@@ -216,13 +257,13 @@ component accessors="true" threadSafe singleton {
// Announce theme activation
variables.interceptorService.announce(
- "cbadmin_onThemeActivation",
- {
- themeName : arguments.name,
- themeRecord : themeRecord,
- site : arguments.site
- }
- );
+ "cbadmin_onThemeActivation",
+ {
+ themeName : arguments.name,
+ themeRecord: themeRecord,
+ site : arguments.site
+ }
+ );
// Call Theme Callbacks: onActivation
if ( structKeyExists( oTheme, "onActivation" ) ) {
@@ -239,27 +280,32 @@ component accessors="true" threadSafe singleton {
*
* @return ThemeService
*/
- function saveThemeSettings( required name, required struct settings ){
+ function saveThemeSettings( required name, required struct settings ) {
var oSite = variables.siteService.getCurrentWorkingSite();
transaction {
// Filter out settings that are not theme based
- arguments.settings
- .filter( function( key, value ){
- return ( findNoCase( "cb_theme_#name#_", key ) ? true : false );
- } )
- .each( function( key, value ){
- var oSetting = variables.settingService.findSiteSetting( oSite, key );
-
- if ( isNull( oSetting ) ) {
- oSetting = variables.settingService.new( { name : key } );
+ arguments
+ .settings
+ .filter(
+ function( key, value ) {
+ return ( findNoCase( "cb_theme_#name#_", key ) ? true : false );
}
+ )
+ .each(
+ function( key, value ) {
+ var oSetting = variables.settingService.findSiteSetting( oSite, key );
+
+ if ( isNull( oSetting ) ) {
+ oSetting = variables.settingService.new( { name: key } );
+ }
- oSetting.setValue( value );
- oSetting.setSite( oSite );
+ oSetting.setValue( value );
+ oSetting.setSite( oSite );
- variables.settingService.save( oSetting );
- } );
+ variables.settingService.save( oSetting );
+ }
+ );
}
return this;
@@ -268,8 +314,11 @@ component accessors="true" threadSafe singleton {
/**
* Get the current active theme record for the current working site
*/
- struct function getActiveTheme(){
- return getThemeRecord( variables.siteService.getCurrentWorkingSite().getActiveTheme() );
+ struct function getActiveTheme() {
+ return getThemeRecord( variables
+ .siteService
+ .getCurrentWorkingSite()
+ .getActiveTheme() );
}
/**
@@ -277,7 +326,7 @@ component accessors="true" threadSafe singleton {
*
* @themeName The name of the theme
*/
- struct function getThemeRecord( required themeName ){
+ struct function getThemeRecord( required themeName ) {
return variables.themeRegistry[ arguments.themeName ];
}
@@ -286,7 +335,7 @@ component accessors="true" threadSafe singleton {
*
* @themeName The name of the theme to check
*/
- boolean function isActiveTheme( required themeName ){
+ boolean function isActiveTheme( required themeName ) {
return ( compareNoCase( getActiveTheme().name, arguments.themeName ) EQ 0 );
}
@@ -295,20 +344,20 @@ component accessors="true" threadSafe singleton {
*
* @themeName The theme name to activate
*/
- function activateTheme( required themeName ){
+ function activateTheme( required themeName ) {
transaction {
var currentSite = variables.siteService.getCurrentWorkingSite();
var themeRecord = getThemeRecord( currentSite.getActiveTheme() );
// Call deactivation event for the previous active theme
variables.interceptorService.announce(
- "cbadmin_onThemeDeactivation",
- {
- themeName : currentSite.getActiveTheme(),
- themeRecord : themeRecord,
- site : currentSite
- }
- );
+ "cbadmin_onThemeDeactivation",
+ {
+ themeName : currentSite.getActiveTheme(),
+ themeRecord: themeRecord,
+ site : currentSite
+ }
+ );
// Call Old Theme Callback: onDeactivation
if ( structKeyExists( themeRecord.descriptor, "onDeactivation" ) ) {
@@ -322,8 +371,8 @@ component accessors="true" threadSafe singleton {
// Unregister theme Descriptor Interceptor
variables.interceptorService.unregister(
- interceptorName = "cbTheme-#currentSite.getActiveTheme()#-#currentSite.getsiteID()#"
- );
+ interceptorName = "cbTheme-#currentSite.getActiveTheme()#-#currentSite.getsiteID()#"
+ );
// Setup the new chosen theme for the site
currentSite.setActiveTheme( arguments.themeName );
@@ -342,7 +391,7 @@ component accessors="true" threadSafe singleton {
/**
* Get all registered themes via the registry.
*/
- struct function getThemes(){
+ struct function getThemes() {
if ( isSimpleValue( variables.themeRegistry ) ) {
buildThemeRegistry();
}
@@ -352,42 +401,48 @@ component accessors="true" threadSafe singleton {
/**
* Get all registered custom themes via the registry.
*/
- struct function getCustomThemes(){
+ struct function getCustomThemes() {
if ( isSimpleValue( variables.themeRegistry ) ) {
buildThemeRegistry();
}
- return variables.themeRegistry.filter( function( item, contents ){
- return ( contents.type == "custom" ? true : false );
- } );
+ return variables.themeRegistry.filter(
+ function( item, contents ) {
+ return ( contents.type == "custom" ? true : false );
+ }
+ );
}
/**
* Build the theme registry via discovery
*/
- ThemeService function buildThemeRegistry(){
+ ThemeService function buildThemeRegistry() {
// Get Core Themes and Process Them
- getThemesOnDisk( variables.coreThemesPath ).each( function( item ){
- processThemeRecord(
- name = arguments.item,
- path = variables.coreThemesPath,
- invocationPath = variables.moduleSettings[ "contentbox" ].invocationPath & ".themes",
- includePath = variables.moduleSettings[ "contentbox" ].mapping & "/themes",
- type = "core",
- module = "contentbox"
+ getThemesOnDisk( variables.coreThemesPath ).each(
+ function( item ) {
+ processThemeRecord(
+ name = arguments.item,
+ path = variables.coreThemesPath,
+ invocationPath = variables.moduleSettings[ "contentbox" ].invocationPath & ".themes",
+ includePath = variables.moduleSettings[ "contentbox" ].mapping & "/themes",
+ type = "core",
+ module = "contentbox"
+ );
+ }
);
- } );
// Get Custom Themes and Process Them
- getThemesOnDisk( variables.customThemesPath ).each( function( item ){
- processThemeRecord(
- name = arguments.item,
- path = variables.customThemesPath,
- invocationPath = variables.moduleSettings[ "contentbox-custom" ].invocationPath & "._themes",
- includePath = variables.moduleSettings[ "contentbox-custom" ].mapping & "/_themes",
- type = "custom",
- module = "contentbox-custom"
+ getThemesOnDisk( variables.customThemesPath ).each(
+ function( item ) {
+ processThemeRecord(
+ name = arguments.item,
+ path = variables.customThemesPath,
+ invocationPath = variables.moduleSettings[ "contentbox-custom" ].invocationPath & "._themes",
+ includePath = variables.moduleSettings[ "contentbox-custom" ].mapping & "/_themes",
+ type = "custom",
+ module = "contentbox-custom"
+ );
+ }
);
- } );
return this;
}
@@ -409,39 +464,41 @@ component accessors="true" threadSafe singleton {
includePath,
type,
module
- ){
+ ) {
var record = {
- "name" : arguments.name,
- "descriptor" : "",
- "type" : arguments.type,
- "module" : arguments.module,
- "isValid" : false,
- "path" : arguments.path,
- "invocationPath" : arguments.invocationPath & "." & arguments.name,
- "includePath" : arguments.includePath & "/" & arguments.name,
- "themeName" : "",
- "description" : "",
- "version" : "",
- "author" : "",
- "authorURL" : "",
- "screenShotURL" : "",
- "forgeBoxSlug" : "",
- "customInterceptionPoints" : "",
- "layouts" : "",
- "settings" : "",
- "widgets" : "",
- "modules" : ""
+ "name" : arguments.name,
+ "descriptor" : "",
+ "type" : arguments.type,
+ "module" : arguments.module,
+ "isValid" : false,
+ "path" : arguments.path,
+ "invocationPath" : arguments.invocationPath & "." & arguments.name,
+ "includePath" : arguments.includePath & "/" & arguments.name,
+ "themeName" : "",
+ "description" : "",
+ "version" : "",
+ "author" : "",
+ "authorURL" : "",
+ "screenShotURL" : "",
+ "forgeBoxSlug" : "",
+ "customInterceptionPoints": "",
+ "layouts" : "",
+ "settings" : "",
+ "widgets" : "",
+ "modules" : ""
};
// Check for theme descriptor by 'theme.cfc' or '#themeName#.cfc'
- var descriptorPath = arguments.path & "/#arguments.name#/Theme.cfc";
+ var descriptorPath = arguments.path & "/#arguments.name#/Theme.cfc";
var descriptorInstance = arguments.invocationPath & ".#arguments.name#.Theme";
if ( !fileExists( descriptorPath ) ) {
// try by theme name instead
- descriptorPath = arguments.path & "/#arguments.name#/#arguments.name#.cfc";
+ 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;
}
@@ -451,13 +508,13 @@ component accessors="true" threadSafe singleton {
var oThemeConfig = wirebox.getInstance( descriptorInstance );
// Populate Record with it
- record.descriptor = oThemeConfig;
- record.isValid = true;
- record.themeName = oThemeConfig.name;
+ record.descriptor = oThemeConfig;
+ record.isValid = true;
+ record.themeName = oThemeConfig.name;
record.description = oThemeConfig.description;
- record.version = oThemeConfig.version;
- record.author = oThemeConfig.author;
- record.authorURL = oThemeConfig.authorURL;
+ record.version = oThemeConfig.version;
+ record.author = oThemeConfig.author;
+ record.authorURL = oThemeConfig.authorURL;
// Screenshot
if ( structKeyExists( oThemeConfig, "screenShotURL" ) ) {
record.screenShotURL = arguments.includePath & "/#arguments.name#/" & oThemeConfig.screenShotURL;
@@ -522,15 +579,15 @@ component accessors="true" threadSafe singleton {
// Store layout oThemeConfiguration CFC and theme metadata record
variables.themeCFCRegistry[ arguments.name ] = oThemeConfig;
- variables.themeRegistry[ arguments.name ] = record;
- };
+ variables.themeRegistry[ arguments.name ] = record;
+ }
/**
* Remove a custom theme only.
*
* @themeName The theme to remove
*/
- boolean function removeTheme( required themeName ){
+ boolean function removeTheme( required themeName ) {
// verify name or even if it exists
if ( !len( arguments.themeName ) || !variables.themeRegistry.keyExists( arguments.themeName ) ) {
return false;
@@ -550,7 +607,7 @@ component accessors="true" threadSafe singleton {
// Remove settings
if ( structKeyExists( themeRecord.descriptor, "settings" ) ) {
- unregisterThemeSettings( settings: themeRecord.descriptor.settings );
+ unregisterThemeSettings( settings = themeRecord.descriptor.settings );
}
// Remove from registry
@@ -575,11 +632,11 @@ component accessors="true" threadSafe singleton {
*
* @themeName The name of the theme
*/
- struct function getSettingsConstraints( required themeName ){
+ struct function getSettingsConstraints( required themeName ) {
// Get theme CFC
var oTheme = variables.themeRegistry[ arguments.themeName ].descriptor;
// Verify it has settings, else return empty struct
- if ( !structKeyExists( oTheme, "settings" ) OR !arrayLen( oTheme.settings ) ) {
+ if ( !structKeyExists( oTheme, "settings" ) || !arrayLen( oTheme.settings ) ) {
return {};
}
@@ -587,8 +644,8 @@ component accessors="true" threadSafe singleton {
var constraints = {};
for ( var thisSetting in oTheme.settings ) {
// Check if required
- if ( structKeyExists( thisSetting, "required" ) and thisSetting.required ) {
- constraints[ thisSetting.name ] = { required : true };
+ if ( structKeyExists( thisSetting, "required" ) && thisSetting.required ) {
+ constraints[ thisSetting.name ] = { required: true };
}
}
@@ -600,206 +657,231 @@ component accessors="true" threadSafe singleton {
*
* @activeTheme The active theme struct
*/
- function buildSettingsForm( required struct activeTheme ){
+ function buildSettingsForm( required struct activeTheme ) {
// Get theme CFC
- var oTheme = variables.themeRegistry[ arguments.activeTheme.name ].descriptor;
- var oSite = variables.siteService.getCurrentWorkingSite();
+ var oTheme = variables.themeRegistry[ arguments.activeTheme.name ].descriptor;
+ var oSite = variables.siteService.getCurrentWorkingSite();
var settingForm = "";
// Build Form by iteration over items
- if ( !structKeyExists( oTheme, "settings" ) OR !arrayLen( oTheme.settings ) ) {
+ if ( !structKeyExists( oTheme, "settings" ) || !arrayLen( oTheme.settings ) ) {
return settingForm;
}
-
// cfformat-ignore-start
+ savecontent variable="settingForm" {
+// Write out panel container
+writeOutput(
+"
"
+);
+
+// Iterate and create settings
+var lastGroup = "NeverHadAGroup";
+var firstPanel = true;
+for ( var x = 1; x LTE arrayLen( oTheme.settings ); x++ ) {
+var thisSettingMD = oTheme.settings[ x ];
+var requiredText = "";
+var requiredValidator = "";
+
+// get actual setting value which should be guaranteed to exist
+var settingName = "cb_theme_#arguments.activeTheme.name#_#thisSettingMD.name#";
+var oSetting = settingService.findSiteSetting( oSite, settingName );
+
+thisSettingMD.defaultValue = oSetting.getValue();
+
+// Default values for settings
+if ( !structKeyExists( thisSettingMD, "required" ) ) {
+thisSettingMD.required = false;
+}
+if ( !structKeyExists( thisSettingMD, "label" ) ) {
+thisSettingMD.label = thisSettingMD.name;
+}
+if ( !structKeyExists( thisSettingMD, "type" ) ) {
+thisSettingMD.type = "text";
+}
+if ( !structKeyExists( thisSettingMD, "title" ) ) {
+thisSettingMD.title = "";
+}
+if ( !structKeyExists( thisSettingMD, "group" ) ) {
+thisSettingMD.group = "Main";
+}
+if ( !structKeyExists( thisSettingMD, "groupIntro" ) ) {
+thisSettingMD.groupIntro = "";
+}
+if ( !structKeyExists( thisSettingMD, "fieldHelp" ) ) {
+thisSettingMD.fieldHelp = "";
+}
+if ( !structKeyExists( thisSettingMD, "fieldDescription" ) ) {
+thisSettingMD.fieldDescription = "";
+}
- savecontent variable="settingForm"{
-
- // Write out panel container
- writeOutput( '
' );
-
- // Iterate and create settings
- var lastGroup = "NeverHadAGroup";
- var firstPanel= true;
- for( var x=1; x lte arrayLen( oTheme.settings ); x++ ){
- var thisSettingMD = oTheme.settings[ x ];
- var requiredText = "";
- var requiredValidator = "";
-
- // get actual setting value which should be guaranteed to exist
- var settingName = "cb_theme_#arguments.activeTheme.name#_#thisSettingMD.name#";
- var oSetting = settingService.findSiteSetting( oSite, settingName );
-
- thisSettingMD.defaultValue = oSetting.getValue();
-
- // Default values for settings
- if( !structKeyExists( thisSettingMD, "required" ) ){ thisSettingMD.required = false; }
- if( !structKeyExists( thisSettingMD, "label" ) ){ thisSettingMD.label = thisSettingMD.name; }
- if( !structKeyExists( thisSettingMD, "type" ) ){ thisSettingMD.type = "text"; }
- if( !structKeyExists( thisSettingMD, "title" ) ){ thisSettingMD.title = ""; }
- if( !structKeyExists( thisSettingMD, "group" ) ){ thisSettingMD.group = "Main"; }
- if( !structKeyExists( thisSettingMD, "groupIntro" ) ){ thisSettingMD.groupIntro = ""; }
- if( !structKeyExists( thisSettingMD, "fieldHelp" ) ){ thisSettingMD.fieldHelp = ""; }
- if( !structKeyExists( thisSettingMD, "fieldDescription" ) ){ thisSettingMD.fieldDescription = ""; }
-
- // required static strings
- if( thisSettingMD.required ){
- requiredText = "*Required ";
- requiredValidator = "required";
- }
-
- // Starting a group panel?
- if ( thisSettingMD.group != lastGroup ){
-
- // Close out previous group panel-body
- if ( lastGroup != "NeverHadAGroup" ){
- writeOutput( "
" );
- }
-
- // Write out group panel header
- writeOutput( '' );
- if ( thisSettingMD.group != "" ){
- writeOutput( '
-
- ');
- }
-
- // Start group body panel
- writeOutput( '
-
-
- ' );
-
- // Show group intro if there is one
- if( len( thisSettingMD.groupIntro ) ){
- writeOutput( '
' & thisSettingMD.groupIntro & '
' );
- }
-
- // Set this as the last group
- lastGroup = thisSettingMD.group;
- firstpanel = false;
- }
+// required static strings
+if ( thisSettingMD.required ) {
+requiredText = "
*Required ";
+requiredValidator = "required";
+}
- // writeout control wrapper
- writeOutput( '
' );
+// Starting a group panel?
+if ( thisSettingMD.group != lastGroup ) {
+// Close out previous group panel-body
+if ( lastGroup != "NeverHadAGroup" ) {
+writeOutput( "
" );
+}
- // write out label
- writeOutput( html.label( field=settingName, content="#thisSettingMD.label# #requiredText#" ) );
+// Write out group panel header
+writeOutput( "
" );
+if ( thisSettingMD.group != "" ) {
+writeOutput(
+"
+
+ "
+);
+}
- // Generate question mark icon for field Help to open modal
- if( len( thisSettingMD.fieldHelp ) ){
- writeOutput( '
' );
- }
+// Start group body panel
+writeOutput(
+"
+
+
+"
+);
+
+// Show group intro if there is one
+if ( len( thisSettingMD.groupIntro ) ) {
+writeOutput(
+"
" & thisSettingMD.groupIntro & "
"
+);
+}
+// Set this as the last group
+lastGroup = thisSettingMD.group;
+firstpanel = false;
+}
- // write out field description
- if( len( thisSettingMD.fieldDescription ) ){
- writeOutput( '
' & thisSettingMD.fieldDescription & '
' );
- }
+// writeout control wrapper
+writeOutput( "
" );
+
+// write out label
+writeOutput(
+html.label(
+field = settingName,
+content = "#thisSettingMD.label# #requiredText#"
+)
+);
+
+// Generate question mark icon for field Help to open modal
+if ( len( thisSettingMD.fieldHelp ) ) {
+writeOutput(
+"
"
+);
+}
- // write out control
- switch( thisSettingMD.type ){
- case "boolean" : {
- writeOutput(
- html.select(
- name = settingName,
- options = "true,false",
- selectedValue= thisSettingMD.defaultValue,
- title = thisSettingMD.title,
- class = "form-control input-lg"
- )
- );
- break;
- }
- case "select" : {
- var options = "";
- // Check options UDF
- if( structKeyExists( thisSettingMD, "optionsUDF" ) ){
- options = invoke( oTheme, thisSettingMD.optionsUDF );
- } else if( structKeyExists( thisSettingMD, "options" ) ){
- options = thisSettingMD.options;
- }
- writeOutput(
- html.select(
- name = settingName,
- options = options,
- selectedValue= thisSettingMD.defaultValue,
- title = thisSettingMD.title,
- class = "form-control input-lg"
- )
- );
- break;
- }
- case "textarea" : {
- writeOutput(
- html.textarea(
- name = settingName,
- required= requiredValidator,
- title = thisSettingMD.title,
- value = thisSettingMD.defaultValue,
- class = "form-control",
- rows = 5
- )
- );
- break;
- }
- case "color" : {
- writeOutput(
- html.inputField(
- name = settingName,
- class = "textfield",
- required= requiredValidator,
- title = thisSettingMD.title,
- value = thisSettingMD.defaultValue,
- class = "form-control",
- type = "color"
- )
- );
- break;
- }
- default:{
- writeOutput(
- html.textfield(
- name = settingName,
- class = "textfield",
- required= requiredValidator,
- title = thisSettingMD.title,
- value = thisSettingMD.defaultValue,
- class = "form-control"
- )
- );
- }
- }
+// write out field description
+if ( len( thisSettingMD.fieldDescription ) ) {
+writeOutput( "
" & thisSettingMD.fieldDescription & "
" );
+}
- // End form group
- writeOutput( '
' );
+// write out control
+switch ( thisSettingMD.type ) {
+case "boolean": {
+writeOutput(
+html.select(
+ name = settingName,
+ options = "true,false",
+ selectedValue = thisSettingMD.defaultValue,
+ title = thisSettingMD.title,
+ class = "form-control input-lg"
+ )
+);
+break;
+}
+case "select": {
+var options = "";
+// Check options UDF
+if ( structKeyExists( thisSettingMD, "optionsUDF" ) ) {
+options = invoke( oTheme, thisSettingMD.optionsUDF );
+} else if ( structKeyExists( thisSettingMD, "options" ) ) {
+options = thisSettingMD.options;
+}
+writeOutput(
+html.select(
+ name = settingName,
+ options = options,
+ selectedValue = thisSettingMD.defaultValue,
+ title = thisSettingMD.title,
+ class = "form-control input-lg"
+ )
+);
+break;
+}
+case "textarea": {
+writeOutput(
+html.textarea(
+ name = settingName,
+ required = requiredValidator,
+ title = thisSettingMD.title,
+ value = thisSettingMD.defaultValue,
+ class = "form-control",
+ rows = 5
+ )
+);
+break;
+}
+case "color": {
+writeOutput(
+html.inputField(
+ name = settingName,
+ class = "textfield",
+ required = requiredValidator,
+ title = thisSettingMD.title,
+ value = thisSettingMD.defaultValue,
+ class = "form-control",
+ type = "color"
+ )
+);
+break;
+}
+default: {
+writeOutput(
+html.textfield(
+ name = settingName,
+ class = "textfield",
+ required = requiredValidator,
+ title = thisSettingMD.title,
+ value = thisSettingMD.defaultValue,
+ class = "form-control"
+ )
+);
+}
+}
- // Generate modal for field Help
- if( len( thisSettingMD.fieldHelp ) ){
- writeOutput( generateModal( settingName, thisSettingMD ) );
- }
+// End form group
+writeOutput( "
" );
- } // end looping over theme settings
+// Generate modal for field Help
+if ( len( thisSettingMD.fieldHelp ) ) {
+writeOutput( generateModal( settingName, thisSettingMD ) );
+}
+} // end looping over theme settings
- // Finalize Group Panel: In case we only had one setting in this group.
- if ( lastGroup != "NeverHadAGroup" ){
- writeOutput( '
' );
- }
+// Finalize Group Panel: In case we only had one setting in this group.
+if ( lastGroup != "NeverHadAGroup" ) {
+writeOutput( " " );
+}
- // Finalize Container
- writeOutput( "" );
- }
+// Finalize Container
+writeOutput( "" );
+}
// cfformat-ignore-end
@@ -812,24 +894,26 @@ component accessors="true" threadSafe singleton {
* @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 ){
+ function generateModal( required settingName, required thisSettingMD ) {
// cfformat-ignore-start
- return '
-
-
-
-
- #arguments.thisSettingMD.fieldHelp#
-
-
-
-
-
';
+ return "
+
+
+
+ ×
+
#arguments.thisSettingMD.label#
+
+
+ #arguments.thisSettingMD.fieldHelp#
+
+
+ Close
+
+
+
+
";
+
+
// cfformat-ignore-end
}
@@ -840,15 +924,22 @@ component accessors="true" threadSafe singleton {
*
* @path The path to check
*/
- private array function getThemesOnDisk( required path ){
- return directoryList( arguments.path, false, "name", "", "name asc" ).filter( function( item ){
- // exclude .*
- if ( left( item, 1 ) eq "." ) {
- return false;
- }
- // exclude files
- return ( directoryExists( path & "/" & item ) ? true : false );
- } );
+ private array function getThemesOnDisk( required path ) {
+ return directoryList(
+ arguments.path,
+ false,
+ "name",
+ "",
+ "name asc"
+ ).filter(
+ function( item ) {
+ if ( left( item, 1 ) EQ "." ) {
+ return false;
+ }
+
+ return ( directoryExists( path & "/" & item ) ? true : false );
+ }
+ );
}
/**
@@ -858,12 +949,13 @@ component accessors="true" threadSafe singleton {
*
* @return ThemeService
*/
- private function unregisterThemeSettings( required array settings ){
+ private function unregisterThemeSettings( required array settings ) {
transaction {
// iterate and register theme settings
for ( var thisSetting in arguments.settings ) {
// try to retrieve the collection
- var aSettings = variables.settingService
+ var aSettings = variables
+ .settingService
.newCriteria()
.isEq( "name", "cb_theme_#arguments.name#_#thisSetting.name#" )
.list();
@@ -891,36 +983,44 @@ component accessors="true" threadSafe singleton {
required name,
required array settings,
required site
- ){
+ ) {
// Get all core, non-deleted setting names
- var loadedSiteSettings = variables.settingService
+ var loadedSiteSettings = variables
+ .settingService
.newCriteria()
.isFalse( "isDeleted" )
.isEq( "site", arguments.site )
- .withProjections( property: "name" )
+ .withProjections( property = "name" )
.list( sortOrder = "name" );
// Check what's missing
transaction {
- arguments.settings
+ arguments
+ .settings
+ .filter(
+ function( thisSetting ) {
+ return !arrayContainsNoCase( loadedSiteSettings, "cb_theme_#name#_#thisSetting.name#" );
+ }
+ )
// only load defaults that do not exist
- .filter( function( thisSetting ){
- return !arrayContainsNoCase( loadedSiteSettings, "cb_theme_#name#_#thisSetting.name#" );
- } )
+
// Create the missing setting
- .each( function( thisSetting ){
- variables.settingService.save(
- variables.settingService
- .new( {
- name : "cb_theme_#name#_#thisSetting.name#",
- value : thisSetting.defaultValue
- } )
- .setSite( site )
- );
- } );
+ .each(
+ function( thisSetting ) {
+ variables.settingService.save( variables
+ .settingService
+ .new(
+ {
+ name : "cb_theme_#name#_#thisSetting.name#",
+ value: thisSetting.defaultValue
+ }
+ )
+ .setSite( site ) );
+ }
+ );
}
return this;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/Widget.cfc b/modules/contentbox/models/ui/Widget.cfc
index fbd91a4ec8..b9314635f0 100644
--- a/modules/contentbox/models/ui/Widget.cfc
+++ b/modules/contentbox/models/ui/Widget.cfc
@@ -6,31 +6,36 @@
* I represent a new widget to be created in the ContentBox System
*/
component accessors="true" {
-
property name="name";
+
property name="version";
+
property name="description";
+
property name="author";
+
property name="authorURL";
+
property name="category";
+
property name="icon";
- Widget function init(){
- variables.name = "";
- variables.version = "";
+ Widget function init() {
+ variables.name = "";
+ variables.version = "";
variables.description = "";
- variables.author = "";
- variables.authorURL = "";
- variables.category = "";
- variables.icon = "";
+ variables.author = "";
+ variables.authorURL = "";
+ variables.category = "";
+ variables.icon = "";
return this;
}
/*
* Validate entry, returns an array of error or no messages
*/
- array function validate(){
- var errors = [];
+ array function validate() {
+ var errors = [];
var aRequired = listToArray( "name,version,description,author,authorURL" );
// Required
@@ -43,4 +48,4 @@ component accessors="true" {
return errors;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/WidgetService.cfc b/modules/contentbox/models/ui/WidgetService.cfc
index 718bf81f06..e29162c5bc 100644
--- a/modules/contentbox/models/ui/WidgetService.cfc
+++ b/modules/contentbox/models/ui/WidgetService.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,14 +6,19 @@
* Manages ContentBox Widgets
*/
component accessors="true" singleton threadSafe {
-
// Dependecnies
property name="settingService" inject="id:settingService@contentbox";
+
property name="moduleSettings" inject="coldbox:setting:modules";
+
property name="moduleService" inject="ModuleService@contentbox";
+
property name="themeService" inject="themeService@contentbox";
+
property name="wirebox" inject="wirebox";
+
property name="coldbox" inject="coldbox";
+
property name="log" inject="logbox:logger:{this}";
/**
@@ -44,8 +49,8 @@ component accessors="true" singleton threadSafe {
/**
* Constructor
*/
- WidgetService function init(){
- variables.coreWidgetsMap = {};
+ WidgetService function init() {
+ variables.coreWidgetsMap = {};
variables.customWidgetsMap = {};
variables.loadedWidgets = "";
@@ -55,16 +60,16 @@ component accessors="true" singleton threadSafe {
/**
* onDIComplete
*/
- function onDIComplete(){
+ function onDIComplete() {
// Verify widgets path location
- variables.coreWidgetsPath = variables.moduleSettings[ "contentbox" ].path & "/widgets";
+ variables.coreWidgetsPath = variables.moduleSettings[ "contentbox" ].path & "/widgets";
variables.customWidgetsPath = variables.moduleSettings[ "contentbox-custom" ].path & "/_widgets";
}
/**
* Get installed widgets as an array of names
*/
- array function getWidgetsList(){
+ array function getWidgetsList() {
var w = getWidgets();
return listToArray( valueList( w.name ) );
}
@@ -73,9 +78,9 @@ component accessors="true" singleton threadSafe {
* Get unique, sorted widget categories from main widget query
* returns Query
*/
- query function getWidgetCategories(){
+ query function getWidgetCategories() {
var widgets = getWidgets();
- var q = new Query(
+ var q = new Query(
dbType = "query",
QoQ = widgets,
sql = "select distinct category from QoQ order by category ASC"
@@ -92,24 +97,60 @@ component accessors="true" singleton threadSafe {
*
* @reload Widgets are lazy loaded, or you can force a reload
*/
- query function getWidgets( boolean reload = false ){
+ query function getWidgets( boolean reload = false ) {
// If query is loaded and not a reload then return it.
- if ( isQuery( variables.loadedWidgets ) and !arguments.reload ) {
+ if ( isQuery( variables.loadedWidgets ) && !arguments.reload ) {
return variables.loadedWidgets;
}
var qAllWidgets = queryNew( "" );
// Add custom columns
- queryAddColumn( qAllWidgets, "name", [] );
- queryAddColumn( qAllWidgets, "directory", [] );
- queryAddColumn( qAllWidgets, "filename", [] );
- queryAddColumn( qAllWidgets, "widgettype", [] );
- queryAddColumn( qAllWidgets, "module", [] );
- queryAddColumn( qAllWidgets, "category", [] );
- queryAddColumn( qAllWidgets, "icon", [] );
- queryAddColumn( qAllWidgets, "debug", [] );
- queryAddColumn( qAllWidgets, "invocationPath", [] );
+ queryAddColumn(
+ qAllWidgets,
+ "name",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "directory",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "filename",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "widgettype",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "module",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "category",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "icon",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "debug",
+ []
+ );
+ queryAddColumn(
+ qAllWidgets,
+ "invocationPath",
+ []
+ );
processWidgets( qAllWidgets, "Core" )
.processWidgets( qAllWidgets, "Custom" )
@@ -128,18 +169,22 @@ component accessors="true" singleton threadSafe {
* @qRecords The records query to attach yourself to
* @type The type to process
*/
- WidgetService function processWidgets( query qRecords = getLoadedWidgets(), type ){
+ WidgetService function processWidgets( query qRecords = getLoadedWidgets(), type ) {
// get core widgets to start with.
var qWidgets = getWidgetsFromPath(
( arguments.type == "Core" ? variables.coreWidgetsPath : variables.customWidgetsPath )
);
// Iterate and incorporate extra metadata to record
- for ( var x = 1; x lte qWidgets.recordCount; x++ ) {
+ for ( var x = 1; x LTE qWidgets.recordCount; x++ ) {
var widgetName = ripExtension( qWidgets.name[ x ] );
// Add new row with data
queryAddRow( arguments.qRecords );
- querySetCell( arguments.qRecords, "name", widgetName );
+ querySetCell(
+ arguments.qRecords,
+ "name",
+ widgetName
+ );
querySetCell(
arguments.qRecords,
"directory",
@@ -187,7 +232,7 @@ component accessors="true" singleton threadSafe {
"icon",
getWidgetIcon( oWidget, arguments.type )
);
- } catch ( any e ) {
+ } catch (any e) {
log.error( "Error creating #arguments.type# widget: #widgetName#", e );
querySetCell(
arguments.qRecords,
@@ -205,21 +250,45 @@ component accessors="true" singleton threadSafe {
*
* @qRecords The records query to attach yourself to
*/
- WidgetService function processModuleWidgets( query qRecords = getLoadedWidgets() ){
+ WidgetService function processModuleWidgets( query qRecords = getLoadedWidgets() ) {
// get module widgets
var moduleWidgets = moduleService.getModuleWidgetCache();
// add module widgets
for ( var widget in moduleWidgets ) {
var thisRecord = moduleWidgets[ widget ];
- var widgetName = listGetAt( widget, 1, "@" );
- var moduleName = listGetAt( widget, 2, "@" );
+ var widgetName = listGetAt(
+ widget,
+ 1,
+ "@"
+ );
+ var moduleName = listGetAt(
+ widget,
+ 2,
+ "@"
+ );
// Add new row with data
queryAddRow( arguments.qRecords );
- querySetCell( arguments.qRecords, "name", widgetName );
- querySetCell( arguments.qRecords, "filename", widgetName );
- querySetCell( arguments.qRecords, "widgettype", "Module" );
- querySetCell( arguments.qRecords, "module", moduleName );
+ querySetCell(
+ arguments.qRecords,
+ "name",
+ widgetName
+ );
+ querySetCell(
+ arguments.qRecords,
+ "filename",
+ widgetName
+ );
+ querySetCell(
+ arguments.qRecords,
+ "widgettype",
+ "Module"
+ );
+ querySetCell(
+ arguments.qRecords,
+ "module",
+ moduleName
+ );
querySetCell(
arguments.qRecords,
"directory",
@@ -243,8 +312,11 @@ component accessors="true" singleton threadSafe {
"icon",
getWidgetIcon( name = oWidget, type = "module" )
);
- } catch ( any e ) {
- log.error( "Error creating module (#moduleName#) widget: #widgetName#", e );
+ } catch (any e) {
+ log.error(
+ "Error creating module (#moduleName#) widget: #widgetName#",
+ e
+ );
querySetCell(
arguments.qRecords,
"debug",
@@ -261,7 +333,7 @@ component accessors="true" singleton threadSafe {
*
* @qRecords The records query to attach yourself to
*/
- WidgetService function processThemeWidgets( query qRecords = getLoadedWidgets() ){
+ WidgetService function processThemeWidgets( query qRecords = getLoadedWidgets() ) {
// get theme widgets
var themeWidgets = themeService.getWidgetCache();
@@ -270,9 +342,21 @@ component accessors="true" singleton threadSafe {
var thisRecord = themeWidgets[ widget ];
queryAddRow( qRecords );
- querySetCell( qRecords, "name", widget );
- querySetCell( qRecords, "filename", widget );
- querySetCell( qRecords, "widgettype", "Theme" );
+ querySetCell(
+ qRecords,
+ "name",
+ widget
+ );
+ querySetCell(
+ qRecords,
+ "filename",
+ widget
+ );
+ querySetCell(
+ qRecords,
+ "widgettype",
+ "Theme"
+ );
querySetCell(
qRecords,
"invocationPath",
@@ -296,8 +380,11 @@ component accessors="true" singleton threadSafe {
"icon",
getWidgetIcon( name = oWidget, type = "theme" )
);
- } catch ( any e ) {
- log.error( "Error creating theme (#thisRecord.theme#) widget: #widget#", e );
+ } catch (any e) {
+ log.error(
+ "Error creating theme (#thisRecord.theme#) widget: #widget#",
+ e
+ );
querySetCell(
qRecords,
"debug",
@@ -315,9 +402,9 @@ component accessors="true" singleton threadSafe {
*
* @name The name of the widget
*/
- string function discoverWidgetType( required name ){
+ string function discoverWidgetType( required name ) {
var isCustom = false;
- var isTheme = false;
+ var isTheme = false;
var qWidgets = getWidgets();
for ( var thisRow in qWidgets ) {
@@ -348,9 +435,9 @@ component accessors="true" singleton threadSafe {
*
* @name The convention name
*/
- any function getWidgetByDiscovery( required name ){
+ any function getWidgetByDiscovery( required name ) {
var isModuleWidget = findNoCase( "@", arguments.name ) ? true : false;
- var isThemeWidget = findNoCase( "~", arguments.name ) ? true : false;
+ var isThemeWidget = findNoCase( "~", arguments.name ) ? true : false;
if ( isModuleWidget ) {
return getWidget( arguments.name, "module" );
@@ -372,7 +459,7 @@ component accessors="true" singleton threadSafe {
*
* @throws WidgetNotFoundException
*/
- any function getWidget( required name, required string type = "core" ){
+ any function getWidget( required name, required string type = "core" ) {
var widgetPath = "";
switch ( arguments.type ) {
@@ -392,7 +479,10 @@ 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.",
@@ -407,7 +497,7 @@ component accessors="true" singleton threadSafe {
* @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" ){
+ string function getWidgetIcon( required name, required string type = "core" ) {
if ( isSimpleValue( arguments.name ) ) {
var widget = getWidget( argumentCollection = arguments );
} else {
@@ -436,7 +526,7 @@ component accessors="true" singleton threadSafe {
* @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" ){
+ string function getWidgetCategory( required name, required string type = "core" ) {
if ( isSimpleValue( arguments.name ) ) {
var widget = getWidget( argumentCollection = arguments );
} else {
@@ -464,7 +554,7 @@ component accessors="true" singleton threadSafe {
*
* @widgetFile The location of the widget to remove
*/
- boolean function removeWidget( required widgetFile ){
+ boolean function removeWidget( required widgetFile ) {
var wCustomPath = variables.customWidgetsPath & "/" & arguments.widgetFile & ".cfc";
if ( fileExists( wCustomPath ) ) {
@@ -483,8 +573,12 @@ component accessors="true" singleton threadSafe {
*
* @fileName The target to rip
*/
- function ripExtension( required filename ){
- return reReplace( arguments.filename, "\.[^.]*$", "" );
+ function ripExtension( required filename ) {
+ return reReplace(
+ arguments.filename,
+ "\.[^.]*$",
+ ""
+ );
}
/**
@@ -496,7 +590,7 @@ component accessors="true" singleton threadSafe {
*
* @return The argument metadata structure
*/
- function getWidgetRenderArgs( required udf, required widget, required type ){
+ function getWidgetRenderArgs( required udf, required widget, required type ) {
// get widget
var p = getWidget( name = arguments.widget, type = arguments.type );
return getMetadata( p[ udf ] );
@@ -507,7 +601,7 @@ component accessors="true" singleton threadSafe {
*
* @path The path to check
*/
- private query function getWidgetsFromPath( required path ){
+ private query function getWidgetsFromPath( required path ) {
return directoryList(
arguments.path,
false,
@@ -517,4 +611,4 @@ component accessors="true" singleton threadSafe {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/editors/EditorService.cfc b/modules/contentbox/models/ui/editors/EditorService.cfc
index 53edb21b30..5757ccbab4 100755
--- a/modules/contentbox/models/ui/editors/EditorService.cfc
+++ b/modules/contentbox/models/ui/editors/EditorService.cfc
@@ -6,7 +6,6 @@
* Manages editor contributions within ContentBox
*/
component accessors="true" threadSafe singleton {
-
// DI
property name="settingService" inject="settingService@contentbox";
@@ -25,7 +24,7 @@ component accessors="true" threadSafe singleton {
*
* @wirebox.inject wirebox
*/
- EditorService function init( required wirebox ){
+ EditorService function init( required wirebox ) {
// init editors and markups
variables.editors = {};
variables.markups = [];
@@ -42,14 +41,14 @@ component accessors="true" threadSafe singleton {
/**
* Get the default system editor
*/
- string function getDefaultEditor(){
+ string function getDefaultEditor() {
return variables.settingService.getSetting( "cb_editors_default" );
}
/**
* Get the default system markup
*/
- string function getDefaultMarkup(){
+ string function getDefaultMarkup() {
return variables.settingService.getSetting( "cb_editors_markup" );
}
@@ -58,7 +57,9 @@ component accessors="true" threadSafe singleton {
*
* @editor The editor instance to register
*/
- EditorService function registerEditor( required contentbox.models.ui.editors.IEditor editor ){
+ EditorService function registerEditor(
+ required contentbox.models.ui.editors.IEditor editor
+ ) {
variables.editors[ arguments.editor.getName() ] = arguments.editor;
return this;
}
@@ -68,7 +69,7 @@ component accessors="true" threadSafe singleton {
*
* @markup The markup name to register
*/
- EditorService function registerMarkup( required markup ){
+ EditorService function registerMarkup( required markup ) {
arrayAppend( variables.markups, arguments.markup );
return this;
}
@@ -78,7 +79,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the editor to unregister
*/
- EditorService function unRegisterEditor( required name ){
+ EditorService function unRegisterEditor( required name ) {
structDelete( variables.editors, arguments.name );
return this;
}
@@ -88,15 +89,18 @@ component accessors="true" threadSafe singleton {
*
* @markup The markup name to unregister
*/
- EditorService function unRegisterMarkup( required markup ){
- arrayDeleteAt( variables.markups, arrayFindNoCase( variables.markups, arguments.markup ) );
+ EditorService function unRegisterMarkup( required markup ) {
+ arrayDeleteAt(
+ variables.markups,
+ arrayFindNoCase( variables.markups, arguments.markup )
+ );
return this;
}
/**
* Get an array of registered editor names in alphabetical order
*/
- array function getRegisteredEditors(){
+ array function getRegisteredEditors() {
var sortedArray = variables.editors.keyArray();
sortedArray.sort( "textnocase" );
return sortedArray;
@@ -105,7 +109,7 @@ component accessors="true" threadSafe singleton {
/**
* Get an array of registered markup names in alphabetical order
*/
- array function getRegisteredMarkups(){
+ array function getRegisteredMarkups() {
arraySort( variables.markups, "textnocase" );
return variables.markups;
}
@@ -113,15 +117,15 @@ component accessors="true" threadSafe singleton {
/**
* Get an array of registered editor names in alphabetical order with their display names
*/
- array function getRegisteredEditorsMap(){
+ array function getRegisteredEditorsMap() {
var aEditors = getRegisteredEditors();
- var result = [];
+ var result = [];
for ( var thisEditor in aEditors ) {
arrayAppend(
result,
{
- name : thisEditor,
- displayName : variables.editors[ thisEditor ].getDisplayName()
+ name : thisEditor,
+ displayName: variables.editors[ thisEditor ].getDisplayName()
}
);
}
@@ -133,7 +137,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the editor
*/
- contentbox.models.ui.editors.IEditor function getEditor( required name ){
+ contentbox.models.ui.editors.IEditor function getEditor( required name ) {
return variables.editors[ arguments.name ];
}
@@ -142,7 +146,7 @@ component accessors="true" threadSafe singleton {
*
* @name The name of the editor
*/
- boolean function hasEditor( required name ){
+ boolean function hasEditor( required name ) {
return structKeyExists( variables.editors, arguments.name );
}
@@ -151,8 +155,8 @@ component accessors="true" threadSafe singleton {
*
* @markup The name of the markup
*/
- boolean function hasMarkup( required markup ){
+ boolean function hasMarkup( required markup ) {
return structKeyExists( variables.markups, arguments.name );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/editors/IEditor.cfc b/modules/contentbox/models/ui/editors/IEditor.cfc
index 684ff6fb63..c4d78686ab 100644
--- a/modules/contentbox/models/ui/editors/IEditor.cfc
+++ b/modules/contentbox/models/ui/editors/IEditor.cfc
@@ -21,11 +21,13 @@ interface {
* This is fired once editor javascript loads, you can use this to return back functions, asset calls, etc.
* return the appropriate JavaScript.
* Each editor must implement the following JS functions:
- * checkIsDirty() - Checks if the editor has detected any changes
- * getEditorContent() - Get's the HTML value of the content field
- * getEditorExcerpt() - Get's the HTML value of the excerpt field
- * updateEditorContent() - Updates the HTML value of the content field from the editor (if editor supports it)
- * updateEditorExcerpt() - Updates the HTML value of the excerpt field from the editor (if editor supports it)
+ *
+ * - checkIsDirty() - Checks if the editor has detected any changes
+ * - getEditorContent() - Get the HTML value of the content field
+ * - getEditorExcerpt() - Get the HTML value of the excerpt field
+ * - updateEditorContent() - Updates the HTML value of the content field from the editor (if editor supports it)
+ * - updateEditorExcerpt() - Updates the HTML value of the excerpt field from the editor (if editor supports it)
+ *
*/
function loadAssets();
@@ -40,5 +42,4 @@ interface {
* return the appropriate JavaScript to turn off the editor.
*/
function shutdown();
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/templates/messagebox.cfm b/modules/contentbox/models/ui/templates/messagebox.cfm
index 7715eb7634..4856c67dfd 100644
--- a/modules/contentbox/models/ui/templates/messagebox.cfm
+++ b/modules/contentbox/models/ui/templates/messagebox.cfm
@@ -1,44 +1,54 @@
- switch( msgStruct.type ){
- case "info" : {
+ switch ( msgStruct.type ) {
+ case "info": {
local.cssType = " alert-info";
local.iconType = "fa fa-info-circle";
break;
}
- case "error" : {
+ case "error": {
local.cssType = " alert-danger";
local.iconType = "fa fa-frown-o";
break;
}
- case "success" : {
+ case "success": {
local.cssType = " alert-success";
local.iconType = "fa fa-frown-o";
break;
}
- case "dark" : {
+ case "dark": {
local.cssType = " alert-dark";
local.iconType = "fa fa-frown-o";
break;
}
- case "light" : {
+ case "light": {
local.cssType = " alert-light";
local.iconType = "fa fa-frown-o";
break;
}
- default : {
+ default: {
local.cssType = " alert-warning";
local.iconType = "fa fa-exclamation-triangle";
}
}
-
-
×
-
+
+×
+
#msgStruct.message#
#msgStruct.message.toString()#
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/contentbox/models/ui/templates/navAdminMenu.cfm b/modules/contentbox/models/ui/templates/navAdminMenu.cfm
index 666b47cade..b21b96fd1f 100644
--- a/modules/contentbox/models/ui/templates/navAdminMenu.cfm
+++ b/modules/contentbox/models/ui/templates/navAdminMenu.cfm
@@ -1,54 +1,154 @@
-
-
+
-
-
-
-
-
+ nav-dropdown
+
+ nav
+
+
+ active open
+
+ #local.topMenu.class#"
data-name="#local.topMenu.name#"
>
-
-
-
-
-
-
- active #local.thisSubMenu.class#"
+
+
+
+
+
+
+
- target="#local.thisSubMenu.target#"
- #parseADataAttributes( local.thisSubMenu.data )#
+ href="#(
+ isCustomFunction( local.thisSubMenu.href )
+ ? local.thisSubMenu.href( local.thisSubMenu, event )
+ : local.thisSubMenu.href
+)#"
+
+
+
+
+
+
+ title="#local.thisSubMenu.title#"
+
+
+ target="#local.thisSubMenu.target#"
+
+
+ #parseADataAttributes( local.thisSubMenu.data )#
+
+
+
+
+
+
>
#( isCustomFunction( local.thisSubMenu.label ) ? local.thisSubMenu.label() : local.thisSubMenu.label )#
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/contentbox/models/ui/templates/subNav.cfm b/modules/contentbox/models/ui/templates/subNav.cfm
index b7f9dde51f..f208fbfff3 100644
--- a/modules/contentbox/models/ui/templates/subNav.cfm
+++ b/modules/contentbox/models/ui/templates/subNav.cfm
@@ -1,37 +1,61 @@
-
-
+
+
+
+
+
+
+<#local.topMenu.itemType# #buildItemAttributes(
+ event,
+ local.topMenu,
+ itemDefaults
+)#>#( isCustomFunction( local.topMenu.label ) ? local.topMenu.label() : local.topMenu.label )##local.topMenu.itemType#>
+
+
+
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
diff --git a/modules/contentbox/models/util/DateUtil.cfc b/modules/contentbox/models/util/DateUtil.cfc
index 7a02886c1f..b440480c81 100644
--- a/modules/contentbox/models/util/DateUtil.cfc
+++ b/modules/contentbox/models/util/DateUtil.cfc
@@ -10,7 +10,7 @@ component singleton {
/**
* Return now() in UTC
*/
- function nowUTC(){
+ function nowUTC() {
return toUTC( now() );
}
@@ -20,7 +20,7 @@ component singleton {
* @see https://cfdocs.org/datetimeformat
* @dateTime The date time object/string to convert
*/
- function toUTC( required dateTime ){
+ function toUTC( required dateTime ) {
return dateTimeFormat(
arguments.dateTime,
"yyyy-mm-dd'T'HH:mm:ssZ",
@@ -35,7 +35,7 @@ component singleton {
*
* @return ColdFusion date/time equivalent
*/
- function epochToLocal( epoch ){
+ function epochToLocal( epoch ) {
if ( !len( arguments.epoch ) || !isNumeric( arguments.epoch ) ) {
return arguments.epoch;
}
@@ -46,4 +46,4 @@ component singleton {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/util/MobileDetector.cfc b/modules/contentbox/models/util/MobileDetector.cfc
index be3f53cf62..86d4779965 100755
--- a/modules/contentbox/models/util/MobileDetector.cfc
+++ b/modules/contentbox/models/util/MobileDetector.cfc
@@ -11,27 +11,29 @@ component singleton {
/**
* Constructor
*/
- MobileDetector function init(){
+ MobileDetector function init() {
return this;
}
/**
* Mobile check
*/
- boolean function isMobile(){
+ boolean function isMobile() {
if (
reFindNoCase(
- "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino",
- CGI.HTTP_USER_AGENT
- ) GT 0 OR
- reFindNoCase(
- "1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-",
- left( CGI.HTTP_USER_AGENT, 4 )
- ) GT 0
+ "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino",
+ CGI.HTTP_USER_AGENT
+ ) GT
+ 0 ||
+ reFindNoCase(
+ "1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-",
+ left( CGI.HTTP_USER_AGENT, 4 )
+ ) GT
+ 0
) {
return true;
}
return false;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/models/util/ZipUtil.cfc b/modules/contentbox/models/util/ZipUtil.cfc
index 716071dc4a..f37d88b98f 100644
--- a/modules/contentbox/models/util/ZipUtil.cfc
+++ b/modules/contentbox/models/util/ZipUtil.cfc
@@ -1,729 +1,624 @@
-
-
+
- configure();
- return this;
+ configure();
+ return this;
-
+
- // This plugin's properties
- instance = structNew();
- instance.ioFile = createObject( "java", "java.io.File" );
- instance.ioInput = createObject( "java", "java.io.FileInputStream" );
- instance.ioOutput = createObject( "java", "java.io.FileOutputStream" );
- instance.ioBufOutput = createObject( "java", "java.io.BufferedOutputStream" );
- instance.zipFile = createObject( "java", "java.util.zip.ZipFile" );
- instance.zipEntry = createObject( "java", "java.util.zip.ZipEntry" );
- instance.zipInput = createObject( "java", "java.util.zip.ZipInputStream" );
- instance.zipOutput = createObject( "java", "java.util.zip.ZipOutputStream" );
- instance.gzInput = createObject( "java", "java.util.zip.GZIPInputStream" );
- instance.gzOutput = createObject( "java", "java.util.zip.GZIPOutputStream" );
- instance.objDate = createObject( "java", "java.util.Date" );
-
- /* Set Localized Variables */
- instance.os = Server.OS.Name;
- instance.slash = createObject( "java", "java.lang.System" ).getProperty( "file.separator" );
-
- // LM. To fix Overflow.
- instance.filename = "";
-
- return this;
+ // This plugin's properties
+ instance = structNew();
+ instance.ioFile = createObject( "java", "java.io.File" );
+ instance.ioInput = createObject( "java", "java.io.FileInputStream" );
+ instance.ioOutput = createObject( "java", "java.io.FileOutputStream" );
+ instance.ioBufOutput = createObject( "java", "java.io.BufferedOutputStream" );
+ instance.zipFile = createObject( "java", "java.util.zip.ZipFile" );
+ instance.zipEntry = createObject( "java", "java.util.zip.ZipEntry" );
+ instance.zipInput = createObject( "java", "java.util.zip.ZipInputStream" );
+ instance.zipOutput = createObject( "java", "java.util.zip.ZipOutputStream" );
+ instance.gzInput = createObject( "java", "java.util.zip.GZIPInputStream" );
+ instance.gzOutput = createObject( "java", "java.util.zip.GZIPOutputStream" );
+ instance.objDate = createObject( "java", "java.util.Date" );
+
+ /* Set Localized Variables */
+ instance.os = Server.OS.Name;
+ instance.slash = createObject( "java", "java.lang.System" ).getProperty( "file.separator" );
+
+ // LM. To fix Overflow.
+ instance.filename = "";
+
+ return this;
-
+
-
-
-
-
-
-
-
-
-
+
- /* Default variables */
- var i = 0;
- var l = 0;
- var buffer = repeatString( " ", 1024 ).getBytes();
- var entryPath = "";
- var entryFile = "";
- var localfiles = "";
- var path = "";
- var skip = "";
-
- try {
- /* Initialize Zip file */
- instance.ioOutput.init( pathFormat( arguments.zipFilePath ) );
- instance.filename = getFileFromPath( arguments.zipFilePath );
- instance.zipOutput.init( instance.ioOutput );
- instance.zipOutput.setLevel( arguments.compression );
-
- /* Get files list array */
- if ( structKeyExists( arguments, "files" ) and arguments.files neq "" )
- localfiles = listToArray( pathFormat( arguments.files ), "|" );
- else if ( structKeyExists( arguments, "directory" ) and arguments.directory neq "" ) {
- localfiles = filesList(
- arguments.directory,
- arguments.filter,
- arguments.recurse
- );
- arguments.directory = pathFormat( arguments.directory );
- }
-
- /* Loop over files array */
- for ( i = 1; i LTE arrayLen( localfiles ); i = i + 1 ) {
- if ( fileExists( localfiles[ i ] ) ) {
- path = localfiles[ i ];
-
- // Get entry path and file
- entryPath = getDirectoryFromPath( path );
- entryFile = getFileFromPath( path );
-
- // Remove drive letter from path
- 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 = "";
- }
+ /* Default variables */
+ var i = 0;
+ var l = 0;
+ var buffer = repeatString( " ", 1024 ).getBytes();
+ var entryPath = "";
+ var entryFile = "";
+ var localfiles = "";
+ var path = "";
+ var skip = "";
+
+ try {
+ /* Initialize Zip file */
+ instance.ioOutput.init( pathFormat( arguments.zipFilePath ) );
+ instance.filename = getFileFromPath( arguments.zipFilePath );
+ instance.zipOutput.init( instance.ioOutput );
+ instance.zipOutput.setLevel( arguments.compression );
+
+ /* Get files list array */
+ if ( structKeyExists( arguments, "files" ) && arguments.files NEQ "" ) {
+ localfiles = listToArray( pathFormat( arguments.files ), "|" );
+ } else if ( structKeyExists( arguments, "directory" ) && arguments.directory NEQ "" ) {
+ localfiles = filesList(
+ arguments.directory,
+ arguments.filter,
+ arguments.recurse
+ );
+ arguments.directory = pathFormat( arguments.directory );
+ }
- // 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 = "";
+ /* Loop over files array */
+ for ( i = 1; i LTE arrayLen( localfiles ); i = i + 1 ) {
+ if ( fileExists( localfiles[ i ] ) ) {
+ path = localfiles[ i ];
+
+ // Get entry path and file
+ entryPath = getDirectoryFromPath( path );
+ entryFile = getFileFromPath( path );
+
+ // Remove drive letter from path
+ if (
+ arguments.savePaths EQ "yes" && right( listFirst( entryPath, instance.slash ), 1 ) EQ ":"
+ ) {
+ entryPath = listDeleteAt(
+ entryPath,
+ 1,
+ instance.slash
+ );
+ } else if ( arguments.savePaths EQ "no" ) {
+ // Remove directory from path
+ if ( structKeyExists( arguments, "directory" ) && arguments.directory NEQ "" ) {
+ entryPath = replaceNoCase(
+ entryPath,
+ arguments.directory,
+ "",
+ "ALL"
+ );
+ } else if ( structKeyExists( arguments, "files" ) && arguments.files NEQ "" ) {
+ entryPath = "";
+ }
+ }
- // Skip if entry with the same name already exsits
- try {
- instance.ioFile.init( path );
- instance.ioInput.init( instance.ioFile.getPath() );
+ // Remove slash at first
+ if ( len( entryPath ) GT 1 && left( entryPath, 1 ) EQ instance.slash ) {
+ entryPath = right( entryPath, len( entryPath ) - 1 );
+ } else if ( len( entryPath ) EQ 1 && left( entryPath, 1 ) EQ instance.slash ) {
+ entryPath = "";
+ }
- instance.zipEntry.init( entryPath & entryFile );
- instance.zipOutput.putNextEntry( instance.zipEntry );
+ // Skip if entry with the same name already exsits
+ try {
+ instance.ioFile.init( path );
+ instance.ioInput.init( instance.ioFile.getPath() );
- l = instance.ioInput.read( buffer );
+ instance.zipEntry.init( entryPath & entryFile );
+ instance.zipOutput.putNextEntry( instance.zipEntry );
- while ( l GT 0 ) {
- instance.zipOutput.write( buffer, 0, l );
l = instance.ioInput.read( buffer );
- }
- instance.zipOutput.closeEntry();
- instance.ioInput.close();
- } catch ( java.util.zip.ZipException ex ) {
- skip = "yes";
+ while ( l GT 0 ) {
+ instance.zipOutput.write(
+ buffer,
+ 0,
+ l
+ );
+ l = instance.ioInput.read( buffer );
+ }
+
+ instance.zipOutput.closeEntry();
+ instance.ioInput.close();
+ } catch (java.util.zip.ZipException ex) {
+ skip = "yes";
+ }
}
}
- }
- /* Close Zip file */
- instance.zipOutput.close();
+ /* Close Zip file */
+ instance.zipOutput.close();
- /* Return true */
- return true;
- } catch ( Any expr ) {
- /* Close Zip file */
- instance.zipOutput.close();
+ /* Return true */
+ return true;
+ } catch (Any expr) {
+ /* Close Zip file */
+ instance.zipOutput.close();
- /* Return false */
- return false;
- }
+ /* Return false */
+ return false;
+ }
-
+
-
-
-
-
+
- /* NOTICE: There is no function in the Java API to delete entrys from a Zip file.
- So we have to create a workaround for this function. At first we create
- a new temporary Zip file and save there all entrys, excluded the delete
- files. Then we delete the orginal Zip file and rename the temporary Zip
- file. */
-
- /* Default variables */
- var l = 0;
- var buffer = repeatString( " ", 1024 ).getBytes();
- var entries = "";
- var entry = "";
- var inStream = "";
- var zipTemp = "";
- var zipRename = "";
- /* Convert to the right path format */
- arguments.zipFilePath = pathFormat( arguments.zipFilePath );
-
- try {
- /* Open Zip file and get Zip file entries */
- instance.zipFile.init( arguments.zipFilePath );
- entries = instance.zipFile.entries();
-
- /* Create a new temporary Zip file */
- instance.ioOutput.init( pathFormat( arguments.zipFilePath & ".temp" ) );
- instance.zipOutput.init( instance.ioOutput );
-
- /* Loop over Zip file entries */
- while ( entries.hasMoreElements() ) {
- entry = entries.nextElement();
+ /* NOTICE: There is no function in the Java API to delete entrys from a Zip file.
+ * So we have to create a workaround for this function. At first we create
+ * a new temporary Zip file and save there all entrys, excluded the delete
+ * files. Then we delete the orginal Zip file and rename the temporary Zip
+ file. */
+
+ /* Default variables */
+ var l = 0;
+ var buffer = repeatString( " ", 1024 ).getBytes();
+ var entries = "";
+ var entry = "";
+ var inStream = "";
+ var zipTemp = "";
+ var zipRename = "";
+ /* Convert to the right path format */
+ arguments.zipFilePath = pathFormat( arguments.zipFilePath );
+
+ try {
+ /* Open Zip file and get Zip file entries */
+ instance.zipFile.init( arguments.zipFilePath );
+ entries = instance.zipFile.entries();
+
+ /* Create a new temporary Zip file */
+ instance.ioOutput.init( pathFormat( arguments.zipFilePath & ".temp" ) );
+ instance.zipOutput.init( instance.ioOutput );
+
+ /* Loop over Zip file entries */
+ while ( entries.hasMoreElements() ) {
+ entry = entries.nextElement();
+
+ if ( !entry.isDirectory() ) {
+ /* Create a new entry in the temporary Zip file */
+ if (
+ !listFindNoCase(
+ arguments.files,
+ entry.getName(),
+ "|"
+ )
+ ) {
+ // Set entry compression
+ instance.zipOutput.setLevel( entry.getMethod() );
- if ( NOT entry.isDirectory() ) {
- /* Create a new entry in the temporary Zip file */
- if ( NOT listFindNoCase( arguments.files, entry.getName(), "|" ) ) {
- // Set entry compression
- instance.zipOutput.setLevel( entry.getMethod() );
+ // Create new entry in the temporary Zip file
+ instance.zipEntry.init( entry.getName() );
+ instance.zipOutput.putNextEntry( instance.zipEntry );
- // Create new entry in the temporary Zip file
- instance.zipEntry.init( entry.getName() );
- instance.zipOutput.putNextEntry( instance.zipEntry );
+ inStream = instance.zipFile.getInputStream( entry );
+ l = inStream.read( buffer );
- inStream = instance.zipFile.getInputStream( entry );
- l = inStream.read( buffer );
+ while ( l GT 0 ) {
+ instance.zipOutput.write(
+ buffer,
+ 0,
+ l
+ );
+ l = inStream.read( buffer );
+ }
- while ( l GT 0 ) {
- instance.zipOutput.write( buffer, 0, l );
- l = inStream.read( buffer );
+ // Close entry
+ instance.zipOutput.closeEntry();
}
-
- // Close entry
- instance.zipOutput.closeEntry();
}
}
- }
-
- /* Close the orginal Zip and the temporary Zip file */
- instance.zipFile.close();
- instance.zipOutput.close();
-
- /* Delete the orginal Zip file */
- instance.ioFile.init( arguments.zipFilePath ).delete();
- /* Rename the temporary Zip file */
- zipTemp = instance.ioFile.init( arguments.zipFilePath & ".temp" );
- zipRename = instance.ioFile.init( arguments.zipFilePath );
- zipTemp.renameTo( zipRename );
-
- /* Return true */
- return true;
- } catch ( Any expr ) {
- /* Close the orginal Zip and the temporary Zip file */
- instance.zipOutput.close();
- instance.zipFile.close();
-
- /* Delete the temporary Zip file, if exists */
- if ( fileExists( arguments.zipFilePath & ".temp" ) )
- instance.ioFile.init( arguments.zipFilePath & ".temp" ).delete();
+ /* Close the orginal Zip and the temporary Zip file */
+ instance.zipFile.close();
+ instance.zipOutput.close();
+
+ /* Delete the orginal Zip file */
+ instance
+ .ioFile
+ .init( arguments.zipFilePath )
+ .delete();
+
+ /* Rename the temporary Zip file */
+ zipTemp = instance.ioFile.init( arguments.zipFilePath & ".temp" );
+ zipRename = instance.ioFile.init( arguments.zipFilePath );
+ zipTemp.renameTo( zipRename );
+
+ /* Return true */
+ return true;
+ } catch (Any expr) {
+ /* Close the orginal Zip and the temporary Zip file */
+ instance.zipOutput.close();
+ instance.zipFile.close();
+
+ /* Delete the temporary Zip file, if exists */
+ if ( fileExists( arguments.zipFilePath & ".temp" ) ) {
+ instance
+ .ioFile
+ .init( arguments.zipFilePath & ".temp" )
+ .delete();
+ }
- /* Return false */
- return false;
- }
+ /* Return false */
+ return false;
+ }
-
+
-
-
-
-
-
-
-
+
- /* Default variables */
- var l = 0;
- var entries = "";
- var entry = "";
- var name = "";
- var path = "";
- var filePath = "";
- var buffer = repeatString( " ", 1024 ).getBytes();
- var lastChr = "";
- var lenPath = "";
- var inStream = "";
- var skip = "";
-
- /* Convert to the right path format */
- arguments.zipFilePath = pathFormat( arguments.zipFilePath );
- arguments.extractPath = pathFormat( arguments.extractPath );
-
- /* Check if the 'extractPath' string is closed */
- lastChr = right( arguments.extractPath, 1 );
-
- /* Set an slash at the end of string */
- if ( lastChr NEQ instance.slash ) arguments.extractPath = arguments.extractPath & instance.slash;
-
- try {
- /* Open Zip file */
- instance.zipFile.init( arguments.zipFilePath );
+ /* Default variables */
+ var l = 0;
+ var entries = "";
+ var entry = "";
+ var name = "";
+ var path = "";
+ var filePath = "";
+ var buffer = repeatString( " ", 1024 ).getBytes();
+ var lastChr = "";
+ var lenPath = "";
+ var inStream = "";
+ var skip = "";
+
+ /* Convert to the right path format */
+ arguments.zipFilePath = pathFormat( arguments.zipFilePath );
+ arguments.extractPath = pathFormat( arguments.extractPath );
+
+ /* Check if the 'extractPath' string is closed */
+ lastChr = right( arguments.extractPath, 1 );
+
+ /* Set an slash at the end of string */
+ if ( lastChr NEQ instance.slash ) {
+ arguments.extractPath = arguments.extractPath & instance.slash;
+ }
- /* Zip file entries */
- entries = instance.zipFile.entries();
+ try {
+ /* Open Zip file */
+ instance.zipFile.init( arguments.zipFilePath );
- /* Loop over Zip file entries */
- while ( entries.hasMoreElements() ) {
- entry = entries.nextElement();
+ /* Zip file entries */
+ entries = instance.zipFile.entries();
- if ( NOT entry.isDirectory() ) {
- name = entry.getName();
+ /* Loop over Zip file entries */
+ while ( entries.hasMoreElements() ) {
+ entry = entries.nextElement();
- /* Create directory only if 'useFolderNames' is 'yes' */
- if ( arguments.useFolderNames EQ "yes" ) {
- lenPath = len( name ) - len( getFileFromPath( name ) );
+ if ( !entry.isDirectory() ) {
+ name = entry.getName();
- if ( lenPath ) path = extractPath & left( name, lenPath );
- else path = extractPath;
+ /* Create directory only if 'useFolderNames' is 'yes' */
+ if ( arguments.useFolderNames EQ "yes" ) {
+ lenPath = len( name ) - len( getFileFromPath( name ) );
- if ( NOT directoryExists( path ) ) {
- instance.ioFile.init( path );
- instance.ioFile.mkdirs();
+ if ( lenPath ) {
+ path = extractPath & left( name, lenPath );
+ } else {
+ path = extractPath;
+ }
+
+ if ( !directoryExists( path ) ) {
+ instance.ioFile.init( path );
+ instance.ioFile.mkdirs();
+ }
}
- }
- /* Set file path */
- if ( arguments.useFolderNames EQ "yes" ) {
- filePath = arguments.extractPath & name;
- } else {
- filePath = arguments.extractPath & getFileFromPath( name );
- }
+ /* Set file path */
+ if ( arguments.useFolderNames EQ "yes" ) {
+ filePath = arguments.extractPath & name;
+ } else {
+ filePath = arguments.extractPath & getFileFromPath( name );
+ }
- // Zip Slip Validation
- if ( !getCanonicalPath( filePath ).startsWith( getCanonicalPath( arguments.extractPath ) ) ) {
- throw(
- type : "ArchiverException",
- message: "Entry is outside of the target destination: #filepath#"
- );
- }
+ // Zip Slip Validation
+ if ( !getCanonicalPath( filePath ).startsWith( getCanonicalPath( arguments.extractPath ) ) ) {
+ throw(
+ type = "ArchiverException",
+ message = "Entry is outside of the target destination: #filepath#"
+ );
+ }
- /* Extract files. Files would be extract when following conditions are fulfilled:
- If the 'extractFiles' list is not defined,
- or the 'extractFiles' list is defined and the entry filename is found in the list,
- or the file already exists and 'overwriteFiles' is 'yes'. */
- if (
- (
- NOT structKeyExists( arguments, "extractFiles" )
- OR (
- structKeyExists( arguments, "extractFiles" ) AND listFindNoCase(
- arguments.extractFiles,
- getFileFromPath( name ),
- "|"
+ /* Extract files. Files would be extract when following conditions are fulfilled:
+ * If the 'extractFiles' list is not defined,
+ * or the 'extractFiles' list is defined and the entry filename is found in the list,
+ or the file already exists and 'overwriteFiles' is 'yes'. */
+ if (
+ (
+ !structKeyExists( arguments, "extractFiles" ) ||
+ (
+ structKeyExists( arguments, "extractFiles" ) &&
+ listFindNoCase(
+ arguments.extractFiles,
+ getFileFromPath( name ),
+ "|"
+ )
+ )
+ ) &&
+ (
+ !fileExists( filePath ) ||
+ ( fileExists( filePath ) && arguments.overwriteFiles EQ "yes" )
)
- )
- )
- AND (
- NOT fileExists( filePath ) OR ( fileExists( filePath ) AND arguments.overwriteFiles EQ "yes" )
- )
- ) {
- // Skip if entry contains special characters
- try {
- instance.ioOutput.init( filePath );
- instance.ioBufOutput.init( instance.ioOutput );
-
- inStream = instance.zipFile.getInputStream( entry );
- l = inStream.read( buffer );
+ ) {
+ // Skip if entry contains special characters
+ try {
+ instance.ioOutput.init( filePath );
+ instance.ioBufOutput.init( instance.ioOutput );
- while ( l GTE 0 ) {
- instance.ioBufOutput.write( buffer, 0, l );
+ inStream = instance.zipFile.getInputStream( entry );
l = inStream.read( buffer );
- }
- inStream.close();
- instance.ioBufOutput.close();
- instance.ioOutput.close();
- } catch ( Any Expr ) {
- skip = "yes";
+ while ( l GTE 0 ) {
+ instance.ioBufOutput.write(
+ buffer,
+ 0,
+ l
+ );
+ l = inStream.read( buffer );
+ }
+
+ inStream.close();
+ instance.ioBufOutput.close();
+ instance.ioOutput.close();
+ } catch (Any Expr) {
+ skip = "yes";
+ }
}
}
}
- }
- /* Close the Zip file */
- instance.zipFile.close();
+ /* Close the Zip file */
+ instance.zipFile.close();
- /* Return true */
- return true;
- } catch ( Any expr ) {
- /* Close the Zip file */
- instance.zipFile.close();
+ /* Return true */
+ return true;
+ } catch (Any expr) {
+ /* Close the Zip file */
+ instance.zipFile.close();
- /* Return false */
- return false;
- }
+ /* Return false */
+ return false;
+ }
-
+
-
-
-
+
- /* Default variables */
- var i = 0;
- var entries = "";
- var entry = "";
- var cols = "entry,date,size,packed,ratio,crc";
- var query = queryNew( cols );
- var qEntry = "";
- var qDate = "";
- var qSize = "";
- var qPacked = "";
- var qCrc = "";
- var qRatio = "";
-
- cols = listToArray( cols );
-
- /* Open Zip file */
- instance.zipFile.init( arguments.zipFilePath );
-
- /* Zip file entries */
- entries = instance.zipFile.entries();
-
- /* Fill query with data */
- while ( entries.hasMoreElements() ) {
- entry = entries.nextElement();
-
- if ( NOT entry.isDirectory() ) {
- queryAddRow( query, 1 );
-
- qEntry = pathFormat( entry.getName() );
- qDate = instance.objDate.init( entry.getTime() );
- qSize = entry.getSize();
- qPacked = entry.getCompressedSize();
- qCrc = entry.getCrc();
-
- if ( qSize GT 0 ) qRatio = round( evaluate( 100 - ( ( qPacked * 100 ) / qSize ) ) ) & "%";
- else qRatio = "0%";
-
- for ( i = 1; i LTE arrayLen( cols ); i = i + 1 )
- querySetCell(
- query,
- cols[ i ],
- trim( evaluate( "q#cols[ i ]#" ) )
- );
- }
- }
+ /* Default variables */
+ var i = 0;
+ var entries = "";
+ var entry = "";
+ var cols = "entry,date,size,packed,ratio,crc";
+ var query = queryNew( cols );
+ var qEntry = "";
+ var qDate = "";
+ var qSize = "";
+ var qPacked = "";
+ var qCrc = "";
+ var qRatio = "";
+
+ cols = listToArray( cols );
- /* Close the Zip File */
- instance.zipFile.close();
+ /* Open Zip file */
+ instance.zipFile.init( arguments.zipFilePath );
- /* Return query */
- return query;
-
-
+ /* Zip file entries */
+ entries = instance.zipFile.entries();
-
+ /* Fill query with data */
+ while ( entries.hasMoreElements() ) {
+ entry = entries.nextElement();
-
-
-
-
-
-
- /* Default variables */
- var l = 0;
- var buffer = repeatString( " ", 1024 ).getBytes();
- var gzFileName = "";
- var outputFile = "";
- var lastChr = "";
+ if ( !entry.isDirectory() ) {
+ queryAddRow( query, 1 );
+
+ qEntry = pathFormat( entry.getName() );
+ qDate = instance.objDate.init( entry.getTime() );
+ qSize = entry.getSize();
+ qPacked = entry.getCompressedSize();
+ qCrc = entry.getCrc();
+ if ( qSize GT 0 ) {
+ qRatio = round( evaluate( 100 - ( ( qPacked * 100 ) / qSize ) ) ) & "%";
+ } else {
+ qRatio = "0%";
+ }
+ for ( i = 1; i LTE arrayLen( cols ); i = i + 1 ) {
+ querySetCell(
+ query,
+ cols[ i ],
+ trim( evaluate( "q#cols[ i ]#" ) )
+ );
+ }
+ }
+ }
- /* Convert to the right path format */
- arguments.gzipFilePath = pathFormat( arguments.gzipFilePath );
- arguments.filePath = pathFormat( arguments.filePath );
+ /* Close the Zip File */
+ instance.zipFile.close();
- /* Check if the 'extractPath' string is closed */
- lastChr = right( arguments.gzipFilePath, 1 );
+ /* Return query */
+ return query;
+
+
- /* Set an slash at the end of string */
- if ( lastChr NEQ instance.slash ) arguments.gzipFilePath = arguments.gzipFilePath & instance.slash;
+
- try {
- /* Set output gzip file name */
- gzFileName = getFileFromPath( arguments.filePath ) & ".gz";
- outputFile = arguments.gzipFilePath & gzFileName;
+
+
+
+ /* Default variables */
+ var l = 0;
+ var buffer = repeatString( " ", 1024 ).getBytes();
+ var gzFileName = "";
+ var outputFile = "";
+ var lastChr = "";
+
+ /* Convert to the right path format */
+ arguments.gzipFilePath = pathFormat( arguments.gzipFilePath );
+ arguments.filePath = pathFormat( arguments.filePath );
+
+ /* Check if the 'extractPath' string is closed */
+ lastChr = right( arguments.gzipFilePath, 1 );
+
+ /* Set an slash at the end of string */
+ if ( lastChr NEQ instance.slash ) {
+ arguments.gzipFilePath = arguments.gzipFilePath & instance.slash;
+ }
- instance.ioInput.init( arguments.filePath );
- instance.ioOutput.init( outputFile );
- instance.gzOutput.init( instance.ioOutput );
+ try {
+ /* Set output gzip file name */
+ gzFileName = getFileFromPath( arguments.filePath ) & ".gz";
+ outputFile = arguments.gzipFilePath & gzFileName;
- l = instance.ioInput.read( buffer );
+ instance.ioInput.init( arguments.filePath );
+ instance.ioOutput.init( outputFile );
+ instance.gzOutput.init( instance.ioOutput );
- while ( l GT 0 ) {
- instance.gzOutput.write( buffer, 0, l );
l = instance.ioInput.read( buffer );
- }
- /* Close the GZip file */
- instance.gzOutput.close();
- instance.ioOutput.close();
- instance.ioInput.close();
+ while ( l GT 0 ) {
+ instance.gzOutput.write(
+ buffer,
+ 0,
+ l
+ );
+ l = instance.ioInput.read( buffer );
+ }
- /* Return true */
- return true;
- } catch ( Any expr ) {
- return false;
- }
+ /* Close the GZip file */
+ instance.gzOutput.close();
+ instance.ioOutput.close();
+ instance.ioInput.close();
+
+ /* Return true */
+ return true;
+ } catch (Any expr) {
+ return false;
+ }
-
+
-
-
-
-
+
- /* Default variables */
- var l = 0;
- var buffer = repeatString( " ", 1024 ).getBytes();
- var gzFileName = "";
- var outputFile = "";
- var lastChr = "";
-
- /* Convert to the right path format */
- arguments.gzipFilePath = pathFormat( arguments.gzipFilePath );
- arguments.extractPath = pathFormat( arguments.extractPath );
-
- /* Check if the 'extractPath' string is closed */
- lastChr = right( arguments.extractPath, 1 );
-
- /* Set an slash at the end of string */
- if ( lastChr NEQ instance.slash ) arguments.extractPath = arguments.extractPath & instance.slash;
-
- try {
- /* Set output file name */
- gzFileName = getFileFromPath( arguments.gzipFilePath );
- outputFile = arguments.extractPath & left( gzFileName, len( gzFileName ) - 3 );
-
- /* Initialize gzip file */
- instance.ioOutput.init( outputFile );
- instance.ioInput.init( arguments.gzipFilePath );
- instance.gzInput.init( instance.ioInput );
-
- while ( l GTE 0 ) {
- instance.ioOutput.write( buffer, 0, l );
- l = instance.gzInput.read( buffer );
+ /* Default variables */
+ var l = 0;
+ var buffer = repeatString( " ", 1024 ).getBytes();
+ var gzFileName = "";
+ var outputFile = "";
+ var lastChr = "";
+
+ /* Convert to the right path format */
+ arguments.gzipFilePath = pathFormat( arguments.gzipFilePath );
+ arguments.extractPath = pathFormat( arguments.extractPath );
+
+ /* Check if the 'extractPath' string is closed */
+ lastChr = right( arguments.extractPath, 1 );
+
+ /* Set an slash at the end of string */
+ if ( lastChr NEQ instance.slash ) {
+ arguments.extractPath = arguments.extractPath & instance.slash;
}
- /* Close the GZip file */
- instance.gzInput.close();
- instance.ioInput.close();
- instance.ioOutput.close();
+ try {
+ /* Set output file name */
+ gzFileName = getFileFromPath( arguments.gzipFilePath );
+ outputFile = arguments.extractPath & left( gzFileName, len( gzFileName ) - 3 );
+
+ /* Initialize gzip file */
+ instance.ioOutput.init( outputFile );
+ instance.ioInput.init( arguments.gzipFilePath );
+ instance.gzInput.init( instance.ioInput );
+
+ while ( l GTE 0 ) {
+ instance.ioOutput.write(
+ buffer,
+ 0,
+ l
+ );
+ l = instance.gzInput.read( buffer );
+ }
+
+ /* Close the GZip file */
+ instance.gzInput.close();
+ instance.ioInput.close();
+ instance.ioOutput.close();
- /* Return true */
- return true;
- } catch ( Any expr ) {
- return false;
- }
+ /* Return true */
+ return true;
+ } catch (Any expr) {
+ return false;
+ }
-
+
-
+
-
+
-
-
-
-
-
+
@@ -734,39 +629,48 @@
- /* Loop over directory query */
- for ( i = 1; i LTE dir.recordcount; i = i + 1 ) {
- 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 );
-
- /* Get files from sub directorys and add them to the array */
- else if ( dir.type[ i ] EQ "dir" AND arguments.recurse EQ "yes" ) {
- subdir = filesList( path, arguments.filter, arguments.recurse );
+ /* Loop over directory query */
+ for ( i = 1; i LTE dir.recordcount; i = i + 1 ) {
+ path = pathFormat( arguments.directory & instance.slash & dir.name[ i ] );
+
+ // Add file to array
+ if ( dir.type[ i ] EQ "file" && dir.name[ i ] NEQ instance.filename ) {
+ arrayAppend( array, path );
+ } else if ( dir.type[ i ] EQ "dir" && arguments.recurse EQ "yes" ) {
+ // Get files from sub directorys and add them to the array
+ subdir = filesList(
+ path,
+ arguments.filter,
+ arguments.recurse
+ );
- for ( n = 1; n LTE arrayLen( subdir ); n = n + 1 ) arrayAppend( array, subdir[ n ] );
+ for ( n = 1; n LTE arrayLen( subdir ); n = n + 1 ) {
+ arrayAppend( array, subdir[ n ] );
+ }
+ }
}
- }
- /* Return array */
- return array;
+ /* Return array */
+ return array;
-
+
-
-
-
-
+
+
-
-
+
+
\ No newline at end of file
diff --git a/modules/contentbox/models/validators/UniqueSiteFieldValidator.cfc b/modules/contentbox/models/validators/UniqueSiteFieldValidator.cfc
index bbf537e28a..de6eae740b 100644
--- a/modules/contentbox/models/validators/UniqueSiteFieldValidator.cfc
+++ b/modules/contentbox/models/validators/UniqueSiteFieldValidator.cfc
@@ -5,16 +5,16 @@
* Validates if the field has a unique value by site in the database, this only applies to ORM objects
*/
component accessors="true" singleton {
-
// Properties
property name="name";
+
property name="ormService";
/**
* Constructor
*/
- UniqueSiteFieldValidator function init(){
- variables.name = "UniqueSiteField";
+ UniqueSiteFieldValidator function init() {
+ variables.name = "UniqueSiteField";
variables.ORMService = new cborm.models.BaseORMService();
return this;
}
@@ -35,16 +35,17 @@ component accessors="true" singleton {
required string field,
any targetValue,
any validationData
- ){
+ ) {
// return true if no data to check, type needs a data element to be checked.
if (
- isNull( arguments.targetValue ) || ( isSimpleValue( arguments.targetValue ) && !len( arguments.targetValue ) )
+ isNull( arguments.targetValue ) ||
+ ( isSimpleValue( arguments.targetValue ) && !len( arguments.targetValue ) )
) {
return true;
}
// process entity setups.
- var entityName = arguments.target.getEntityName();
+ var entityName = arguments.target.getEntityName();
var identityField = variables.ormService.getKey( arguments.target );
var identityValue = arguments.target.getId();
@@ -62,11 +63,14 @@ component accessors="true" singleton {
// validate uniqueness
if ( c.count() GT 0 ) {
var args = {
- message : "The '#arguments.field#' value '#arguments.targetValue#' is not unique for the site '#arguments.target.getSite().getName()#' in the database",
- field : arguments.field,
- validationType : getName(),
- validationData : arguments.validationData,
- rejectedValue : arguments.targetValue
+ message: "The '#arguments.field#' value '#arguments.targetValue#' is not unique for the site '#arguments
+ .target
+ .getSite()
+ .getName()#' in the database",
+ field : arguments.field,
+ validationType: getName(),
+ validationData: arguments.validationData,
+ rejectedValue : arguments.targetValue
};
validationResult.addError( validationResult.newError( argumentCollection = args ) );
return false;
@@ -78,8 +82,8 @@ component accessors="true" singleton {
/**
* Get the name of the validator
*/
- string function getName(){
+ string function getName() {
return name;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/ModuleConfig.cfc
index 77f0ead66d..5d81691ae6 100755
--- a/modules/contentbox/modules/contentbox-admin/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-admin/ModuleConfig.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,51 +6,50 @@
* ContentBox Admin Module
*/
component {
-
// Module Properties
- this.title = "ContentBox Admin";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox Administration Module";
- this.viewParentLookup = true;
+ this.title = "ContentBox Admin";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox Administration Module";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
- this.entryPoint = "cbadmin";
- this.modelNamespace = "cbadmin";
- this.cfmapping = "cbadmin";
- this.dependencies = [];
+ this.entryPoint = "cbadmin";
+ this.modelNamespace = "cbadmin";
+ this.cfmapping = "cbadmin";
+ this.dependencies = [];
/**
* Configure Module
*/
- function configure(){
+ function configure() {
// Layout Settings
- layoutSettings = { defaultLayout : "admin.cfm" };
+ layoutSettings = { defaultLayout: "admin.cfm" };
// Module Settings
settings = {
// Security for the admin: Rules are loaded by the core contentbox module as it impacts the entire set of modules
- cbsecurity : {
- firewall : {
+ cbsecurity: {
+ firewall: {
// The global invalid authentication event or URI or URL to go if an invalid authentication occurs
- "invalidAuthenticationEvent" : "cbadmin/security/login",
+ "invalidAuthenticationEvent" : "cbadmin/security/login",
// Default Auhtentication Action: override or redirect when a user has not logged in
- "defaultAuthenticationAction" : "redirect",
+ "defaultAuthenticationAction": "redirect",
// The global invalid authorization event or URI or URL to go if an invalid authorization occurs
- "invalidAuthorizationEvent" : "cbadmin",
+ "invalidAuthorizationEvent" : "cbadmin",
// Default Authorization Action: override or redirect when a user does not have enough permissions to access something
- "defaultAuthorizationAction" : "redirect"
+ "defaultAuthorizationAction" : "redirect"
}
}
};
// i18n
- cbi18n = { resourceBundles : { "admin" : "#moduleMapping#/includes/i18n/admin" } };
+ cbi18n = { resourceBundles: { "admin": "#moduleMapping#/includes/i18n/admin" } };
// Custom Declared Points
interceptorSettings = {
// CB Admin Custom Events
- customInterceptionPoints : [
+ customInterceptionPoints: [
// Admin Layout HTML points
"cbadmin_beforeHeadEnd",
"cbadmin_afterBodyStart",
@@ -204,34 +203,34 @@ component {
interceptors = [
// CB Admin Request Interceptor
{
- class : "#moduleMapping#.interceptors.CBRequest",
- properties : { entryPoint : this.entryPoint },
- name : "CBRequest@cbAdmin"
+ class : "#moduleMapping#.interceptors.CBRequest",
+ properties: { entryPoint: this.entryPoint },
+ name : "CBRequest@cbAdmin"
},
// Login Tracker and Preventer
{
- class : "contentbox.models.security.LoginTracker",
- name : "LoginTracker@cbAdmin"
+ class: "contentbox.models.security.LoginTracker",
+ name : "LoginTracker@cbAdmin"
},
// Admin Notification services
{
- class : "contentbox.models.system.NotificationService",
- name : "NotificationService@cbAdmin"
+ class: "contentbox.models.system.NotificationService",
+ name : "NotificationService@cbAdmin"
},
// Admin MenuBuilder Cleanups
{
- class : "#moduleMapping#.interceptors.MenuCleanup",
- name : "MenuCleanup@cbAdmin"
+ class: "#moduleMapping#.interceptors.MenuCleanup",
+ name : "MenuCleanup@cbAdmin"
},
// Two Factor Authentication Enrollment Verifier
{
- class : "#moduleMapping#.interceptors.CheckForForceTwoFactorEnrollment",
- name : "CheckForForceTwoFactorEnrollment"
+ class: "#moduleMapping#.interceptors.CheckForForceTwoFactorEnrollment",
+ name : "CheckForForceTwoFactorEnrollment"
},
// Unenroll Two Factor on Provider Change
{
- class : "#moduleMapping#.interceptors.UnenrollTwoFactorOnProviderChange",
- name : "UnenrollTwoFactorOnProviderChange@cbAdmin"
+ class: "#moduleMapping#.interceptors.UnenrollTwoFactorOnProviderChange",
+ name : "UnenrollTwoFactorOnProviderChange@cbAdmin"
}
];
}
@@ -239,7 +238,7 @@ component {
/*
* On Module Load
*/
- function onLoad(){
+ function onLoad() {
// Startup the Editor Service, needed for markup translations support
wirebox.getInstance( "EditorService@contentbox" );
// Load Admin Helpers Manually: Renderer get's created and chicken and the egg issue again.
@@ -251,4 +250,4 @@ component {
.setTemplate( "/contentbox/models/ui/templates/messagebox.cfm" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/config/Router.cfc b/modules/contentbox/modules/contentbox-admin/config/Router.cfc
index ed36f7edde..64623a3144 100644
--- a/modules/contentbox/modules/contentbox-admin/config/Router.cfc
+++ b/modules/contentbox/modules/contentbox-admin/config/Router.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
route( "/" ).to( "dashboard" );
route( "/cbsecurity" ).toModuleRouting( "contentbox-security" );
@@ -17,10 +17,12 @@ component {
route( "/mediamanager/library/:library" ).to( "mediamanager" );
- route( "/module/:moduleEntryPoint/:moduleHandler?/:moduleAction?" ).to( "modules.execute" );
+ route(
+ "/module/:moduleEntryPoint/:moduleHandler?/:moduleAction?"
+ ).to( "modules.execute" );
// Convetion based routing
route( "/:handler/:action" ).end();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/elixir-module.js b/modules/contentbox/modules/contentbox-admin/elixir-module.js
index abf8fe19c3..7edf37b5ef 100644
--- a/modules/contentbox/modules/contentbox-admin/elixir-module.js
+++ b/modules/contentbox/modules/contentbox-admin/elixir-module.js
@@ -56,7 +56,7 @@ module.exports = function( mix ) {
if ( process.env.NODE_ENV != "development" ){
// Clean up compiled root assets
- fs.rmdir( "includes/js", { recursive: true } );
+ fs.rm( "includes/js", { recursive: true, force: true } );
fs.remove( "includes/rev-manifest.json" );
}
} );
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/about.cfc b/modules/contentbox/modules/contentbox-admin/handlers/about.cfc
index c3ea457676..0d16d327ba 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/about.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/about.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -9,10 +9,10 @@ component extends="baseHandler" {
/**
* ContentBox about page
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Light up
prc.tabSystem_about = true;
event.setView( "about/index" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc b/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc
index fb1aed0fe7..161e02507e 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/authors.cfc
@@ -6,23 +6,41 @@
* Manage ContentBox users
*/
component extends="baseHandler" {
-
// Dependencies
property name="authorService" inject="authorService@contentbox";
+
property name="securityService" inject="securityService@contentbox";
+
property name="entryService" inject="entryService@contentbox";
+
property name="permissionService" inject="permissionService@contentbox";
- property name="permissionGroupService" inject="permissionGroupService@contentbox";
+
+ property
+ name="permissionGroupService"
+ inject="permissionGroupService@contentbox";
+
property name="roleService" inject="roleService@contentbox";
+
property name="editorService" inject="editorService@contentbox";
+
property name="paging" inject="paging@contentbox";
+
property name="twoFactorService" inject="twoFactorService@contentbox";
- property name="markdownEditor" inject="markdownEditor@contentbox-markdowneditor";
+
+ property
+ name="markdownEditor"
+ inject="markdownEditor@contentbox-markdowneditor";
/**
* Pre handler
*/
- function preHandler( event, rc, prc, action, eventArguments ){
+ function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
var protectedActions = [
"save",
"editor",
@@ -40,9 +58,8 @@ component extends="baseHandler" {
var oAuthor = authorService.get( rc.authorID );
// Validate credentials only if you are an admin or you are yourself.
if (
- !prc.oCurrentAuthor.hasPermission( "AUTHOR_ADMIN" )
- AND
- oAuthor.getAuthorID() NEQ prc.oCurrentAuthor.getAuthorID()
+ !prc.oCurrentAuthor.hasPermission( "AUTHOR_ADMIN" ) &&
+ oAuthor.getAuthorID() NEQ prc.oCurrentAuthor.getAuthorID()
) {
// relocate
cbMessagebox().error( "You do not have permissions to do this!" );
@@ -57,23 +74,23 @@ component extends="baseHandler" {
*
* @return html
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// View all tab
prc.tabUsers_manage = true;
// exit handlers
- prc.xehAuthorTable = "#prc.cbAdminEntryPoint#.authors.indexTable";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.authors.importAll";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.authors.exportAll";
- prc.xehAuthorRemove = "#prc.cbAdminEntryPoint#.authors.remove";
- prc.xehAuthorCreate = "#prc.cbAdminEntryPoint#.authors.new";
- prc.xehAuthorsearch = "#prc.cbAdminEntryPoint#.authors";
+ prc.xehAuthorTable = "#prc.cbAdminEntryPoint#.authors.indexTable";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.authors.importAll";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.authors.exportAll";
+ prc.xehAuthorRemove = "#prc.cbAdminEntryPoint#.authors.remove";
+ prc.xehAuthorCreate = "#prc.cbAdminEntryPoint#.authors.new";
+ prc.xehAuthorsearch = "#prc.cbAdminEntryPoint#.authors";
prc.xehGlobalPasswordReset = "#prc.cbAdminEntryPoint#.authors.doGlobalPasswordReset";
// Get Roles
- prc.aRoles = roleService.getAll( sortOrder = "role" );
+ prc.aRoles = roleService.getAll( sortOrder = "role" );
prc.aPermissionGroups = permissionGroupService.getAll( sortOrder = "name" );
- prc.statusReport = authorService.getStatusReport();
+ prc.statusReport = authorService.getStatusReport();
// View
event.setView( "authors/index" );
@@ -82,7 +99,7 @@ component extends="baseHandler" {
/**
* Issue a global password reset for all users in the system.
*/
- function doGlobalPasswordReset( event, rc, prc ){
+ function doGlobalPasswordReset( event, rc, prc ) {
// announce event
announce( "cbadmin_onGlobalPasswordReset" );
// Get All Authors and reset the heck out of all of them.
@@ -92,12 +109,12 @@ component extends="baseHandler" {
// Issue a password reset for a user
thisAuthor.setIsPasswordReset( true );
securityService.sendPasswordReminder(
- author = thisAuthor,
- adminIssued = true,
- issuer = prc.oCurrentAuthor
- );
+ author = thisAuthor,
+ adminIssued = true,
+ issuer = prc.oCurrentAuthor
+ );
// announce individual event
- announce( "cbadmin_onPasswordReset", { author : thisAuthor } );
+ announce( "cbadmin_onPasswordReset", { author: thisAuthor } );
}
// Bulk Save
@@ -113,13 +130,17 @@ component extends="baseHandler" {
*
* @return html
*/
- function indexTable( event, rc, prc ){
+ function indexTable( event, rc, prc ) {
// paging
event
.paramValue( "page", 1 )
.paramValue( "showAll", false )
.paramValue( "searchAuthors", "" )
- .paramValue( "isFiltering", false, true )
+ .paramValue(
+ "isFiltering",
+ false,
+ true
+ )
.paramValue( "fStatus", "true" )
.paramValue( "f2FactorAuth", "true" )
.paramValue( "fRole", "any" )
@@ -127,22 +148,19 @@ component extends="baseHandler" {
.paramValue( "sortOrder", "lastname_asc" );
// prepare paging object
- prc.oPaging = variables.paging;
- prc.paging = prc.oPaging.getBoundaries();
+ prc.oPaging = variables.paging;
+ prc.paging = prc.oPaging.getBoundaries();
prc.pagingLink = "javascript:contentPaginate( @page@ )";
// exit Handlers
- prc.xehAuthorRemove = "#prc.cbAdminEntryPoint#.authors.remove";
- prc.xehExport = "#prc.cbAdminEntryPoint#.authors.export";
+ prc.xehAuthorRemove = "#prc.cbAdminEntryPoint#.authors.remove";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.authors.export";
prc.xehPasswordReset = "#prc.cbAdminEntryPoint#.authors.doPasswordReset";
// is Filtering?
if (
- rc.fRole neq "any"
- OR rc.fStatus neq "any"
- OR rc.f2FactorAuth neq "any"
- OR rc.fGroups neq "any"
- OR rc.showAll
+ rc.fRole NEQ "any" || rc.fStatus NEQ "any" || rc.f2FactorAuth NEQ "any" || rc.fGroups NEQ "any" ||
+ rc.showAll
) {
prc.isFiltering = true;
}
@@ -182,16 +200,16 @@ component extends="baseHandler" {
// Get all authors or search
var results = authorService.search(
- searchTerm = rc.searchAuthors,
- offset = ( rc.showAll ? 0 : prc.paging.startRow - 1 ),
- max = ( rc.showAll ? 0 : prc.cbSettings.cb_paging_maxrows ),
- sortOrder = sortOrder,
- isActive = rc.fStatus,
- role = rc.fRole,
- permissionGroups = rc.fGroups,
- twoFactorAuth = rc.f2FactorAuth
- );
- prc.authors = results.authors;
+ searchTerm = rc.searchAuthors,
+ offset = ( rc.showAll ? 0 : prc.paging.startRow - 1 ),
+ max = ( rc.showAll ? 0 : prc.cbSettings.cb_paging_maxrows ),
+ sortOrder = sortOrder,
+ isActive = rc.fStatus,
+ role = rc.fRole,
+ permissionGroups = rc.fGroups,
+ twoFactorAuth = rc.f2FactorAuth
+ );
+ prc.authors = results.authors;
prc.authorCount = results.count;
// View
@@ -203,7 +221,7 @@ component extends="baseHandler" {
*
* @return json
*/
- function usernameCheck( event, rc, prc ){
+ function usernameCheck( event, rc, prc ) {
var found = true;
event.paramValue( "username", "" );
@@ -221,7 +239,7 @@ component extends="baseHandler" {
*
* @return json
*/
- function emailCheck( event, rc, prc ){
+ function emailCheck( event, rc, prc ) {
var found = true;
event.paramValue( "email", "" );
@@ -237,7 +255,7 @@ component extends="baseHandler" {
/**
* Issue a password reset for the user
*/
- function doPasswordReset( event, rc, prc ){
+ function doPasswordReset( event, rc, prc ) {
event.paramValue( "editing", false );
// get new or persisted author
@@ -248,13 +266,15 @@ component extends="baseHandler" {
oAuthor.setIsPasswordReset( true );
variables.authorService.save( oAuthor );
securityService.sendPasswordReminder(
- author = oAuthor,
- adminIssued = true,
- issuer = prc.oCurrentAuthor
- );
+ author = oAuthor,
+ adminIssued = true,
+ issuer = prc.oCurrentAuthor
+ );
// announce event
- announce( "cbadmin_onPasswordReset", { author : oAuthor } );
- cbMessagebox().info( "Author marked for password reset upon login and email notification sent!" );
+ announce( "cbadmin_onPasswordReset", { author: oAuthor } );
+ cbMessagebox().info(
+ "Author marked for password reset upon login and email notification sent!"
+ );
} else {
cbMessagebox().error( "Invalid Author Sent!" );
}
@@ -270,22 +290,22 @@ component extends="baseHandler" {
* New author wizard
* You must have the AUTHOR_ADMIN permission to execute
*/
- function new( event, rc, prc ){
+ function new( event, rc, prc ) {
// exit handlers
- prc.xehAuthorsave = "#prc.cbAdminEntryPoint#.authors.doNew";
+ prc.xehAuthorsave = "#prc.cbAdminEntryPoint#.authors.doNew";
prc.xehUsernameCheck = "#prc.cbAdminEntryPoint#.authors.usernameCheck";
- prc.xehEmailCheck = "#prc.cbAdminEntryPoint#.authors.emailCheck";
+ prc.xehEmailCheck = "#prc.cbAdminEntryPoint#.authors.emailCheck";
// get new author for form
- prc.author = authorService.new();
+ prc.author = authorService.new();
// get all roles
- prc.roles = roleService.list( sortOrder = "role", asQuery = false );
+ prc.roles = roleService.list( sortOrder = "role", asQuery = false );
// Get all permission groups
prc.aPermissionGroups = permissionGroupService.list( sortOrder = "name", asQuery = false );
// get editors for preferences
- prc.editors = editorService.getRegisteredEditors();
+ prc.editors = editorService.getRegisteredEditors();
// Get All registered markups so we can display them
- prc.markups = editorService.getRegisteredMarkups();
+ prc.markups = editorService.getRegisteredMarkups();
// view
event.setView( "authors/new" );
@@ -295,13 +315,15 @@ component extends="baseHandler" {
* Create a new user in the system
* You must have the AUTHOR_ADMIN permission to execute
*/
- function doNew( event, rc, prc ){
+ function doNew( event, rc, prc ) {
// Get new author with defaults
- var oAuthor = authorService.new( {
- isActive : true,
- isPasswordReset : true,
- password : hash( createUUID() & now() )
- } );
+ var oAuthor = authorService.new(
+ {
+ isActive : true,
+ isPasswordReset: true,
+ password : hash( createUUID() & now() )
+ }
+ );
// get and populate author
populate(
@@ -324,18 +346,18 @@ component extends="baseHandler" {
var vResults = validate( target = oAuthor, excludes = "password" );
if ( !vResults.hasErrors() ) {
// announce event
- announce( "cbadmin_preNewAuthorSave", { author : oAuthor } );
+ announce( "cbadmin_preNewAuthorSave", { author: oAuthor } );
// save author
authorService.createNewAuthor( oAuthor );
// announce event
- announce( "cbadmin_postNewAuthorSave", { author : oAuthor } );
+ announce( "cbadmin_postNewAuthorSave", { author: oAuthor } );
// message
cbMessagebox().setMessage( "info", "New Author Created and Notified!" );
// relocate
relocate( prc.xehAuthors );
} else {
cbMessagebox().warn( vResults.getAllErrors() );
- return new ( argumentCollection = arguments );
+ return new( argumentCollection = arguments );
}
}
@@ -344,32 +366,32 @@ component extends="baseHandler" {
*
* @return html
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
event.paramValue( "authorID", 0 );
// HTML Title
- prc.htmlTitle = "Author Editor";
+ prc.htmlTitle = "Author Editor";
// exit handlers
- prc.xehAuthorsave = "#prc.cbAdminEntryPoint#/authors/save";
- prc.xehAuthorPreferences = "#prc.cbAdminEntryPoint#/authors/savePreferences";
+ prc.xehAuthorsave = "#prc.cbAdminEntryPoint#/authors/save";
+ prc.xehAuthorPreferences = "#prc.cbAdminEntryPoint#/authors/savePreferences";
prc.xehAuthorRawPreferences = "#prc.cbAdminEntryPoint#/authors/saveRawPreferences";
prc.xehAuthorChangePassword = "#prc.cbAdminEntryPoint#/authors/passwordChange";
- prc.xehAuthorPermissions = "#prc.cbAdminEntryPoint#/authors/permissions";
- prc.xehUsernameCheck = "#prc.cbAdminEntryPoint#/authors/usernameCheck";
- prc.xehEmailCheck = "#prc.cbAdminEntryPoint#/authors/emailCheck";
- prc.xehEntriesManager = "#prc.cbAdminEntryPoint#.entries/index";
- prc.xehPagesManager = "#prc.cbAdminEntryPoint#/pages/index";
- prc.xehContentStoreManager = "#prc.cbAdminEntryPoint#/contentStore/index";
- prc.xehExport = "#prc.cbAdminEntryPoint#/authors/export";
- prc.xehPasswordReset = "#prc.cbAdminEntryPoint#/authors/doPasswordReset";
- prc.xehEnrollTwoFactor = "#prc.cbAdminEntryPoint#/security/twofactorEnrollment/process";
- prc.xehUnenrollTwoFactor = "#prc.cbAdminEntryPoint#/security/twofactorEnrollment/unenroll";
- prc.xehTwoFactorRelocation = "#prc.cbAdminEntryPoint#/authors/editor/authorID/#rc.authorID###twofactor";
+ prc.xehAuthorPermissions = "#prc.cbAdminEntryPoint#/authors/permissions";
+ prc.xehUsernameCheck = "#prc.cbAdminEntryPoint#/authors/usernameCheck";
+ prc.xehEmailCheck = "#prc.cbAdminEntryPoint#/authors/emailCheck";
+ prc.xehEntriesManager = "#prc.cbAdminEntryPoint#.entries/index";
+ prc.xehPagesManager = "#prc.cbAdminEntryPoint#/pages/index";
+ prc.xehContentStoreManager = "#prc.cbAdminEntryPoint#/contentStore/index";
+ prc.xehExport = "#prc.cbAdminEntryPoint#/authors/export";
+ prc.xehPasswordReset = "#prc.cbAdminEntryPoint#/authors/doPasswordReset";
+ prc.xehEnrollTwoFactor = "#prc.cbAdminEntryPoint#/security/twofactorEnrollment/process";
+ prc.xehUnenrollTwoFactor = "#prc.cbAdminEntryPoint#/security/twofactorEnrollment/unenroll";
+ prc.xehTwoFactorRelocation = "#prc.cbAdminEntryPoint#/authors/editor/authorID/#rc.authorID###twofactor";
// get new or persisted author
- prc.author = authorService.get( rc.authorID );
+ prc.author = authorService.get( rc.authorID );
// get roles
- prc.roles = roleService.list( sortOrder = "role", asQuery = false );
+ prc.roles = roleService.list( sortOrder = "role", asQuery = false );
// get two factor provider
prc.twoFactorProvider = twoFactorService.getDefaultProviderObject();
// Markdown Editor Availability
@@ -379,21 +401,25 @@ component extends="baseHandler" {
if ( prc.author.isLoaded() ) {
// Preferences Viewlet
var args = {
- authorID : rc.authorID,
- sorting : false,
- max : 5,
- pagination : false,
- latest : true
+ authorID : rc.authorID,
+ sorting : false,
+ max : 5,
+ pagination: false,
+ latest : true
};
- prc.preferencesViewlet = listPreferences( event, rc, prc );
+ prc.preferencesViewlet = listPreferences(
+ event,
+ rc,
+ prc
+ );
// Latest Edits
prc.latestEditsViewlet = runEvent(
event = "contentbox-admin:content.latestContentEdits",
eventArguments = {
- author : prc.author,
- showHits : false,
- showAuthor : false
+ author : prc.author,
+ showHits : false,
+ showAuthor: false
}
);
@@ -401,12 +427,12 @@ component extends="baseHandler" {
prc.latestDraftsViewlet = runEvent(
event = "contentbox-admin:content.latestContentEdits",
eventArguments = {
- author : prc.author,
- isPublished : false,
- showHits : false,
- colorCodings : false,
- showPublishedStatus : false,
- showAuthor : false
+ author : prc.author,
+ isPublished : false,
+ showHits : false,
+ colorCodings : false,
+ showPublishedStatus: false,
+ showAuthor : false
}
);
}
@@ -419,7 +445,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function myprofile( event, rc, prc ){
+ function myprofile( event, rc, prc ) {
rc.authorID = prc.oCurrentAuthor.getAuthorID();
editor( argumentCollection = arguments );
}
@@ -427,17 +453,17 @@ component extends="baseHandler" {
/**
* change user editor preferences
*/
- function changeEditor( event, rc, prc ){
- var results = { "ERROR" : false, "MESSAGES" : "" };
+ function changeEditor( event, rc, prc ) {
+ var results = { "ERROR": false, "MESSAGES": "" };
try {
// store the new author preference
prc.oCurrentAuthor.setPreference( name = "editor", value = rc.editor );
// save Author preference
variables.authorService.save( prc.oCurrentAuthor );
results[ "MESSAGES" ] = "Editor changed to #rc.editor#";
- } catch ( Any e ) {
+ } catch (Any e) {
log.error( "Error saving preferences.", e );
- results[ "ERROR" ] = true;
+ results[ "ERROR" ] = true;
results[ "MESSAGES" ] = e.detail & e.message;
}
// return preference saved
@@ -447,7 +473,7 @@ component extends="baseHandler" {
/**
* Save a user preference usually called asynchronously
*/
- function saveSinglePreference( event, rc, prc ){
+ function saveSinglePreference( event, rc, prc ) {
// params
event.paramvalue( "preference", "" ).paramValue( "value", "" );
var response = event.getResponse();
@@ -459,84 +485,111 @@ component extends="baseHandler" {
// save Author preference
variables.authorService.save( prc.oCurrentAuthor );
// response
- response.setData( { "preference" : rc.preference, "value" : rc.value } ).addMessage( "Preference saved!" );
+ response.setData( { "preference": rc.preference, "value": rc.value } ).addMessage( "Preference saved!" );
} else {
response.setErrorMessage(
- "No preference sent",
- event.STATUS.BAD_REQUEST,
- response.400
- );
+ "No preference sent",
+ event.STATUS.BAD_REQUEST,
+ response.400
+ );
}
}
/**
* Save user preferences from the built UI from them
*/
- function savePreferences( event, rc, prc ){
- var oAuthor = variables.authorService.get( id = rc.authorID );
+ function savePreferences( event, rc, prc ) {
+ var oAuthor = variables.authorService.get( id = rc.authorID );
// Get only the UI form preferences that are prefixed to be saved
- var newPreferences = rc
- .filter( function( key, value ){
- return reFindNoCase( "^preference\.", arguments.key );
- } )
- // Clean them up
- .reduce( function( result, key, value ){
- result[ listLast( arguments.key, "." ) ] = arguments.value;
- return result;
- }, {} );
+ var newPreferences = rc.filter(
+ function( key, value ) {
+ return reFindNoCase( "^preference\.", arguments.key );
+ }
+ )// Clean them up
+ .reduce(
+ function( result, key, value ) {
+ result[ listLast( arguments.key, "." ) ] = arguments.value;
+ return result;
+ },
+ {}
+ );
// Store Preferences
oAuthor.setPreferences( oAuthor.getAllPreferences().append( newPreferences, true ) );
// announce event
- announce( "cbadmin_preAuthorPreferencesSave", { author : oAuthor, preferences : newPreferences } );
+ announce(
+ "cbadmin_preAuthorPreferencesSave",
+ { author: oAuthor, preferences: newPreferences }
+ );
// save Author
variables.authorService.save( oAuthor );
// announce event
- announce( "cbadmin_postAuthorPreferencesSave", { author : oAuthor, preferences : newPreferences } );
+ announce(
+ "cbadmin_postAuthorPreferencesSave",
+ { author: oAuthor, preferences: newPreferences }
+ );
// 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"
+ );
}
/**
* Save raw preferences
*/
- function saveRawPreferences( event, rc, prc ){
+ 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"
+ );
}
}
/**
* Save user
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// Get new or persisted user
var oAuthor = authorService.get( id = rc.authorID );
// get and populate author
- populate( model: oAuthor, exclude: "authorID" );
+ populate( model = oAuthor, exclude = "authorID" );
// Tag new or updated user
- var newAuthor = ( NOT oAuthor.isLoaded() );
+ var newAuthor = ( !oAuthor.isLoaded() );
// role assignment if permission allows it
if ( prc.oCurrentAuthor.hasPermission( "AUTHOR_ADMIN" ) ) {
@@ -544,40 +597,52 @@ 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(
"cbadmin_preAuthorSave",
{
- author : oAuthor,
- authorID : rc.authorID,
- isNew : newAuthor
+ author : oAuthor,
+ authorID: rc.authorID,
+ isNew : newAuthor
}
);
// save Author
variables.authorService.save( oAuthor );
// announce event
- announce( "cbadmin_postAuthorSave", { author : oAuthor, isNew : newAuthor } );
+ announce(
+ "cbadmin_postAuthorSave",
+ { author: oAuthor, isNew: newAuthor }
+ );
// message
cbMessagebox().setMessage( "info", "Author saved!" );
// relocate
relocate( prc.xehAuthors );
} else {
cbMessagebox().warn( vResults.getAllErrors() );
- relocate( event = prc.xehAuthorEditor, queryString = "authorID=#oAuthor.getAuthorID()#" );
+ relocate(
+ event = prc.xehAuthorEditor,
+ queryString = "authorID=#oAuthor.getAuthorID()#"
+ );
}
}
/**
* Change user password
*/
- function passwordChange( event, rc, prc ){
+ 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."
+ "You cannot change passwords for other users. Please start a password reset instead."
+ );
+ return relocate(
+ event = prc.xehAuthorEditor,
+ queryString = "authorID=#rc.authorID#"
);
- return relocate( event = prc.xehAuthorEditor, queryString = "authorID=#rc.authorID#" );
}
var oAuthor = authorService.get( id = rc.authorID );
@@ -587,7 +652,10 @@ 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 {
@@ -596,13 +664,16 @@ component extends="baseHandler" {
}
// relocate
- relocate( event = prc.xehAuthorEditor, queryString = "authorID=#rc.authorID#" );
+ relocate(
+ event = prc.xehAuthorEditor,
+ queryString = "authorID=#rc.authorID#"
+ );
}
/**
* Remove a user
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
event.paramValue( "targetAuthorID", 0 );
var oAuthor = variables.authorService.get( rc.targetAuthorID );
@@ -612,11 +683,17 @@ component extends="baseHandler" {
relocate( prc.xehAuthors );
}
// announce event
- announce( "cbadmin_preAuthorRemove", { author : oAuthor, authorID : rc.targetAuthorID } );
+ announce(
+ "cbadmin_preAuthorRemove",
+ { author: oAuthor, authorID: rc.targetAuthorID }
+ );
// remove
variables.authorService.delete( oAuthor );
// announce event
- announce( "cbadmin_postAuthorRemove", { authorID : rc.targetAuthorID } );
+ announce(
+ "cbadmin_postAuthorRemove",
+ { authorID: rc.targetAuthorID }
+ );
// message
cbMessagebox().setMessage( "info", "Author Removed!" );
// redirect
@@ -626,16 +703,16 @@ component extends="baseHandler" {
/**
* Display permissions tab
*/
- function permissions( event, rc, prc ){
+ function permissions( event, rc, prc ) {
// exit Handlers
prc.xehPermissionRemove = "#prc.cbAdminEntryPoint#.authors.removePermission";
- prc.xehPermissionSave = "#prc.cbAdminEntryPoint#.authors.savePermission";
- prc.xehRolePermissions = "#prc.cbAdminEntryPoint#.authors.permissions";
- prc.xehGroupRemove = "#prc.cbAdminEntryPoint#.authors.removePermissionGroup";
- prc.xehGroupSave = "#prc.cbAdminEntryPoint#.authors.savePermissionGroup";
+ prc.xehPermissionSave = "#prc.cbAdminEntryPoint#.authors.savePermission";
+ prc.xehRolePermissions = "#prc.cbAdminEntryPoint#.authors.permissions";
+ prc.xehGroupRemove = "#prc.cbAdminEntryPoint#.authors.removePermissionGroup";
+ prc.xehGroupSave = "#prc.cbAdminEntryPoint#.authors.savePermissionGroup";
// Get all permissions
- prc.aPermissions = permissionService.list( sortOrder = "permission", asQuery = false );
+ prc.aPermissions = permissionService.list( sortOrder = "permission", asQuery = false );
prc.aPermissionGroups = permissionGroupService.list( sortOrder = "name", asQuery = false );
// Get author
@@ -648,8 +725,8 @@ component extends="baseHandler" {
/**
* Save permission to the author and gracefully end.
*/
- function savePermission( event, rc, prc ){
- var oAuthor = authorService.get( rc.authorID );
+ function savePermission( event, rc, prc ) {
+ var oAuthor = authorService.get( rc.authorID );
var oPermission = permissionService.get( rc.permissionID );
// Assign it
@@ -667,8 +744,8 @@ component extends="baseHandler" {
*
* @return json
*/
- function removePermission( event, rc, prc ){
- var oAuthor = authorService.get( rc.authorID );
+ function removePermission( event, rc, prc ) {
+ var oAuthor = authorService.get( rc.authorID );
var oPermission = permissionService.get( rc.permissionID );
// Remove it
@@ -684,9 +761,9 @@ component extends="baseHandler" {
*
* @return json
*/
- function savePermissionGroup( event, rc, prc ){
+ function savePermissionGroup( event, rc, prc ) {
var oAuthor = authorService.get( rc.authorID );
- var oGroup = permissionGroupService.get( rc.permissionGroupID );
+ var oGroup = permissionGroupService.get( rc.permissionGroupID );
// Assign it
if ( !oAuthor.hasPermissionGroup( oGroup ) ) {
@@ -704,9 +781,9 @@ component extends="baseHandler" {
*
* @return json
*/
- function removePermissionGroup( event, rc, prc ){
+ function removePermissionGroup( event, rc, prc ) {
var oAuthor = authorService.get( rc.authorID );
- var oGroup = permissionGroupService.get( rc.permissionGroupID );
+ var oGroup = permissionGroupService.get( rc.permissionGroupID );
if ( oAuthor.hasPermissionGroup( oGroup ) ) {
// Remove it
@@ -722,28 +799,37 @@ component extends="baseHandler" {
/**
* Export a user
*/
- function export( event, rc, prc ){
- return variables.authorService
+ function export( event, rc, prc ) {
+ return variables
+ .authorService
.get( event.getValue( "authorID", 0 ) )
- .getMemento( includes: "permissions,permissionGroups,isPasswordReset,is2FactorAuth" );
+ .getMemento(
+ includes = "permissions,permissionGroups,isPasswordReset,is2FactorAuth"
+ );
}
/**
* Export multiple users
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
// Set a high timeout for long exports
setting requestTimeout="9999";
- param rc.authorID = "";
+ param rc.authorID = "";
// Export all or some
if ( len( rc.authorID ) ) {
- return rc.authorID
+ return rc
+ .authorID
.listToArray()
- .map( function( id ){
- return variables.authorService
- .get( arguments.id )
- .getMemento( includes: "permissions,permissionGroups,isPasswordReset,is2FactorAuth" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .authorService
+ .get( arguments.id )
+ .getMemento(
+ includes = "permissions,permissionGroups,isPasswordReset,is2FactorAuth"
+ );
+ }
+ );
} else {
return variables.authorService.getAllForExport();
}
@@ -752,21 +838,21 @@ component extends="baseHandler" {
/**
* Import all users
*/
- function importAll( event, 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 = authorService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = authorService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessagebox().error( errorMessage );
@@ -781,13 +867,16 @@ component extends="baseHandler" {
*
* @return view
*/
- private function listPreferences( event, rc, prc ){
+ private function listPreferences( event, rc, prc ) {
// get editors for preferences
prc.editors = editorService.getRegisteredEditors();
// Get All registered markups so we can display them
prc.markups = editorService.getRegisteredMarkups();
// render out view
- return view( view = "authors/listPreferences", module = "contentbox-admin" );
+ return view(
+ view = "authors/listPreferences",
+ module = "contentbox-admin"
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc
index 6126410463..bab18d0bf1 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/baseContentHandler.cfc
@@ -6,7 +6,6 @@
* The base content handler which is used by the entries, contentstore and pages handlers to provide uniformity
*/
component extends="baseHandler" {
-
/**
* --------------------------------------------------------------------------
* Core Dependencies
@@ -14,14 +13,20 @@ component extends="baseHandler" {
*/
property name="authorService" inject="authorService@contentbox";
+
property name="themeService" inject="themeService@contentbox";
+
property name="HTMLHelper" inject="HTMLHelper@coldbox";
+
property name="categoryService" inject="categoryService@contentbox";
+
property name="customFieldService" inject="customFieldService@contentbox";
+
property name="editorService" inject="editorService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
- property name="templateService" inject="ContentTemplateService@contentbox";
+ property name="templateService" inject="ContentTemplateService@contentbox";
/**
* --------------------------------------------------------------------------
* ColdBox Properties
@@ -38,20 +43,26 @@ component extends="baseHandler" {
*/
// The handler controlling the requests
- variables.handler = "";
+ variables.handler = "";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "";
+ variables.entity = "";
// The plural of the entity used for collections, ordering, etc.
- variables.entityPlural = "";
+ variables.entityPlural = "";
// The default ordering on collection searches, etc.
variables.defaultOrdering = "createdDate desc";
// The security prefix
- variables.securityPrefix = "";
+ variables.securityPrefix = "";
/**
* Pre Handler interceptions
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Light up the content tab in the sidebar
prc.tabContent = true;
}
@@ -59,7 +70,7 @@ component extends="baseHandler" {
/**
* Show Content
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Params
event.paramValue( "parent", "" );
@@ -68,16 +79,19 @@ component extends="baseHandler" {
// Get all available content templates
prc.availableTemplates = variables.templateService.getAvailableForContentType(
- contentType = variables.ormService.new().getContentType(),
- site = prc.oCurrentSite,
- fields = "templateID,name"
- );
+ contentType = variables
+ .ormService
+ .new()
+ .getContentType(),
+ site = prc.oCurrentSite,
+ fields = "templateID,name"
+ );
// get all categories
prc.categories = variables.categoryService.list(
- criteria = { "site" : prc.oCurrentSite },
- sortOrder = "category"
- );
+ criteria = { "site": prc.oCurrentSite },
+ sortOrder = "category"
+ );
// View according to handler section
event.setView( "#variables.handler#/index" );
@@ -88,7 +102,7 @@ component extends="baseHandler" {
*
* @return HTML
*/
- function contentTable( event, rc, prc ){
+ function contentTable( event, rc, prc ) {
// params
event
.paramValue( "page", 1 )
@@ -97,52 +111,53 @@ component extends="baseHandler" {
.paramValue( "fCategories", "all" )
.paramValue( "fCreators", "all" )
.paramValue( "fStatus", "any" )
- .paramValue( "isFiltering", false, true )
+ .paramValue(
+ "isFiltering",
+ false,
+ true
+ )
.paramValue( "parent", "" )
.paramValue( "showAll", false );
// prepare paging object
- prc.oPaging = getInstance( "Paging@contentbox" );
- prc.paging = prc.oPaging.getBoundaries();
+ prc.oPaging = getInstance( "Paging@contentbox" );
+ prc.paging = prc.oPaging.getBoundaries();
prc.pagingLink = "javascript:contentListHelper.contentPaginate(@page@)";
// JS null checks
- if ( rc.parent eq "undefined" ) {
+ if ( rc.parent EQ "undefined" ) {
rc.parent = "";
}
// Are we Filtering?
if (
- rc.fAuthors neq "all" OR
- rc.fStatus neq "any" OR
- rc.fCategories neq "all" OR
- rc.fCreators neq "all" OR
- rc.showAll
+ rc.fAuthors NEQ "all" || rc.fStatus NEQ "any" || rc.fCategories NEQ "all" || rc.fCreators NEQ "all" ||
+ rc.showAll
) {
prc.isFiltering = true;
}
// Doing a search or filtering?
- if ( len( rc.searchContent ) OR prc.isFiltering ) {
+ if ( len( rc.searchContent ) || prc.isFiltering ) {
// remove parent for searches, we go hierarchy wide
structDelete( rc, "parent" );
}
// search content with filters and all
var contentResults = variables.ormService.search(
- search : rc.searchContent,
- isPublished : rc.fStatus,
- category : rc.fCategories,
- author : rc.fAuthors,
- creator : rc.fCreators,
- parent : ( !isNull( rc.parent ) ? rc.parent : javacast( "null", "" ) ),
- sortOrder : variables.defaultOrdering,
- siteID : prc.oCurrentSite.getsiteID(),
- offset : prc.paging.startRow - 1,
- max : prc.cbSettings.cb_paging_maxrows,
- searchActiveContent: false
- );
- prc.content = contentResults[ variables.entityPlural ];
+ search = rc.searchContent,
+ isPublished = rc.fStatus,
+ category = rc.fCategories,
+ author = rc.fAuthors,
+ creator = rc.fCreators,
+ parent = ( !isNull( rc.parent ) ? rc.parent : javacast( "null", "" ) ),
+ sortOrder = variables.defaultOrdering,
+ siteID = prc.oCurrentSite.getsiteID(),
+ offset = prc.paging.startRow - 1,
+ max = prc.cbSettings.cb_paging_maxrows,
+ searchActiveContent = false
+ );
+ prc.content = contentResults[ variables.entityPlural ];
prc.contentCount = contentResults.count;
// Do we have a parent? Inflate it
@@ -162,8 +177,8 @@ component extends="baseHandler" {
*
* @return HTML
*/
- function quickLook( event, rc, prc ){
- prc.content = variables.ormService.get( event.getValue( "contentID", 0 ) );
+ function quickLook( event, rc, prc ) {
+ prc.content = variables.ormService.get( event.getValue( "contentID", 0 ) );
prc.xehContentEditor = "#prc.cbAdminEntryPoint#.#variables.handler#.editor";
event.setView( view = "content/quickLook", layout = "ajax" );
}
@@ -173,28 +188,38 @@ component extends="baseHandler" {
*
* @return json
*/
- function changeOrder( event, rc, prc ){
+ function changeOrder( event, rc, prc ) {
// param values
event.paramValue( "tableID", variables.entityPlural ).paramValue( "newRulesOrder", "" );
// decode + cleanup incoming rules data
// We replace _ to - due to the js plugin issue of not liking dashes
var aOrderedContent = urlDecode( rc.newRulesOrder )
- .replace( "_", "-", "all" )
+ .replace(
+ "_",
+ "-",
+ "all"
+ )
.listToArray( "&" )
- .map( function( thisItem ){
- return reReplaceNoCase(
- arguments.thisItem,
- "#rc.tableID#\[\]\=",
- "",
- "all"
- );
- } )
+ .map(
+ function( thisItem ) {
+ return reReplaceNoCase(
+ arguments.thisItem,
+ "#rc.tableID#\[\]\=",
+ "",
+ "all"
+ );
+ }
+ )
// Inflate
- .map( function( thisId, index ){
- return variables.ormService.get( arguments.thisId ).setOrder( arguments.index );
- } );
-
+ .map(
+ function( thisId, index ) {
+ return variables
+ .ormService
+ .get( arguments.thisId )
+ .setOrder( arguments.index );
+ }
+ );
// save them
if ( arrayLen( aOrderedContent ) ) {
@@ -205,9 +230,11 @@ component extends="baseHandler" {
event
.getResponse()
.setData(
- aOrderedContent.map( function( thisItem ){
- return arguments.thisItem.getContentID();
- } )
+ aOrderedContent.map(
+ function( thisItem ) {
+ return arguments.thisItem.getContentID();
+ }
+ )
)
.addMessage( "Content ordered successfully!" );
}
@@ -217,7 +244,7 @@ component extends="baseHandler" {
*
* @relocateTo Where to relocate when done updating
*/
- function bulkStatus( event, rc, prc, required relocateTo ){
+ function bulkStatus( event, rc, prc, required relocateTo ) {
event
.paramValue( "parent", "" )
.paramValue( "contentID", "" )
@@ -225,14 +252,16 @@ 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 }
+ { contentID: rc.contentID, status: rc.contentStatus }
);
// Message
- cbMessageBox().info( "#listLen( rc.contentID )# content where set to '#rc.contentStatus#'" );
+ cbMessageBox().info(
+ "#listLen( rc.contentID )# content where set to '#rc.contentStatus#'"
+ );
} else {
cbMessageBox().warn( "No content selected!" );
}
@@ -248,12 +277,12 @@ component extends="baseHandler" {
/**
* Show the editor
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// get all categories
prc.categories = variables.categoryService.list(
- criteria : { "site" : prc.oCurrentSite },
- sortOrder: "category"
- );
+ criteria = { "site": prc.oCurrentSite },
+ sortOrder = "category"
+ );
// get new or persisted content object to edit
prc.oContent = variables.ormService.get( event.getValue( "contentID", 0 ) );
@@ -263,12 +292,12 @@ component extends="baseHandler" {
// Get Comments viewlet
prc.commentsViewlet = runEvent(
event = "contentbox-admin:comments.pager",
- eventArguments = { contentID : rc.contentID }
+ eventArguments = { contentID: rc.contentID }
);
// Get History Versions Viewlet
prc.versionsViewlet = runEvent(
event = "contentbox-admin:versions.pager",
- eventArguments = { contentID : rc.contentID }
+ eventArguments = { contentID: rc.contentID }
);
} else {
prc.oContent.setSite( prc.oCurrentSite );
@@ -280,26 +309,28 @@ component extends="baseHandler" {
}
}
// Get all content names for parent drop downs excluding yourself and your children
- prc.allContent = variables.ormService
- .getAllFlatContent( sortOrder: "slug asc", siteID: prc.oCurrentSite.getsiteID() )
- .filter( function( item ){
- return prc.oContent.isLoaded() ? !reFindNoCase(
- "#prc.oContent.getSlug()#\/?",
- arguments.item[ "slug" ]
- ) : true;
- } );
+ prc.allContent = variables
+ .ormService
+ .getAllFlatContent( sortOrder = "slug asc", siteID = prc.oCurrentSite.getsiteID() )
+ .filter(
+ function( item ) {
+ return prc.oContent.isLoaded()
+ ? !reFindNoCase( "#prc.oContent.getSlug()#\/?", arguments.item[ "slug" ] )
+ : true;
+ }
+ );
// Get all available content templates
prc.availableTemplates = variables.templateService.getAvailableForContentType(
- contentType = prc.oContent.getContentType(),
- site = prc.oContent.isLoaded() ? prc.oContent.getSite() : prc.oCurrentSite,
- fields = "templateID,name"
- );
+ contentType = prc.oContent.getContentType(),
+ site = prc.oContent.isLoaded() ? prc.oContent.getSite() : prc.oCurrentSite,
+ fields = "templateID,name"
+ );
// Provide JWT Tokens for communicating with the API
- prc.jwtTokens = jwtAuth().fromUser( prc.oCurrentAuthor );
+ prc.jwtTokens = jwtAuth().fromUser( prc.oCurrentAuthor );
// Get All registered editors so we can display them
- prc.editors = variables.editorService.getRegisteredEditorsMap();
+ prc.editors = variables.editorService.getRegisteredEditorsMap();
// Get User's default editor
prc.defaultEditor = getUserDefaultEditor( prc.oCurrentAuthor );
// Check if the markup matches the choosen editor
@@ -307,30 +338,30 @@ component extends="baseHandler" {
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" );
+ prc.authors = variables.authorService.getAll( sortOrder = "lastName" );
// get related content
- prc.relatedContent = prc.oContent.hasRelatedContent() ? prc.oContent.getRelatedContent() : [];
- prc.linkedContent = prc.oContent.hasLinkedContent() ? prc.oContent.getLinkedContent() : [];
+ prc.relatedContent = prc.oContent.hasRelatedContent() ? prc.oContent.getRelatedContent() : [];
+ prc.linkedContent = prc.oContent.hasLinkedContent() ? prc.oContent.getLinkedContent() : [];
prc.relatedContentIDs = prc.oContent.getRelatedContentIDs();
// Get default or overriden parent
prc.parentContentID = !isNull( rc.parentID ) ? rc.parentID : prc.oContent.getParentID();
// Exit Handlers
- prc.xehContentList = "#prc.cbAdminEntryPoint#.#variables.handler#";
- prc.xehContentSave = "#prc.cbAdminEntryPoint#.#variables.handler#.save";
- prc.xehSlugify = "#prc.cbAdminEntryPoint#.#variables.handler#.slugify";
- prc.xehAuthorEditorSave = "#prc.cbAdminEntryPoint#.authors.changeEditor";
- prc.xehSlugCheck = "#prc.cbAdminEntryPoint#.content.slugUnique";
- prc.xehRelatedContentSelector = "#prc.cbAdminEntryPoint#.content.relatedContentSelector";
+ prc.xehContentList = "#prc.cbAdminEntryPoint#.#variables.handler#";
+ prc.xehContentSave = "#prc.cbAdminEntryPoint#.#variables.handler#.save";
+ prc.xehSlugify = "#prc.cbAdminEntryPoint#.#variables.handler#.slugify";
+ prc.xehAuthorEditorSave = "#prc.cbAdminEntryPoint#.authors.changeEditor";
+ prc.xehSlugCheck = "#prc.cbAdminEntryPoint#.content.slugUnique";
+ prc.xehRelatedContentSelector = "#prc.cbAdminEntryPoint#.content.relatedContentSelector";
prc.xehShowRelatedContentSelector = "#prc.cbAdminEntryPoint#.content.showRelatedContentSelector";
- prc.xehBreakContentLink = "#prc.cbAdminEntryPoint#.content.breakContentLink";
+ prc.xehBreakContentLink = "#prc.cbAdminEntryPoint#.content.breakContentLink";
// View
event.setView( "content/editor" );
@@ -348,7 +379,7 @@ component extends="baseHandler" {
prc,
required adminPermission,
required relocateTo
- ){
+ ) {
// form params
event
.paramValue( "allowComments", prc.cbSiteSettings.cb_comments_enabled )
@@ -366,24 +397,21 @@ component extends="baseHandler" {
.paramValue( "publishedHour", timeFormat( rc.publishedDate, "HH" ) )
.paramValue( "publishedMinute", timeFormat( rc.publishedDate, "mm" ) )
.paramValue( "saveAsTemplate", false )
- .paramValue(
- "publishedTime",
- event.getValue( "publishedHour" ) & ":" & event.getValue( "publishedMinute" )
- )
+ .paramValue( "publishedTime",
+ event.getValue( "publishedHour" ) & ":" & event.getValue( "publishedMinute" ) )
.paramValue( "relatedContentIDs", [] )
- .paramValue( "slug", "" )
- ;
+ .paramValue( "slug", "" );
// If no published date found, then default it to NOW!
- if ( NOT len( rc.publishedDate ) ) {
+ if ( !len( rc.publishedDate ) ) {
rc.publishedDate = dateFormat( now() );
}
// slugify the incoming title or slug
rc.slug = (
- NOT len( rc.slug ) ? variables.HTMLHelper.slugify( rc.title ) : variables.HTMLHelper.slugify(
- listLast( rc.slug, "/" )
- )
+ !len( rc.slug )
+ ? variables.HTMLHelper.slugify( rc.title )
+ : variables.HTMLHelper.slugify( listLast( rc.slug, "/" ) )
);
// Verify permission for publishing, else save as draft
@@ -392,29 +420,26 @@ component extends="baseHandler" {
}
// get new/persisted page and populate it with incoming data.
- var oContent = variables.ormService.get( rc.contentID );
+ var oContent = variables.ormService.get( rc.contentID );
var originalSlug = oContent.getSlug();
- variables.ormService
+ variables
+ .ormService
.populate(
target = oContent,
memento = rc,
- exclude = "contentID,siteID",
+ exclude = "contentID,siteID,contentVersions,activeContentVersions",
nullEmptyInclude = "expireDate"
)
.addJoinedPublishedtime( rc.publishedTime )
.addJoinedExpiredTime( rc.expireTime );
- var isNew = ( NOT oContent.isLoaded() );
+ var isNew = ( !oContent.isLoaded() );
// Attach creator if new page
if ( isNew ) {
oContent.setSite( prc.oCurrentSite ).setCreator( prc.oCurrentAuthor );
- }
- // Override creator if persisted?
- else if (
- !isNew and
- prc.oCurrentAuthor.hasPermission( arguments.adminPermission ) and
- len( rc.creatorID ) and
- oContent.getCreator().getAuthorID() NEQ rc.creatorID
+ } else if (
+ !isNew && prc.oCurrentAuthor.hasPermission( arguments.adminPermission ) && len( rc.creatorID ) &&
+ oContent.getCreator().getAuthorID() NEQ rc.creatorID
) {
oContent.setCreator( variables.authorService.get( rc.creatorID ) );
}
@@ -430,21 +455,21 @@ component extends="baseHandler" {
// Prettify content if json
if ( isJSON( rc.content ) ) {
rc.content = getInstance( "JSONPrettyPrint@JSONPrettyPrint" ).formatJson(
- json : rc.content,
- lineEnding : chr( 10 ),
- spaceAfterColon: true
- );
+ json = rc.content,
+ lineEnding = chr( 10 ),
+ spaceAfterColon = true
+ );
}
// Register a new content in the page, versionized!
oContent.addNewContentVersion(
- content : rc.content,
- changelog: rc.changelog,
- author : prc.oCurrentAuthor
- );
+ content = rc.content,
+ changelog = rc.changelog,
+ author = prc.oCurrentAuthor
+ );
// Inflate parent
- if ( rc.parentContent EQ "null" OR rc.parentContent EQ "" ) {
+ if ( rc.parentContent EQ "null" || rc.parentContent EQ "" ) {
oContent.setParent( javacast( "null", "" ) );
} else {
oContent.setParent( variables.ormService.get( rc.parentContent ) );
@@ -466,41 +491,47 @@ component extends="baseHandler" {
// If directed to create a template from the content item, do this now and assign it
if ( rc.saveAsTemplate ) {
var template = templateService.newFromContentItem( oContent );
- templateService.save( template )
+ templateService.save( template );
oContent.setContentTemplate( template );
}
// announce event
announce(
"cbadmin_pre#variables.Entity#Save",
{
- content : oContent,
- isNew : isNew,
- originalSlug : originalSlug
+ content : oContent,
+ isNew : isNew,
+ originalSlug: originalSlug
}
);
// save content
- variables.ormService.save( oContent, originalSlug != oContent.getSlug() ? originalSlug : "" );
+ variables.ormService.save(
+ oContent,
+ originalSlug != oContent.getSlug() ? originalSlug : ""
+ );
// announce event
announce(
"cbadmin_post#variables.entity#Save",
{
- content : oContent,
- isNew : isNew,
- originalSlug : originalSlug
+ content : oContent,
+ isNew : isNew,
+ originalSlug: originalSlug
}
);
// Ajax?
if ( event.isAjax() ) {
- var rData = { "CONTENTID" : oContent.getContentID() };
+ var rData = { "CONTENTID": oContent.getContentID() };
event.renderData( type = "json", data = rData );
} else {
// relocate
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 );
}
@@ -512,13 +543,18 @@ component extends="baseHandler" {
*
* @relocateTo Where to relocate to when saving is done
*/
- function clone( event, rc, prc, required relocateTo ){
+ function clone( event, rc, prc, required relocateTo ) {
// Defaults
- event.paramValue( "site", prc.oCurrentSite.getsiteID() );
+ event.paramValue( "site", prc.oCurrentSite.getsiteID() )
+ .paramValue( "contentID", "" )
+ .paramValue( "title", "" )
+ .paramValue( "contentStatus", "draft" );
// validation
- if ( !event.valueExists( "title" ) OR !event.valueExists( "contentID" ) ) {
- cbMessageBox().warn( "Can't clone the unclonable, meaning no contentID or title passed." );
+ if ( !trim( rc.contentID ).len() || !trim( rc.title ).len() ) {
+ cbMessageBox().warn(
+ "Can't clone the unclonable, meaning no contentID or title passed."
+ );
relocate( arguments.relocateTo );
return;
}
@@ -527,27 +563,30 @@ component extends="baseHandler" {
var original = variables.ormService.get( rc.contentID );
// Verify new Title, else do a new copy of it, but only if it's in the same site.
- if ( original.isSameSite( rc.site ) && rc.title eq original.getTitle() ) {
+ if ( original.isSameSite( rc.site ) && rc.title EQ original.getTitle() ) {
rc.title = "Copy of #rc.title#";
}
// 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 )
- } )
+ 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() );
clone.clone(
- author : prc.oCurrentAuthor,
- original : original,
- originalService : variables.ormService,
- publish : rc.contentStatus,
- originalSlugRoot: original.getSlug(),
- newSlugRoot : clone.getSlug()
+ author = prc.oCurrentAuthor,
+ original = original,
+ originalService = variables.ormService,
+ publish = rc.contentStatus,
+ originalSlugRoot = original.getSlug(),
+ newSlugRoot = clone.getSlug()
);
// relocate
@@ -555,7 +594,10 @@ component extends="baseHandler" {
// Relocate
if ( original.hasParent() ) {
- relocate( event = arguments.relocateTo, querystring = "parent=#original.getParent().getContentID()#" );
+ relocate(
+ event = arguments.relocateTo,
+ querystring = "parent=#original.getParent().getContentID()#"
+ );
} else {
relocate( event = arguments.relocateTo );
}
@@ -566,7 +608,7 @@ component extends="baseHandler" {
*
* @relocateTo Where to relocate to when saving is done
*/
- function remove( event, rc, prc, required relocateTo ){
+ function remove( event, rc, prc, required relocateTo ) {
// params
event.paramValue( "contentID", "" ).paramValue( "parent", "" );
@@ -584,13 +626,19 @@ 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();
- var title = oContent.getTitle();
+ var title = oContent.getTitle();
// announce event
- announce( "cbadmin_pre#variables.entity#Remove", { content : oContent } );
+ announce(
+ "cbadmin_pre#variables.entity#Remove",
+ { content: oContent }
+ );
// Diassociate it, bi-directional relationship
if ( oContent.hasParent() ) {
oContent.getParent().removeChild( oContent );
@@ -599,7 +647,10 @@ component extends="baseHandler" {
variables.ormService.delete( oContent );
arrayAppend( messages, "Content '#title#' removed" );
// announce event
- announce( "cbadmin_post#variables.entity#Remove", { contentID : contentID } );
+ announce(
+ "cbadmin_post#variables.entity#Remove",
+ { contentID: contentID }
+ );
}
}
@@ -614,7 +665,7 @@ component extends="baseHandler" {
*
* @return plain
*/
- function slugify( event, rc, prc ){
+ function slugify( event, rc, prc ) {
param rc.slug = "";
return trim( variables.HTMLHelper.slugify( rc.slug ) );
}
@@ -626,7 +677,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function editorSelector( event, rc, prc, sortOrder ){
+ function editorSelector( event, rc, prc, sortOrder ) {
// paging default
event
.paramValue( "page", 1 )
@@ -637,27 +688,27 @@ component extends="baseHandler" {
prc.xehEditorSelector = "#prc.cbAdminEntryPoint#.#variables.handler#.editorSelector";
// prepare paging object
- prc.oPaging = getInstance( "Paging@contentbox" );
- prc.paging = prc.oPaging.getBoundaries();
+ prc.oPaging = getInstance( "Paging@contentbox" );
+ prc.paging = prc.oPaging.getBoundaries();
prc.pagingLink = "javascript:pagerLink(@page@)";
// search entries with filters and all
var results = variables.ormService.search(
- search : rc.search,
- offset : prc.paging.startRow - 1,
- max : prc.cbSettings.cb_paging_maxrows,
- sortOrder : arguments.sortOrder,
- searchActiveContent: false,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ search = rc.search,
+ offset = prc.paging.startRow - 1,
+ max = prc.cbSettings.cb_paging_maxrows,
+ sortOrder = arguments.sortOrder,
+ searchActiveContent = false,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// setup data for display
- prc.content = results[ variables.entityPlural ];
+ prc.content = results[ variables.entityPlural ];
prc.contentCount = results.count;
- prc.CBHelper = variables.CBHelper;
- prc.contentType = variables.entityPlural;
+ prc.CBHelper = variables.CBHelper;
+ prc.contentType = variables.entityPlural;
// if ajax and searching, just return tables
- if ( event.isAjax() and len( rc.search ) OR rc.clear ) {
+ if ( event.isAjax() && len( rc.search ) || rc.clear ) {
event.setView( view = "content/editorSelectorEntries", layout = "ajax" );
} else {
event.setView( view = "content/editorSelector", layout = "ajax" );
@@ -669,24 +720,33 @@ component extends="baseHandler" {
*
* @return json
*/
- function export( event, rc, prc ){
- return variables.ormService.get( event.getValue( "contentID", 0 ) ).getMemento( profile: "export" );
+ function export( event, rc, prc ) {
+ return variables
+ .ormService
+ .get( event.getValue( "contentID", 0 ) )
+ .getMemento( profile = "export" );
}
/**
* Export All or Selected Content
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
// Set a high timeout for long exports
setting requestTimeout="9999";
- param rc.contentID = "";
+ param rc.contentID = "";
// Export all or some
if ( len( rc.contentID ) ) {
- return rc.contentID
+ return rc
+ .contentID
.listToArray()
- .map( function( id ){
- return variables.ormService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .ormService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.ormService.getAllForExport( prc.oCurrentSite );
}
@@ -697,24 +757,22 @@ component extends="baseHandler" {
*
* @relocateTo Where to relocate to when saving is done
*/
- function importAll( event, rc, prc, required relocateTo ){
+ function importAll( event, rc, prc, required relocateTo ) {
event.paramValue( "importFile", "" );
event.paramValue( "overrideContent", false );
try {
- if ( len( rc.importFile ) and fileExists( rc.importFile ) ) {
- var importLog = variables.ormService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = variables.ormService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
cbMessageBox().info( "Content imported sucessfully!" );
flash.put( "importLog", importLog );
} else {
cbMessageBox().error(
- "The import file is invalid: #encodeForHTML( rc.importFile )# cannot continue with import"
- );
+ "The import file is invalid: #encodeForHTML( rc.importFile )# cannot continue with import"
+ );
}
- } catch ( any e ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -738,12 +796,12 @@ component extends="baseHandler" {
event,
rc,
prc,
- authorID = "all",
+ authorID = "all",
parent,
max = 0,
pagination = true,
latest = false
- ){
+ ) {
// check if authorID exists in rc to do an override, maybe it's the paging call
if ( event.valueExists( "contentPager_authorID" ) ) {
arguments.authorID = rc.contentPager_authorID;
@@ -758,7 +816,7 @@ component extends="baseHandler" {
}
// Max rows incoming or take default for pagination.
- if ( arguments.max eq 0 ) {
+ if ( arguments.max EQ 0 ) {
arguments.max = prc.cbSettings.cb_paging_maxrows;
}
@@ -767,33 +825,37 @@ 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;
// search entries with filters and all
var results = variables.ormService.search(
- author : arguments.authorID,
- parent : ( !isNull( arguments.parent ) ? arguments.parent : javacast( "null", "" ) ),
- offset : prc.contentPager_paging.startRow - 1,
- max : arguments.max,
- sortOrder: ( arguments.latest ? "modifiedDate desc" : "title asc" )
- );
- prc.contentPager_content = results[ variables.entityPlural ];
+ author = arguments.authorID,
+ parent = ( !isNull( arguments.parent ) ? arguments.parent : javacast( "null", "" ) ),
+ offset = prc.contentPager_paging.startRow - 1,
+ max = arguments.max,
+ sortOrder = ( arguments.latest ? "modifiedDate desc" : "title asc" )
+ );
+ prc.contentPager_content = results[ variables.entityPlural ];
prc.contentPager_contentCount = results.count;
// author info
- prc.contentPager_authorID = arguments.authorID;
+ prc.contentPager_authorID = arguments.authorID;
// parent filters se // parent filters setup
- event.paramValue( "pager_parentID", "", true );
+ event.paramValue(
+ "pager_parentID",
+ "",
+ true
+ );
if ( !isNull( arguments.parent ) ) {
prc.contentPager_parentID = arguments.parent;
}
// Exit Handlers
- prc.xehContentPager = "#prc.cbAdminEntryPoint#.#variables.handler#.pager";
- prc.xehContentPagerHistory = "#prc.cbAdminEntryPoint#.versions.index";
- prc.xehContentPagerEditor = "#prc.cbAdminEntryPoint#.#variables.handler#.editor";
- prc.xehContentPagerQuickLook = "#prc.cbAdminEntryPoint#.#variables.handler#.quickLook";
+ prc.xehContentPager = "#prc.cbAdminEntryPoint#.#variables.handler#.pager";
+ prc.xehContentPagerHistory = "#prc.cbAdminEntryPoint#.versions.index";
+ prc.xehContentPagerEditor = "#prc.cbAdminEntryPoint#.#variables.handler#.editor";
+ prc.xehContentPagerQuickLook = "#prc.cbAdminEntryPoint#.#variables.handler#.quickLook";
// Security Prefix
prc.contentPager_securityPrefix = variables.securityPrefix;
@@ -801,7 +863,6 @@ component extends="baseHandler" {
return view( view = "content/pager", module = "contentbox-admin" );
}
-
/****************************************************************/
/* PRIVATE FUNCTIONS */
/****************************************************************/
@@ -813,7 +874,7 @@ component extends="baseHandler" {
*
* @return The default editor in string format
*/
- private function getUserDefaultEditor( required author ){
+ private function getUserDefaultEditor( required author ) {
// get user default editor
var userEditor = arguments.author.getPreference( "editor", editorService.getDefaultEditor() );
@@ -830,4 +891,4 @@ component extends="baseHandler" {
return editorService.getDefaultEditor();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc
index d35e3eb2e2..844f5fd221 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/baseHandler.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ********************************************************************************
* Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
* www.ortussolutions.com
@@ -6,7 +6,6 @@
* The Base handler for ALL ContentBox admin handlers.
*/
component extends="coldbox.system.RestHandler" {
-
/**
* --------------------------------------------------------------------------
* Global Dependencies
@@ -14,8 +13,11 @@ component extends="coldbox.system.RestHandler" {
*/
property name="siteService" inject="siteService@contentbox";
+
property name="settingService" inject="settingService@contentbox";
+
property name="CBHelper" inject="CBHelper@contentbox";
+
property name="paginator" inject="Paging@contentbox";
/**
@@ -24,8 +26,10 @@ 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;
+ private numeric function getMaxRows( maxRows ) {
+ var results = isNull( arguments.maxRows )
+ ? variables.settingService.getSetting( "cb_paging_maxrows" )
+ : arguments.maxRows;
return val( results );
}
@@ -37,9 +41,9 @@ component extends="coldbox.system.RestHandler" {
*
* @return The page start offset
*/
- private numeric function getPageOffset( page = 1, maxRows ){
+ private numeric function getPageOffset( page = 1, maxRows ) {
var thisMaxRows = getMaxRows( argumentCollection = arguments );
return ( arguments.page * thisMaxRows - thisMaxRows );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc b/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc
index 79f750296e..e9d96105fa 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/categories.cfc
@@ -6,27 +6,33 @@
* Manage categories
*/
component extends="baseHandler" {
-
// Dependencies
property name="categoryService" inject="categoryService@contentbox";
+
property name="HTMLHelper" inject="HTMLHelper@coldbox";
/**
* Pre handler
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
prc.tabContent = true;
}
/**
* Manage categories
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
prc.xehCategories = "#prc.cbAdminEntryPoint#.Categories";
- prc.xehExport = "#prc.cbAdminEntryPoint#.Categories.export";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.Categories.exportAll";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.Categories.importAll";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.Categories.export";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.Categories.exportAll";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.Categories.importAll";
// Tab
prc.tabContent_categories = true;
@@ -40,7 +46,7 @@ component extends="baseHandler" {
*
* @return json
*/
- function search( event, rc, prc ){
+ function search( event, rc, prc ) {
// Params
event
.paramValue( "search", "" )
@@ -49,17 +55,19 @@ component extends="baseHandler" {
// Get all categories by search
var results = variables.categoryService.search(
- search : rc.search,
- isPublic: len( rc.isPublic ) ? rc.isPublic : javacast( "null", "" ),
- siteId : prc.oCurrentSite.getSiteId()
- );
+ search = rc.search,
+ isPublic = len( rc.isPublic ) ? rc.isPublic : javacast( "null", "" ),
+ siteId = prc.oCurrentSite.getSiteId()
+ );
event
.getResponse()
.setData(
- results.categories.map( function( thisCategory ){
- return thisCategory.getMemento( excludes = "siteSnapshot:site" );
- } )
+ results.categories.map(
+ function( thisCategory ) {
+ return thisCategory.getMemento( excludes = "siteSnapshot:site" );
+ }
+ )
)
.setPagination(
getPageOffset( rc.page ),
@@ -69,58 +77,61 @@ component extends="baseHandler" {
);
}
-
/**
* Save categories
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// Params
param rc.categoryID = "";
- param rc.slug = "";
- param rc.category = "";
- param rc.isPublic = false;
+ param rc.slug = "";
+ param rc.category = "";
+ param rc.isPublic = false;
// slugify if not passed, and allow passed slugs to be saved as-is
- if ( NOT len( rc.slug ) ) {
+ if ( !len( rc.slug ) ) {
rc.slug = variables.HTMLHelper.slugify( rc.category );
}
// Pop/Get/Set
- var oCategory = populate( model: variables.categoryService.get( rc.categoryID ), exclude: "categoryID" ).setSite(
- prc.oCurrentSite
- );
+ var oCategory = populate( 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
- announce( "cbadmin_postCategorySave", { category : oCategory } );
+ announce( "cbadmin_postCategorySave", { category: oCategory } );
// response
event
.getResponse()
.setData( oCategory.getMemento() )
.addMessage( "Category saved!" );
} else {
- event.getResponse().setErrorMessage( vResults.getAllErrors(), 400, "Invalid data" );
+ event.getResponse().setErrorMessage(
+ vResults.getAllErrors(),
+ 400,
+ "Invalid data"
+ );
}
}
/**
* Remove categories
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// Params
param rc.categoryID = "";
// verify if contentID sent
if ( !len( rc.categoryID ) ) {
- return event
- .getResponse()
- .setErrorMessage(
+ return event.getResponse().setErrorMessage(
"No categories sent to delete",
400,
"Invalid Data"
@@ -129,24 +140,30 @@ component extends="baseHandler" {
// Inflate to array
rc.categoryID = isSimpleValue( rc.categoryID ) ? listToArray( rc.categoryID ) : rc.categoryID;
- var messages = [];
+ var messages = [];
// Iterate and remove
for ( var thisCatID in rc.categoryID ) {
var category = variables.categoryService.get( thisCatID );
if ( isNull( category ) ) {
- arrayAppend( messages, "Invalid categoryID sent: #thisCatID#, so skipped removal" );
+ arrayAppend(
+ messages,
+ "Invalid categoryID sent: #thisCatID#, so skipped removal"
+ );
} else {
// GET id to be sent for announcing later
var categoryID = category.getCategoryID();
- var title = category.getSlug();
+ 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" );
// announce event
- announce( "cbadmin_postCategoryRemove", { categoryID : categoryID } );
+ announce( "cbadmin_postCategoryRemove", { categoryID: categoryID } );
}
}
@@ -157,22 +174,31 @@ component extends="baseHandler" {
/**
* Export a category
*/
- function export( event, rc, prc ){
- return variables.categoryService.get( event.getValue( "categoryID", 0 ) ).getMemento();
+ function export( event, rc, prc ) {
+ return variables
+ .categoryService
+ .get( event.getValue( "categoryID", 0 ) )
+ .getMemento();
}
/**
* Export all categories
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
param rc.categoryID = "";
// Export all or some
if ( len( rc.categoryID ) ) {
- return rc.categoryID
+ return rc
+ .categoryID
.listToArray()
- .map( function( id ){
- return variables.categoryService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .categoryService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.categoryService.getAllForExport( prc.oCurrentSite );
}
@@ -181,21 +207,21 @@ component extends="baseHandler" {
/**
* Import all categories
*/
- function importAll( event, 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 = variables.categoryService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = variables.categoryService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -203,4 +229,4 @@ component extends="baseHandler" {
relocate( prc.xehCategories );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/ckfilebrowser.cfc b/modules/contentbox/modules/contentbox-admin/handlers/ckfilebrowser.cfc
index 8c5f33a37b..56b4afbca2 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/ckfilebrowser.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/ckfilebrowser.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -8,18 +8,24 @@
component extends="baseHandler" {
// pre handler
- function preHandler( event, rc, prc, action, eventArguments ){
+ function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// event to run
prc.cbCKfileBrowserDefaultEvent = event.getPrivateValue(
- "cbCKfileBrowserDefaultEvent",
- "contentbox-filebrowser:home.index"
- );
+ "cbCKfileBrowserDefaultEvent",
+ "contentbox-filebrowser:home.index"
+ );
// CKEditor callback, use if incoming, else default it
if ( !structKeyExists( rc, "callback" ) ) {
rc.callback = "fbCKSelect";
}
// get settings according to contentbox
- prc.cbCKSetting = settingService.buildFileBrowserSettings();
+ prc.cbCKSetting = settingService.buildFileBrowserSettings();
// load jquery as it is standalone
prc.cbCKSetting.loadJQuery = true;
}
@@ -27,40 +33,52 @@ component extends="baseHandler" {
/**
* Present all assets via ckeditor integration
*/
- function index( event, rc, prc ){
- var args = { widget : true, settings : prc.cbCKSetting };
- return runEvent( event = prc.cbCKfileBrowserDefaultEvent, eventArguments = args );
+ function index( event, rc, prc ) {
+ var args = { widget: true, settings: prc.cbCKSetting };
+ return runEvent(
+ event = prc.cbCKfileBrowserDefaultEvent,
+ eventArguments = args
+ );
}
/**
* Present image assets via ckeditor integration
*/
- function image( event, rc, prc ){
+ function image( event, rc, prc ) {
rc.filtertype = "Image";
- var args = { widget : true, settings : prc.cbCKSetting };
- return runEvent( event = prc.cbCKfileBrowserDefaultEvent, eventArguments = args );
+ var args = { widget: true, settings: prc.cbCKSetting };
+ return runEvent(
+ event = prc.cbCKfileBrowserDefaultEvent,
+ eventArguments = args
+ );
}
/**
* Present flash assets via ckeditor integration
*/
- function flash( event, rc, prc ){
+ function flash( event, rc, prc ) {
rc.filtertype = "Flash";
- var args = { widget : true, settings : prc.cbCKSetting };
- return runEvent( event = prc.cbCKfileBrowserDefaultEvent, eventArguments = args );
+ var args = { widget: true, settings: prc.cbCKSetting };
+ return runEvent(
+ event = prc.cbCKfileBrowserDefaultEvent,
+ eventArguments = args
+ );
}
/**
* Inline Asset chooser brought via Ajax
*/
- function assetChooser( event, rc, prc ){
+ function assetChooser( event, rc, prc ) {
// prepare filebrowser settings
prc.cbCKSetting.loadJQuery = false;
- var args = { widget : true, settings : prc.cbCKSetting };
+ var args = { widget: true, settings: prc.cbCKSetting };
// load filebrowser inline
- prc.fileBrowser = runEvent( event = prc.cbCKfileBrowserDefaultEvent, eventArguments = args );
+ prc.fileBrowser = runEvent(
+ event = prc.cbCKfileBrowserDefaultEvent,
+ eventArguments = args
+ );
// view
event.setView( view = "ckfilebrowser/assetChooser", layout = "ajax" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc b/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc
index 9f512ab1f8..171dddedf4 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/comments.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,24 +6,29 @@
* Manage comments
*/
component extends="baseHandler" {
-
// Dependencies
property name="commentService" inject="commentService@contentbox";
- property name="settingsService" inject="settingService@contentbox";
+ property name="settingsService" inject="settingService@contentbox";
// Public properties
this.preHandler_except = "pager";
/**
* Pre handler
*
- * @event
- * @action
+ * @event
+ * @action
* @eventArguments
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab selection
prc.tabComments = true;
}
@@ -32,10 +37,10 @@ component extends="baseHandler" {
* Main display of comments
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// params
event.paramValue( "page", 1 );
event.paramValue( "searchComments", "" );
@@ -44,8 +49,8 @@ component extends="baseHandler" {
event.paramValue( "isFiltering", false );
// prepare paging object
- prc.oPaging = getInstance( "Paging@contentbox" );
- prc.paging = prc.oPaging.getBoundaries();
+ prc.oPaging = getInstance( "Paging@contentbox" );
+ prc.paging = prc.oPaging.getBoundaries();
prc.pagingLink = event.buildLink( "#prc.xehComments#.page.@page@?" );
// Append search to paging link?
@@ -54,34 +59,34 @@ component extends="baseHandler" {
}
// Append filters to paging link?
- if ( rc.fStatus neq "any" ) {
+ if ( rc.fStatus NEQ "any" ) {
prc.pagingLink &= "&fStatus=#rc.fStatus#";
}
// is Filtering?
- if ( rc.fStatus neq "any" ) {
+ if ( rc.fStatus NEQ "any" ) {
rc.isFiltering = true;
}
// search comments with filters and all
var commentResults = variables.commentService.search(
- search : rc.searchComments,
- offset : prc.paging.startRow - 1,
- max : prc.cbSettings.cb_paging_maxrows,
- isApproved: rc.fStatus,
- siteID : prc.oCurrentSite.getsiteID()
- );
-
- prc.comments = commentResults.comments;
- prc.commentsCount = commentResults.count;
- prc.countApproved = variables.commentService.getApprovedCount();
+ search = rc.searchComments,
+ offset = prc.paging.startRow - 1,
+ max = prc.cbSettings.cb_paging_maxrows,
+ isApproved = rc.fStatus,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
+
+ prc.comments = commentResults.comments;
+ prc.commentsCount = commentResults.count;
+ prc.countApproved = variables.commentService.getApprovedCount();
prc.countUnApproved = variables.commentService.getUnApprovedCount();
// exit Handlers
- prc.xehCommentEditor = "#prc.cbAdminEntryPoint#.comments.editor";
- prc.xehCommentRemove = "#prc.cbAdminEntryPoint#.comments.remove";
- prc.xehCommentstatus = "#prc.cbAdminEntryPoint#.comments.doStatusUpdate";
- prc.xehCommentQuickLook = "#prc.cbAdminEntryPoint#.comments.quicklook";
+ prc.xehCommentEditor = "#prc.cbAdminEntryPoint#.comments.editor";
+ prc.xehCommentRemove = "#prc.cbAdminEntryPoint#.comments.remove";
+ prc.xehCommentstatus = "#prc.cbAdminEntryPoint#.comments.doStatusUpdate";
+ prc.xehCommentQuickLook = "#prc.cbAdminEntryPoint#.comments.quicklook";
prc.xehCommentRemoveAllModerated = "#prc.cbAdminEntryPoint#.comments.removeAllModerated";
// tab
@@ -95,26 +100,29 @@ component extends="baseHandler" {
* Submit a status udpate on a comment
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function doStatusUpdate( event, rc, prc ){
+ function doStatusUpdate( event, rc, prc ) {
// param values
event.paramValue( "commentID", "" );
event.paramValue( "page", "1" );
- var data = { "ERROR" : false, "MESSAGES" : "" };
+ var data = { "ERROR": false, "MESSAGES": "" };
// check if comment id list has length
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 );
} else {
data.messages = "No comments selected!";
- data.error = true;
+ data.error = true;
cbMessageBox().warn( data.messages );
}
@@ -131,12 +139,12 @@ component extends="baseHandler" {
* Show the comment editor
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// get new or persisted
- rc.comment = commentService.get( event.getValue( "commentID", 0 ) );
+ rc.comment = commentService.get( event.getValue( "commentID", 0 ) );
// exit handlers
prc.xehCommentsave = "#prc.cbAdminEntryPoint#.comments.save";
// view
@@ -147,10 +155,10 @@ component extends="baseHandler" {
* Show the comment moderator
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function moderate( event, rc, prc ){
+ function moderate( event, rc, prc ) {
// get new or persisted
rc.comment = commentService.get( event.getValue( "commentID", 0 ) );
if ( isNull( rc.Comment ) ) {
@@ -160,7 +168,7 @@ component extends="baseHandler" {
}
// exit handlers
prc.xehCommentstatus = "#prc.cbAdminEntryPoint#.comments.doStatusUpdate";
- rc.xehCommentRemove = "#prc.cbAdminEntryPoint#.comments.remove";
+ rc.xehCommentRemove = "#prc.cbAdminEntryPoint#.comments.remove";
// view
event.setView( "comments/moderate" );
}
@@ -169,12 +177,12 @@ component extends="baseHandler" {
* Comment quick look
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*
* @return HTML
*/
- function quickLook( event, rc, prc ){
+ function quickLook( event, rc, prc ) {
// get new or persisted
rc.comment = commentService.get( event.getValue( "commentID", 0 ) );
// view
@@ -185,18 +193,21 @@ component extends="baseHandler" {
* Save a comment
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// populate and get comment
- var oComment = populate( model: commentService.get( id = rc.commentID ), exclude: "commentID" );
+ var oComment = populate( model = commentService.get( id = rc.commentID ), exclude = "commentID" );
// announce event
- announce( "cbadmin_preCommentSave", { comment : oComment, commentID : rc.commentID } );
+ announce(
+ "cbadmin_preCommentSave",
+ { comment: oComment, commentID: rc.commentID }
+ );
// save comment
commentService.save( oComment );
// announce event
- announce( "cbadmin_postCommentSave", { comment : oComment } );
+ announce( "cbadmin_postCommentSave", { comment: oComment } );
// notice
cbMessageBox().info( "Comment Saved!" );
// relocate
@@ -207,13 +218,13 @@ component extends="baseHandler" {
* Remove all Moderated comments
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*
* @return JSON or relocation
*/
- function removeAllModerated( event, rc, prc ){
- var data = { "ERROR" : false, "MESSAGES" : "" };
+ function removeAllModerated( event, rc, prc ) {
+ var data = { "ERROR": false, "MESSAGES": "" };
// announce event
announce( "cbadmin_preCommentRemoveAllModerated" );
// passing 0 will delete all unapproved...
@@ -236,36 +247,44 @@ component extends="baseHandler" {
* Remove comments from the database
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*
* @return JSON or relocation
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// param values
event.paramValue( "commentID", "" ).paramValue( "page", "1" );
// prepare data return object
- var data = { "ERROR" : false, "MESSAGES" : [] };
+ var data = { "ERROR": false, "MESSAGES": [] };
// Remove incoming comments
- rc.commentID
+ rc
+ .commentID
.listToArray()
- .each( function( thisCommentID ){
- var oComment = commentService.get( thisCommentID );
- // null checks
- if ( isNull( oComment ) ) {
- arrayAppend( data.messages, "Invalid commentID sent: #thisCommentID#, so skipped removal" );
- } else {
- // announce event
- announce( "cbadmin_preCommentRemove", { comment : oComment, commentID : thisCommentID } );
- // remove
- commentService.delete( oComment );
- arrayAppend( data.messages, "Comment #thisCommentID# removed" );
- // announce event
- announce( "cbadmin_postCommentRemove", { commentID : thisCommentID } );
+ .each(
+ function( thisCommentID ) {
+ var oComment = commentService.get( thisCommentID );
+
+ if ( isNull( oComment ) ) {
+ arrayAppend(
+ data.messages,
+ "Invalid commentID sent: #thisCommentID#, so skipped removal"
+ );
+ } else {
+ announce(
+ "cbadmin_preCommentRemove",
+ { comment: oComment, commentID: thisCommentID }
+ );
+
+ commentService.delete( oComment );
+ arrayAppend( data.messages, "Comment #thisCommentID# removed" );
+
+ announce( "cbadmin_postCommentRemove", { commentID: thisCommentID } );
+ }
}
- } );
+ );
// No comments selected
if ( !len( rc.commentID ) ) {
@@ -286,9 +305,9 @@ component extends="baseHandler" {
/**
* Comment Pager
*
- * @event
- * @rc
- * @prc
+ * @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
@@ -300,7 +319,7 @@ component extends="baseHandler" {
contentID = "all",
max = 0,
pagination = true
- ){
+ ) {
// check if contentID exists in rc to do an override, maybe it's the paging call
if ( event.valueExists( "commentPager_contentID" ) ) {
arguments.contentID = rc.commentPager_contentID;
@@ -314,7 +333,7 @@ component extends="baseHandler" {
arguments.max = rc.commentPager_max;
}
// Max rows incoming or take default for pagination.
- if ( arguments.max eq 0 ) {
+ if ( arguments.max EQ 0 ) {
arguments.max = prc.cbSettings.cb_paging_maxrows;
}
@@ -322,27 +341,27 @@ component extends="baseHandler" {
event.paramValue( "page", 1 );
// exit handlers
- prc.xehCommentPager = "#prc.cbAdminEntryPoint#.comments.pager";
- prc.xehCommentPagerQuickLook = "#prc.cbAdminEntryPoint#.comments.quickLook";
- prc.xehCommentPagerStatus = "#prc.cbAdminEntryPoint#.comments.doStatusUpdate";
- prc.xehCommentPagerRemove = "#prc.cbAdminEntryPoint#.comments.remove";
+ prc.xehCommentPager = "#prc.cbAdminEntryPoint#.comments.pager";
+ prc.xehCommentPagerQuickLook = "#prc.cbAdminEntryPoint#.comments.quickLook";
+ prc.xehCommentPagerStatus = "#prc.cbAdminEntryPoint#.comments.doStatusUpdate";
+ prc.xehCommentPagerRemove = "#prc.cbAdminEntryPoint#.comments.remove";
prc.xehCommentRemoveAllModerated = "#prc.cbAdminEntryPoint#.comments.removeAllModerated";
// prepare paging object
- prc.commentPager_oPaging = getInstance( "Paging@contentbox" );
- prc.commentPager_paging = prc.commentPager_oPaging.getBoundaries();
+ prc.commentPager_oPaging = getInstance( "Paging@contentbox" );
+ prc.commentPager_paging = prc.commentPager_oPaging.getBoundaries();
prc.commentPager_pagingLink = "javascript:commentPagerLink(@page@)";
prc.commentPager_pagination = arguments.pagination;
- prc.commentPager_max = arguments.max;
+ prc.commentPager_max = arguments.max;
// search entries with filters and all
var commentResults = commentService.search(
- contentID: arguments.contentID,
- offset : prc.commentPager_paging.startRow - 1,
- max : arguments.max,
- siteID : prc.oCurrentSite.getsiteID()
- );
- prc.commentPager_comments = commentResults.comments;
+ contentID = arguments.contentID,
+ offset = prc.commentPager_paging.startRow - 1,
+ max = arguments.max,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
+ prc.commentPager_comments = commentResults.comments;
prc.commentPager_commentsCount = commentResults.count;
// incoming entry ID
@@ -356,11 +375,11 @@ component extends="baseHandler" {
* Show comment settings panel
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function settings( event, rc, prc ){
- rc.xehSaveSettings = "#prc.cbAdminEntryPoint#.comments.saveSettings";
+ function settings( event, rc, prc ) {
+ rc.xehSaveSettings = "#prc.cbAdminEntryPoint#.comments.saveSettings";
prc.tabComments_settings = true;
event.setView( "comments/settings" );
}
@@ -368,16 +387,21 @@ component extends="baseHandler" {
/**
* Save the comment settings
*/
- function saveSettings( event, rc, prc ){
+ 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 ){
- return key.findNoCase( "cb_comments" );
- } ),
- prc.oCurrentSite
- );
+ rc.filter(
+ function( key ) {
+ return key.findNoCase( "cb_comments" );
+ }
+ ),
+ prc.oCurrentSite
+ );
// announce event
announce( "cbadmin_postCommentSettingsSave" );
// relocate back to editor
@@ -385,4 +409,4 @@ component extends="baseHandler" {
relocate( prc.xehCommentsettings );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/content.cfc b/modules/contentbox/modules/contentbox-admin/handlers/content.cfc
index 0af2895ebd..6d77b739e7 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/content.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/content.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,11 +6,13 @@
* Manage Generic content actions
*/
component extends="baseHandler" {
-
// Dependencies
property name="contentService" inject="contentService@contentbox";
+
property name="statsService" inject="statsService@contentbox";
+
property name="contentStoreService" inject="contentStoreService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
/**
@@ -18,7 +20,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function preview( event, rc, prc ){
+ function preview( event, rc, prc ) {
// param incoming data
event
.paramValue( "layout", "pages" )
@@ -37,12 +39,12 @@ component extends="baseHandler" {
}
case "Entry": {
prc.xehPreview = variables.CBHelper.linkPage( "__entry_preview" );
- rc.layout = "blog";
+ rc.layout = "blog";
break;
}
case "ContentStore": {
var oContent = contentStoreService.new();
- prc.preview = oContent.renderContentSilent( rc.content );
+ prc.preview = oContent.renderContentSilent( rc.content );
event.setView( view = "content/simplePreview", layout = "ajax" );
return;
}
@@ -58,46 +60,50 @@ component extends="baseHandler" {
*
* @return html
*/
- function search( event, rc, prc ){
+ function search( event, rc, prc ) {
// Params
event.paramValue( "search", "" );
// Determine Context via `:` Search string
- prc.context = "";
+ prc.context = "";
prc.contentTypes = "page,entry,contentstore";
if ( find( ":", rc.search ) ) {
prc.context = listFirst( rc.search, ":" );
- rc.search = listLast( rc.search, ":" );
+ rc.search = listLast( rc.search, ":" );
}
// Determine search via context or none at all
if ( !len( prc.context ) || listFindNoCase( prc.contentTypes, prc.context ) ) {
// Search for content
prc.results = variables.contentService.searchContent(
- searchTerm : rc.search,
- max : prc.cbSettings.cb_admin_quicksearch_max,
- sortOrder : "title",
- isPublished : "all",
- searchActiveContent: false,
- contentTypes : prc.context,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ searchTerm = rc.search,
+ max = prc.cbSettings.cb_admin_quicksearch_max,
+ sortOrder = "title",
+ isPublished = "all",
+ searchActiveContent = false,
+ contentTypes = prc.context,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
prc.minContentCount = (
- prc.results.count lt prc.cbSettings.cb_admin_quicksearch_max ? prc.results.count : prc.cbSettings.cb_admin_quicksearch_max
+ prc.results.count LT prc.cbSettings.cb_admin_quicksearch_max
+ ? prc.results.count
+ : prc.cbSettings.cb_admin_quicksearch_max
);
} else {
- prc.results = { "count" : 0, "content" : [] };
+ prc.results = { "count": 0, "content": [] };
prc.minContentCount = 0;
}
// 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
+ prc.authors.count LT prc.cbSettings.cb_admin_quicksearch_max
+ ? prc.authors.count
+ : prc.cbSettings.cb_admin_quicksearch_max
);
} else {
- prc.authors = { "count" : 0, "authors" : [] };
+ prc.authors = { "count": 0, "authors": [] };
prc.minAuthorCount = 0;
}
@@ -114,21 +120,21 @@ component extends="baseHandler" {
*
* @return json
*/
- function slugUnique( event, rc, prc ){
+ function slugUnique( event, rc, prc ) {
// Params
- param rc.slug = "";
- param rc.contentID = "";
+ param rc.slug = "";
+ param rc.contentID = "";
param rc.contentType = "";
- var data = { "UNIQUE" : false };
+ var data = { "UNIQUE": false };
if ( len( rc.slug ) ) {
data[ "UNIQUE" ] = variables.contentService.isSlugUnique(
- slug : rc.slug,
- contentID : rc.contentID,
- siteID : prc.oCurrentSite.getsiteID(),
- contentType: rc.contentType
- );
+ slug = rc.slug,
+ contentID = rc.contentID,
+ siteID = prc.oCurrentSite.getsiteID(),
+ contentType = rc.contentType
+ );
}
event.renderData( data = data, type = "json" );
@@ -139,7 +145,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function relatedContentSelector( event, rc, prc ){
+ function relatedContentSelector( event, rc, prc ) {
// paging default
event
.paramValue( "page", 1 )
@@ -152,29 +158,32 @@ component extends="baseHandler" {
prc.xehRelatedContentSelector = "#prc.cbAdminEntryPoint#.content.relatedContentSelector";
// prepare paging object
- prc.oPaging = getInstance( "Paging@contentbox" );
- prc.paging = prc.oPaging.getBoundaries();
+ prc.oPaging = getInstance( "Paging@contentbox" );
+ prc.paging = prc.oPaging.getBoundaries();
prc.pagingLink = "javascript:pagerLink( @page@, '#rc.contentType#' )";
// search entries with filters and all
var contentResults = variables.contentService.searchContent(
- searchTerm : rc.search,
- offset : prc.paging.startRow - 1,
- max : prc.cbSettings.cb_paging_maxrows,
- sortOrder : ( rc.contentType == "Entry" ? "publishedDate desc" : "slug asc" ),
- searchActiveContent: false,
- contentTypes : rc.contentType,
- excludeIDs : rc.excludeIDs,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ searchTerm = rc.search,
+ offset = prc.paging.startRow - 1,
+ max = prc.cbSettings.cb_paging_maxrows,
+ sortOrder = ( rc.contentType == "Entry" ? "publishedDate desc" : "slug asc" ),
+ searchActiveContent = false,
+ contentTypes = rc.contentType,
+ excludeIDs = rc.excludeIDs,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// setup data for display
- prc.content = contentResults.content;
+ prc.content = contentResults.content;
prc.contentCount = contentResults.count;
- prc.CBHelper = variables.CBHelper;
+ prc.CBHelper = variables.CBHelper;
// if ajax and searching, just return tables
- return view( view = "content/relatedContentResults", module = "contentbox-admin" );
+ return view(
+ view = "content/relatedContentResults",
+ module = "contentbox-admin"
+ );
}
/**
@@ -182,7 +191,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function showRelatedContentSelector( event, rc, prc ){
+ function showRelatedContentSelector( event, rc, prc ) {
event
.paramValue( "search", "" )
.paramValue( "clear", false )
@@ -191,7 +200,7 @@ component extends="baseHandler" {
// exit handlers
prc.xehRelatedContentSelector = "#prc.cbAdminEntryPoint#.content.relatedContentSelector";
- prc.CBHelper = variables.CBHelper;
+ prc.CBHelper = variables.CBHelper;
event.setView( view = "content/relatedContentSelector", layout = "ajax" );
}
@@ -201,13 +210,13 @@ component extends="baseHandler" {
*
* @return json
*/
- function breakContentLink( event, rc, prc ){
+ function breakContentLink( event, rc, prc ) {
event.paramValue( "contentID", "" ).paramValue( "linkedID", "" );
var data = {};
if ( len( rc.contentID ) && len( rc.linkedID ) ) {
var currentContent = variables.contentService.get( rc.contentID );
- var linkedContent = variables.contentService.get( rc.linkedID );
+ var linkedContent = variables.contentService.get( rc.linkedID );
linkedContent.removeRelatedContent( currentContent );
variables.contentService.save( linkedContent );
@@ -222,23 +231,38 @@ component extends="baseHandler" {
*
* @return json
*/
- any function resetHits( event, rc, prc ){
+ any function resetHits( event, rc, prc ) {
event.paramValue( "contentID", "" );
// build to array and iterate
listToArray( rc.contentID )
- // Build out each content object
- .map( function( thisId ){
- return variables.contentService.get( arguments.thisId );
- } )
- // Filter only loaded and content objects that have stats already
- .filter( function( thisContent ){
- return ( !isNull( arguments.thisContent ) && arguments.thisContent.hasStats() );
- } )
+ .map(
+ function( thisId ) {
+ return variables.contentService.get( arguments.thisId );
+ }
+ )
+ .filter(
+ function( thisContent ) {
+ return (
+ !isNull( arguments.thisContent ) &&
+ variables.statsService.getTotalHitsByContent( arguments.thisContent.getContentID() ) > 0
+ );
+ }
+ )
+ // Filter only loaded content objects that have stats
// Reset Hits
- .each( function( thisContent ){
- variables.contentService.save( arguments.thisContent.getStats().setHits( 0 ) );
- event.getResponse().addMessage( "Hits reset for (#arguments.thisContent.getTitle()#)" );
- } );
+ .each(
+ function( thisContent ) {
+ var oStat = variables
+ .statsService
+ .newCriteria()
+ .isEq( "relatedContent.contentID", arguments.thisContent.getContentID() )
+ .get();
+ if ( !isNull( oStat ) ) {
+ variables.statsService.save( oStat.setHits( 0 ) );
+ }
+ event.getResponse().addMessage( "Hits reset for (#arguments.thisContent.getTitle()#)" );
+ }
+ );
}
/**
@@ -266,11 +290,11 @@ component extends="baseHandler" {
boolean colorCodings = true,
boolean showPublishedStatus = true,
boolean showAuthor = true
- ){
+ ) {
// Setup args so we can use them in the viewlet
var args = {
- max : arguments.max,
- siteID : prc.oCurrentSite.getsiteID()
+ max : arguments.max,
+ siteID: prc.oCurrentSite.getsiteID()
};
if ( structKeyExists( arguments, "author" ) ) {
args.author = arguments.author;
@@ -292,12 +316,12 @@ component extends="baseHandler" {
view = "content/contentViewlet",
module = "contentbox-admin",
args = {
- viewletID : createUUID(),
- aContent : aLatestEdits,
- showHits : arguments.showHits,
- colorCodings : arguments.colorCodings,
- showPublishedStatus : arguments.showPublishedStatus,
- showAuthor : arguments.showAuthor
+ viewletID : createUUID(),
+ aContent : aLatestEdits,
+ showHits : arguments.showHits,
+ colorCodings : arguments.colorCodings,
+ showPublishedStatus: arguments.showPublishedStatus,
+ showAuthor : arguments.showAuthor
}
);
}
@@ -321,7 +345,7 @@ component extends="baseHandler" {
event,
rc,
prc,
- boolean showExpired = false,
+ boolean showExpired = false,
any author,
boolean offset = 0,
numeric max = 25,
@@ -329,12 +353,12 @@ component extends="baseHandler" {
boolean colorCodings = true,
boolean showPublishedStatus = true,
boolean showAuthor = true
- ){
+ ) {
// Setup args so we can use them in the viewlet
var args = {
- max : arguments.max,
- offset : arguments.offset,
- siteID : prc.oCurrentSite.getsiteID()
+ max : arguments.max,
+ offset: arguments.offset,
+ siteID: prc.oCurrentSite.getsiteID()
};
if ( structKeyExists( arguments, "author" ) ) {
args.author = arguments.author;
@@ -344,9 +368,8 @@ component extends="baseHandler" {
var aContent = "";
if ( arguments.showExpired ) {
aContent = variables.contentService.findExpiredContent( argumentCollection = args );
- }
- // Future Published Content
- else {
+ } else {
+ // Future Published Content
aContent = variables.contentService.findFuturePublishedContent( argumentCollection = args );
}
@@ -355,14 +378,14 @@ component extends="baseHandler" {
view = "content/contentViewlet",
module = "contentbox-admin",
args = {
- viewletID : createUUID(),
- aContent : aContent,
- showHits : arguments.showHits,
- colorCodings : arguments.colorCodings,
- showPublishedStatus : arguments.showPublishedStatus,
- showAuthor : arguments.showAuthor
+ viewletID : createUUID(),
+ aContent : aContent,
+ showHits : arguments.showHits,
+ colorCodings : arguments.colorCodings,
+ showPublishedStatus: arguments.showPublishedStatus,
+ showAuthor : arguments.showAuthor
}
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/contentStore.cfc b/modules/contentbox/modules/contentbox-admin/handlers/contentStore.cfc
index a1a7e5a5a1..aa5de36599 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/contentStore.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/contentStore.cfc
@@ -6,24 +6,28 @@
* Manage content store
*/
component extends="baseContentHandler" {
-
// Dependencies
property name="ormService" inject="contentStoreService@contentbox";
-
// Properties
- variables.handler = "contentStore";
+ variables.handler = "contentStore";
variables.defaultOrdering = "order asc, createdDate desc";
- variables.entry = "ContentStore";
- variables.entityPlural = "content";
- variables.securityPrefix = "CONTENTSTORE";
+ variables.entry = "ContentStore";
+ variables.entityPlural = "content";
+ variables.securityPrefix = "CONTENTSTORE";
/**
* Pre Handler interceptions
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
super.preHandler( argumentCollection = arguments );
// exit Handlers
- prc.xehContentStore = "#prc.cbAdminEntryPoint#.contentStore.index";
+ prc.xehContentStore = "#prc.cbAdminEntryPoint#.contentStore.index";
prc.xehContentEditor = "#prc.cbAdminEntryPoint#.contentStore.editor";
prc.xehContentRemove = "#prc.cbAdminEntryPoint#.contentStore.remove";
}
@@ -31,14 +35,14 @@ component extends="baseContentHandler" {
/**
* Show Content
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit handlers
- prc.xehContentSearch = "#prc.cbAdminEntryPoint#.contentStore.index";
- prc.xehContentTable = "#prc.cbAdminEntryPoint#.contentStore.contentTable";
+ prc.xehContentSearch = "#prc.cbAdminEntryPoint#.contentStore.index";
+ prc.xehContentTable = "#prc.cbAdminEntryPoint#.contentStore.contentTable";
prc.xehContentBulkStatus = "#prc.cbAdminEntryPoint#.contentStore.bulkstatus";
- prc.xehContentExportAll = "#prc.cbAdminEntryPoint#.contentStore.exportAll";
- prc.xehContentImport = "#prc.cbAdminEntryPoint#.contentStore.importAll";
- prc.xehContentClone = "#prc.cbAdminEntryPoint#.contentStore.clone";
+ prc.xehContentExportAll = "#prc.cbAdminEntryPoint#.contentStore.exportAll";
+ prc.xehContentImport = "#prc.cbAdminEntryPoint#.contentStore.importAll";
+ prc.xehContentClone = "#prc.cbAdminEntryPoint#.contentStore.clone";
// Light up
prc.tabContent_contentStore = true;
@@ -50,13 +54,13 @@ component extends="baseContentHandler" {
/**
* Content table brought via ajax
*/
- function contentTable( event, rc, prc ){
+ function contentTable( event, rc, prc ) {
// exit handlers
- prc.xehContentSearch = "#prc.cbAdminEntryPoint#.contentStore.index";
+ prc.xehContentSearch = "#prc.cbAdminEntryPoint#.contentStore.index";
prc.xehContentHistory = "#prc.cbAdminEntryPoint#.versions.index";
- prc.xehContentExport = "#prc.cbAdminEntryPoint#.contentStore.export";
- prc.xehContentClone = "#prc.cbAdminEntryPoint#.contentStore.clone";
- prc.xehContentOrder = "#prc.cbAdminEntryPoint#.contentStore.changeOrder";
+ prc.xehContentExport = "#prc.cbAdminEntryPoint#.contentStore.export";
+ prc.xehContentClone = "#prc.cbAdminEntryPoint#.contentStore.clone";
+ prc.xehContentOrder = "#prc.cbAdminEntryPoint#.contentStore.changeOrder";
// Super size it
super.contentTable( argumentCollection = arguments );
}
@@ -64,7 +68,7 @@ component extends="baseContentHandler" {
/**
* Change the status of many content objects
*/
- function bulkStatus( event, rc, prc ){
+ function bulkStatus( event, rc, prc ) {
arguments.relocateTo = prc.xehContentStore;
super.bulkStatus( argumentCollection = arguments );
}
@@ -72,7 +76,7 @@ component extends="baseContentHandler" {
/**
* Show the editor
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// Super size it
super.editor( argumentCollection = arguments );
}
@@ -80,16 +84,16 @@ component extends="baseContentHandler" {
/**
* Save a new content store item
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
arguments.adminPermission = "CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR";
- arguments.relocateTo = prc.xehContentStore;
+ arguments.relocateTo = prc.xehContentStore;
super.save( argumentCollection = arguments );
}
/**
* Clone a content store item
*/
- function clone( event, rc, prc ){
+ function clone( event, rc, prc ) {
arguments.relocateTo = prc.xehContentStore;
super.clone( argumentCollection = arguments );
}
@@ -97,7 +101,7 @@ component extends="baseContentHandler" {
/**
* Remove a content store item
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
arguments.relocateTo = prc.xehContentStore;
super.remove( argumentCollection = arguments );
}
@@ -105,7 +109,7 @@ component extends="baseContentHandler" {
/**
* Editor selector for contentstore UI
*/
- function editorSelector( event, rc, prc ){
+ function editorSelector( event, rc, prc ) {
// Sorting
arguments.sortOrder = "createdDate asc";
// Supersize me
@@ -115,9 +119,9 @@ component extends="baseContentHandler" {
/**
* Import content store items
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
arguments.relocateTo = prc.xehContentStore;
super.importAll( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/contentTemplates.cfc b/modules/contentbox/modules/contentbox-admin/handlers/contentTemplates.cfc
index 8b1a02247a..ad100534c9 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/contentTemplates.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/contentTemplates.cfc
@@ -1,21 +1,30 @@
component extends="baseHandler" {
-
property name="templateService" inject="ContentTemplateService@contentbox";
+
property name="categoryService" inject="CategoryService@contentbox";
- function preHandler( event, rc, prc ){
- prc.jwtTokens = getInstance( "JWTService@cbsecurity" ).fromUser( prc.oCurrentAuthor );
- prc.xehExport = "#prc.cbAdminEntryPoint#.contentTemplates.export";
+ function preHandler( event, rc, prc ) {
+ prc.jwtTokens = getInstance( "JWTService@cbsecurity" ).fromUser( prc.oCurrentAuthor );
+ prc.xehExport = "#prc.cbAdminEntryPoint#.contentTemplates.export";
prc.xehExportAll = "#prc.cbAdminEntryPoint#.contentTemplates.exportAll";
prc.xehImportAll = "#prc.cbAdminEntryPoint#.contentTemplates.importAll";
- prc.themeRecord = getInstance( "ThemeService@contentbox" ).getActiveTheme();
- prc.globalData = {
- "templateSchema" : templateService.new().getSchema(),
- "availableLayouts" : listToArray( reReplaceNoCase( prc.themeRecord.layouts, "blog,?", "" ) ),
- "availableCategories" : variables.categoryService
+ prc.themeRecord = getInstance( "ThemeService@contentbox" ).getActiveTheme();
+ prc.globalData = {
+ "templateSchema" : templateService.new().getSchema(),
+ "availableLayouts": listToArray(
+ reReplaceNoCase(
+ prc.themeRecord.layouts,
+ "blog,?",
+ ""
+ )
+ ),
+ "availableCategories": variables
+ .categoryService
.newCriteria()
.isEq( "site", prc.oCurrentSite )
- .withProjections( property = "categoryID:id,category:label,slug:value,isPublic" )
+ .withProjections(
+ property = "categoryID:id,category:label,slug:value,isPublic"
+ )
.asStruct()
.list()
};
@@ -24,91 +33,93 @@ component extends="baseHandler" {
/**
* Main Content Templates Admin View
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
event.setView( "contentTemplates/index" );
}
/**
* Exports a single Template
*/
- function export( event, rc, prc ){
+ function export( event, rc, prc ) {
event.setHTTPHeader(
- name = "content-disposition",
- value = "attachment; filename=#urlEncodedFormat( "template-export-" & rc.templateId & ".json" )#"
- );
+ name = "content-disposition",
+ value = "attachment; filename=#urlEncodedFormat( "template-export-" & rc.templateId & ".json" )#"
+ );
return templateService.get( rc.templateID ).getMemento( profile = "export" );
}
/**
* Exports multiple selected templates
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
event.setHTTPHeader(
- name = "content-disposition",
- value = "attachment; filename=#urlEncodedFormat( "template-export.json" )#"
- );
+ name = "content-disposition",
+ value = "attachment; filename=#urlEncodedFormat( "template-export.json" )#"
+ );
return templateService
.newCriteria()
.isIn( "templateID", listToArray( rc.templateID ) )
.list()
- .map( function( template ){
- return template.getMemento( profile = "export" )
- } );
+ .map(
+ function( template ) {
+ return template.getMemento( profile = "export" );
+ }
+ );
}
/**
* Imports a JSON file containing multiple Templates
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
event.paramValue( "importFile", "" );
event.paramValue( "overrideContent", false );
var validationManager = getInstance( "ValidationManager@cbvalidation" );
try {
- if ( len( rc.importFile ) and fileExists( rc.importFile ) ) {
- var templates = deserializeJSON( fileRead( rc.importFile ) ).map( function( template ){
- param template.creator = prc.oCurrentAuthor;
- param template.site = prc.oCurrentSite;
- // Population arguments
- if ( rc.overrideContent ) {
- var templateEntity = templateService
- .newCriteria()
- .isEq( "site", prc.oCurrentSite )
- .isEq( "name", template.name )
- .get();
- if ( isNull( templateEntity ) ) {
- structDelete( template, "templateID" );
- templateEntity = templatService.new();
- } else {
- }
- } else {
- structDelete( template, "templateID" );
- var templateEntity = templateService.new();
- }
- var populateArgs = { "memento" : template, "model" : templateEntity };
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var templates = deserializeJSON( fileRead( rc.importFile ) ).map(
+ function( template ) {
+ param template.creator = prc.oCurrentAuthor;
+ param template.site = prc.oCurrentSite;
+ if ( rc.overrideContent ) {
+ var templateEntity = templateService
+ .newCriteria()
+ .isEq( "site", prc.oCurrentSite )
+ .isEq( "name", template.name )
+ .get();
+ if ( isNull( templateEntity ) ) {
+ structDelete( template, "templateID" );
+ templateEntity = templatService.new();
+ } else {
- // Populate it
- populateModel( argumentCollection = populateArgs );
+ }
+ } else {
+ structDelete( template, "templateID" );
+ var templateEntity = templateService.new();
+ }
+ var populateArgs = { "memento": template, "model": templateEntity };
- // Validate it
- validationManager.validateOrFail( target = templateEntity );
+ populateModel( argumentCollection = populateArgs );
- return templateEntity;
- } );
+ validationManager.validateOrFail( target = templateEntity );
+
+ return templateEntity;
+ }
+ );
templateService.saveAll( templates );
cbMessagebox.info( "Content Templates imported sucessfully!" );
cbMessagebox.info(
- "Templates #templates
- .map( function( t ){
- return t.getName();
- } )
- .toList()# are now associated to site #prc.oCurrentSite.getName()#"
- );
+ "Templates #templates.map( function( t ) {
+ return t.getName();
+ } ).toList()# are now associated to site #prc.oCurrentSite.getName()#"
+ );
} 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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessagebox.error( errorMessage );
@@ -116,4 +127,4 @@ component extends="baseHandler" {
relocate( "#prc.cbAdminEntryPoint#.contentTemplates.index" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc b/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc
index 7a5d2e67c2..8931c39096 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/dashboard.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,15 +6,21 @@
* Admin Dashboard
*/
component extends="baseHandler" {
-
// Dependencies
property name="entryService" inject="entryService@contentbox";
+
property name="pageService" inject="pageService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
+
property name="commentService" inject="commentService@contentbox";
+
property name="categoryService" inject="categoryService@contentbox";
+
property name="feedReader" inject="FeedReader@cbfeeds";
+
property name="loginTrackerService" inject="loginTrackerService@contentbox";
+
property name="markdown" inject="Processor@cbmarkdown";
/**
@@ -22,25 +28,25 @@ component extends="baseHandler" {
*
* @return html
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
- prc.xehDeleteInstaller = "#prc.cbAdminEntryPoint#.dashboard.deleteInstaller";
+ prc.xehDeleteInstaller = "#prc.cbAdminEntryPoint#.dashboard.deleteInstaller";
// Ajax Loaded handlers
prc.xehLatestSystemEdits = "#prc.cbAdminEntryPoint#.dashboard.latestSystemEdits";
- prc.xehLatestUserDrafts = "#prc.cbAdminEntryPoint#.dashboard.latestUserDrafts";
- prc.xehPublishedContent = "#prc.cbAdminEntryPoint#.dashboard.futurePublishedContent";
- prc.xehExpiredContent = "#prc.cbAdminEntryPoint#.dashboard.expiredContent";
- prc.xehLatestComments = "#prc.cbAdminEntryPoint#.dashboard.latestComments";
- prc.xehLatestNews = "#prc.cbAdminEntryPoint#.dashboard.latestNews";
- prc.xehLatestSnapshot = "#prc.cbAdminEntryPoint#.dashboard.latestSnapshot";
- prc.xehLatestLogins = "#prc.cbAdminEntryPoint#.dashboard.latestLogins";
+ prc.xehLatestUserDrafts = "#prc.cbAdminEntryPoint#.dashboard.latestUserDrafts";
+ prc.xehPublishedContent = "#prc.cbAdminEntryPoint#.dashboard.futurePublishedContent";
+ prc.xehExpiredContent = "#prc.cbAdminEntryPoint#.dashboard.expiredContent";
+ prc.xehLatestComments = "#prc.cbAdminEntryPoint#.dashboard.latestComments";
+ prc.xehLatestNews = "#prc.cbAdminEntryPoint#.dashboard.latestNews";
+ prc.xehLatestSnapshot = "#prc.cbAdminEntryPoint#.dashboard.latestSnapshot";
+ prc.xehLatestLogins = "#prc.cbAdminEntryPoint#.dashboard.latestLogins";
// Installer Check
prc.installerCheck = variables.settingService.isInstallationPresent();
// Welcome Body
- prc.welcomeBody = variables.markdown.toHTML( prc.cbSettings.cb_dashboard_welcome_body );
+ prc.welcomeBody = variables.markdown.toHTML( prc.cbSettings.cb_dashboard_welcome_body );
// Light up
- prc.tabDashboard = true;
+ prc.tabDashboard = true;
// announce event
announce( "cbadmin_onDashboard" );
// dashboard view
@@ -52,53 +58,46 @@ component extends="baseHandler" {
*
* @return html
*/
- function latestSnapshot( event, rc, prc ){
- var siteID = prc.oCurrentSite.getsiteID();
+ function latestSnapshot( event, rc, prc ) {
+ var siteID = prc.oCurrentSite.getsiteID()
- prc.entriesCount = variables.entryService.getTotalContentCount( siteID );
- prc.pagesCount = variables.pageService.getTotalContentCount( siteID );
- prc.commentsCount = variables.commentService.getTotalCount( siteID );
- prc.commentsApprovedCount = variables.commentService.getApprovedCount( siteID );
- prc.commentsUnApprovedCount = variables.commentService.getUnApprovedCount( siteID );
- prc.categoriesCount = variables.categoryService.getTotalCategoryCount( siteID );
+ prc.entriesCount = variables.entryService.getTotalContentCount( siteID )
+ prc.pagesCount = variables.pageService.getTotalContentCount( siteID )
+ prc.commentsCount = variables.commentService.getTotalCount( siteID )
+ prc.commentsApprovedCount = variables.commentService.getApprovedCount( siteID )
+ prc.commentsUnApprovedCount = variables.commentService.getUnApprovedCount( siteID )
+ prc.categoriesCount = variables.categoryService.getTotalCategoryCount( siteID )
// Few Reports
- prc.topContent = variables.contentService.getTopVisitedContent( max: 5, siteID: siteID );
- prc.topCommented = variables.contentService.getTopCommentedContent( max: 5, siteID: siteID );
+ prc.topContent = variables.contentService.getTopVisitedContent( max = 5, siteID = siteID )
+ prc.topCommented = variables.contentService.getTopCommentedContent( max = 5, siteID = siteID )
// convert report to chart data
- prc.aTopContent = [];
- prc.aTopContentTotalHits = 0;
+ prc.aTopContent = []
+ prc.aTopContentTotalHits = 0
for ( var thisContent in prc.topContent ) {
- arrayAppend(
- prc.aTopContent,
- {
- "label" : thisContent.getTitle(),
- "value" : thisContent.getNumberOfHits()
- }
- );
- prc.aTopContentTotalHits += thisContent.getNumberOfHits();
+ prc.aTopContentTotalHits += thisContent.hits
}
- prc.aTopContent = serializeJSON( prc.aTopContent );
+ prc.aTopContent = serializeJSON( prc.aTopContent )
- prc.aTopCommented = [];
- prc.aTopCommentedTotalHits = 0;
+ prc.aTopCommented = []
+ prc.aTopCommentedTotalHits = 0
for ( var thisContent in prc.topCommented ) {
arrayAppend(
prc.aTopCommented,
{
- "label" : thisContent.getTitle(),
- "value" : thisContent.getNumberOfComments()
+ "label": thisContent.getTitle(),
+ "value": thisContent.getNumberOfComments()
}
- );
- prc.aTopCommentedTotalHits += thisContent.getNumberOfComments();
+ )
+ prc.aTopCommentedTotalHits += thisContent.getNumberOfComments()
}
- prc.aTopCommented = serializeJSON( prc.aTopCommented );
+ prc.aTopCommented = serializeJSON( prc.aTopCommented )
// render view out.
- event.setView( view = "dashboard/latestSnapshot", layout = "ajax" );
+ event.setView( view = "dashboard/latestSnapshot", layout = "ajax" )
}
/**
@@ -106,18 +105,18 @@ component extends="baseHandler" {
*
* @return html
*/
- function latestUserDrafts( event, rc, prc ){
+ function latestUserDrafts( event, rc, prc ) {
// Latest Edits
prc.latestDraftsViewlet = runEvent(
event = "contentbox-admin:content.latestContentEdits",
eventArguments = {
- max : 10,
- author : prc.oCurrentAuthor,
- isPublished : false,
- showHits : false,
- colorCodings : false,
- showPublishedStatus : false,
- showAuthor : false
+ max : 10,
+ author : prc.oCurrentAuthor,
+ isPublished : false,
+ showHits : false,
+ colorCodings : false,
+ showPublishedStatus: false,
+ showAuthor : false
}
);
event.setView( view = "dashboard/latestUserDrafts", layout = "ajax" );
@@ -128,11 +127,11 @@ component extends="baseHandler" {
*
* @return html
*/
- function latestSystemEdits( event, rc, prc ){
+ function latestSystemEdits( event, rc, prc ) {
// Latest Edits
prc.latestEditsViewlet = runEvent(
event = "contentbox-admin:content.latestContentEdits",
- eventArguments = { max : 10, showHits : true }
+ eventArguments = { max: 10, showHits: true }
);
event.setView( view = "dashboard/latestSystemEdits", layout = "ajax" );
}
@@ -142,13 +141,16 @@ component extends="baseHandler" {
*
* @return html
*/
- function futurePublishedContent( event, rc, prc ){
+ function futurePublishedContent( event, rc, prc ) {
// Latest Edits
prc.futurePublishedContent = runEvent(
event = "contentbox-admin:content.contentByPublishedStatus",
- eventArguments = { max : 10, showHits : false, colorCodings : false }
+ eventArguments = { max: 10, showHits: false, colorCodings: false }
);
- event.setView( view = "dashboard/futurePublishedContent", layout = "ajax" );
+ event.setView(
+ view = "dashboard/futurePublishedContent",
+ layout = "ajax"
+ );
}
/**
@@ -156,15 +158,15 @@ component extends="baseHandler" {
*
* @return html
*/
- function expiredContent( event, rc, prc ){
+ function expiredContent( event, rc, prc ) {
// Latest Edits
prc.expiredContent = runEvent(
event = "contentbox-admin:content.contentByPublishedStatus",
eventArguments = {
- max : 10,
- showHits : true,
- showExpired : true,
- colorCodings : false
+ max : 10,
+ showHits : true,
+ showExpired : true,
+ colorCodings: false
}
);
event.setView( view = "dashboard/expiredContent", layout = "ajax" );
@@ -175,13 +177,16 @@ component extends="baseHandler" {
*
* @return html
*/
- function latestComments( event, rc, prc ){
+ function latestComments( event, rc, prc ) {
// Get Comments viewlet
var eArgs = {
- max : prc.cbSettings.cb_dashboard_recentComments,
- pagination : false
+ 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" );
}
@@ -190,20 +195,20 @@ component extends="baseHandler" {
*
* @return html
*/
- function latestNews( event, rc, prc ){
+ function latestNews( event, rc, prc ) {
// Get latest ContentBox news
try {
if ( len( prc.cbsettings.cb_dashboard_newsfeed ) ) {
prc.latestNews = feedReader.readFeed(
- feedURL = prc.cbsettings.cb_dashboard_newsfeed,
- itemsType = "query",
- maxItems = prc.cbsettings.cb_dashboard_newsfeed_count
- );
+ feedURL = prc.cbsettings.cb_dashboard_newsfeed,
+ itemsType = "query",
+ maxItems = prc.cbsettings.cb_dashboard_newsfeed_count
+ );
} else {
- prc.latestNews = { items : queryNew( "" ) };
+ prc.latestNews = { items: queryNew( "" ) };
}
- } catch ( Any e ) {
- prc.latestNews = { items : queryNew( "" ) };
+ } catch (Any e) {
+ prc.latestNews = { items: queryNew( "" ) };
log.error( "Error retrieving news feed: #e.message# #e.detail#", e );
}
@@ -215,7 +220,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function latestLogins( event, rc, prc ){
+ function latestLogins( event, rc, prc ) {
prc.lastLogins = loginTrackerService.getLastLogins( max = prc.cbsettings.cb_security_blocktime );
event.setView( view = "dashboard/latestLogins", layout = "ajax" );
}
@@ -227,14 +232,14 @@ component extends="baseHandler" {
*
* @return JSON
*/
- function deleteInstaller(){
- var results = { "ERROR" : false, "MESSAGE" : "" };
+ function deleteInstaller() {
+ var results = { "ERROR": false, "MESSAGE": "" };
try {
variables.settingService.deleteInstaller();
results[ "MESSAGE" ] = "The installer module has been successfully deleted.";
- } catch ( Any e ) {
- results[ "ERROR" ] = true;
+ } catch (Any e) {
+ results[ "ERROR" ] = true;
results[ "MESSAGE" ] = "Error removing installer: #e.message#";
}
@@ -246,7 +251,7 @@ component extends="baseHandler" {
*
* @return relocation if synchronous, json if ajax
*/
- function reload( event, rc, prc ){
+ function reload( event, rc, prc ) {
try {
switch ( rc.targetModule ) {
// reload application
@@ -280,29 +285,34 @@ component extends="baseHandler" {
// Ajax requests
if ( event.isAjax() ) {
- event.renderData( type = "json", data = { error : false, executed : true } );
+ event.renderData( type = "json", data = { error: false, executed: true } );
} else {
// relocate back to dashboard
relocate( prc.xehDashboard );
}
- } catch ( Any e ) {
+ } catch (Any e) {
// Log Exception
- log.error( "Error running admin reload module action: #e.message# #e.detail#", e );
+ log.error(
+ "Error running admin reload module action: #e.message# #e.detail#",
+ e
+ );
// Ajax requests
if ( event.isAjax() ) {
var data = {
- error : true,
- executed : false,
- messages : e.message & e.detail
+ error : true,
+ executed: false,
+ messages: e.message & e.detail
};
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 );
}
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/emailTemplates.cfc b/modules/contentbox/modules/contentbox-admin/handlers/emailTemplates.cfc
index 558fff7011..592f1f8b91 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/emailTemplates.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/emailTemplates.cfc
@@ -6,17 +6,16 @@
* Manage ContentBox users
*/
component extends="baseHandler" {
-
// DI
property name="mailService" inject="mailService@cbmailservices";
/**
* tester
*/
- function tester( event, rc, prc ){
+ function tester( event, rc, prc ) {
event.paramValue( "template", "" );
- var bindingArgs = { "gravatarEmail" : "info@ortussolutions.com" };
+ var bindingArgs = { "gravatarEmail": "info@ortussolutions.com" };
return layout(
view = "/contentbox/email_templates/#encodeForHTML( rc.template )#",
@@ -25,4 +24,4 @@ component extends="baseHandler" {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/entries.cfc b/modules/contentbox/modules/contentbox-admin/handlers/entries.cfc
index a6a293df0f..80309cfd9a 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/entries.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/entries.cfc
@@ -6,31 +6,35 @@
* Manage blog entries
*/
component extends="baseContentHandler" {
-
// Dependencies
property name="ormService" inject="entryService@contentbox";
-
// Properties
- variables.handler = "entries";
+ variables.handler = "entries";
variables.defaultOrdering = "createdDate desc";
- variables.entity = "Entry";
- variables.entityPlural = "entries";
- variables.securityPrefix = "ENTRIES";
+ variables.entity = "Entry";
+ variables.entityPlural = "entries";
+ variables.securityPrefix = "ENTRIES";
/**
* Pre Handler interceptions
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
super.preHandler( argumentCollection = arguments );
// exit Handlers
- prc.xehEntries = "#prc.cbAdminEntryPoint#.entries.index";
+ prc.xehEntries = "#prc.cbAdminEntryPoint#.entries.index";
prc.xehEntryEditor = "#prc.cbAdminEntryPoint#.entries.editor";
prc.xehEntryRemove = "#prc.cbAdminEntryPoint#.entries.remove";
// Verify if blog is disabled?
if ( !prc.oCurrentSite.getIsBlogEnabled() ) {
cbMessageBox().warn(
- "The blog has been currently disabled. You can activate it again in your ContentBox settings panel"
- );
+ "The blog has been currently disabled. You can activate it again in your ContentBox settings panel"
+ );
relocate( prc.xehDashboard );
}
}
@@ -38,14 +42,14 @@ component extends="baseContentHandler" {
/**
* Show Content
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit handlers
- prc.xehEntrySearch = "#prc.cbAdminEntryPoint#.entries.index";
- prc.xehEntryTable = "#prc.cbAdminEntryPoint#.entries.contentTable";
+ prc.xehEntrySearch = "#prc.cbAdminEntryPoint#.entries.index";
+ prc.xehEntryTable = "#prc.cbAdminEntryPoint#.entries.contentTable";
prc.xehEntryBulkStatus = "#prc.cbAdminEntryPoint#.entries.bulkstatus";
- prc.xehEntryExportAll = "#prc.cbAdminEntryPoint#.entries.exportAll";
- prc.xehEntryImport = "#prc.cbAdminEntryPoint#.entries.importAll";
- prc.xehEntryClone = "#prc.cbAdminEntryPoint#.entries.clone";
+ prc.xehEntryExportAll = "#prc.cbAdminEntryPoint#.entries.exportAll";
+ prc.xehEntryImport = "#prc.cbAdminEntryPoint#.entries.importAll";
+ prc.xehEntryClone = "#prc.cbAdminEntryPoint#.entries.clone";
// Light up
prc.tabContent_blog = true;
@@ -57,12 +61,12 @@ component extends="baseContentHandler" {
/**
* Content table brought via ajax
*/
- function contentTable( event, rc, prc ){
+ function contentTable( event, rc, prc ) {
// exit handlers
- prc.xehEntrySearch = "#prc.cbAdminEntryPoint#.entries.index";
+ prc.xehEntrySearch = "#prc.cbAdminEntryPoint#.entries.index";
prc.xehEntryQuickLook = "#prc.cbAdminEntryPoint#.entries.quickLook";
- prc.xehEntryExport = "#prc.cbAdminEntryPoint#.entries.export";
- prc.xehEntryClone = "#prc.cbAdminEntryPoint#.entries.clone";
+ prc.xehEntryExport = "#prc.cbAdminEntryPoint#.entries.export";
+ prc.xehEntryClone = "#prc.cbAdminEntryPoint#.entries.clone";
// Super size it
super.contentTable( argumentCollection = arguments );
}
@@ -70,7 +74,7 @@ component extends="baseContentHandler" {
/**
* Change the status of many content objects
*/
- function bulkStatus( event, rc, prc ){
+ function bulkStatus( event, rc, prc ) {
arguments.relocateTo = prc.xehEntries;
super.bulkStatus( argumentCollection = arguments );
}
@@ -78,7 +82,7 @@ component extends="baseContentHandler" {
/**
* Show the editor
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// Super size it
super.editor( argumentCollection = arguments );
}
@@ -86,16 +90,16 @@ component extends="baseContentHandler" {
/**
* Save an entry
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
arguments.adminPermission = "ENTRIES_ADMIN,ENTRIES_EDITOR";
- arguments.relocateTo = prc.xehEntries;
+ arguments.relocateTo = prc.xehEntries;
super.save( argumentCollection = arguments );
}
/**
* Clone an entry
*/
- function clone( event, rc, prc ){
+ function clone( event, rc, prc ) {
arguments.relocateTo = prc.xehEntries;
super.clone( argumentCollection = arguments );
}
@@ -103,7 +107,7 @@ component extends="baseContentHandler" {
/**
* Remove an entry
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
arguments.relocateTo = prc.xehEntries;
super.remove( argumentCollection = arguments );
}
@@ -111,7 +115,7 @@ component extends="baseContentHandler" {
/**
* Editor selector for entries UI
*/
- function editorSelector( event, rc, prc ){
+ function editorSelector( event, rc, prc ) {
// Sorting
arguments.sortOrder = "publishedDate asc";
// Supersize me
@@ -121,9 +125,9 @@ component extends="baseContentHandler" {
/**
* Import entries
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
arguments.relocateTo = prc.xehEntries;
super.importAll( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/globalHTML.cfc b/modules/contentbox/modules/contentbox-admin/handlers/globalHTML.cfc
index 44407b5961..98f5e8a66c 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/globalHTML.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/globalHTML.cfc
@@ -6,15 +6,15 @@
* Manage global HTML in the system
*/
component extends="baseHandler" {
-
// Dependencies
property name="settingsService" inject="settingService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
/**
* View HTML
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Exit Handler
prc.xehSaveHTML = "#prc.cbAdminEntryPoint#.globalHTML.save";
@@ -28,16 +28,21 @@ component extends="baseHandler" {
/**
* Save HTML
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// announce event
- announce( "cbadmin_preGlobalHTMLSave", { oldSettings : prc.cbSettings, newSettings : rc } );
+ announce(
+ "cbadmin_preGlobalHTMLSave",
+ { oldSettings: prc.cbSettings, newSettings: rc }
+ );
// bulk save the options
settingsService.bulkSave(
- rc.filter( function( item ){
- return item.findNoCase( "cb_html" );
- } ),
- prc.oCurrentSite
- );
+ rc.filter(
+ function( item ) {
+ return item.findNoCase( "cb_html" );
+ }
+ ),
+ prc.oCurrentSite
+ );
// clear caches
contentService.clearAllCaches( async = false );
settingsService.flushSettingsCache();
@@ -49,4 +54,4 @@ component extends="baseHandler" {
relocate( prc.xehGlobalHTML );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/mediamanager.cfc b/modules/contentbox/modules/contentbox-admin/handlers/mediamanager.cfc
index 4a11c10172..611b80cfe5 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/mediamanager.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/mediamanager.cfc
@@ -10,7 +10,13 @@ component extends="baseHandler" {
/**
* Pre handler
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// widget runnable event
prc.xehFileBrowser = "contentbox-filebrowser:home.index";
}
@@ -18,14 +24,14 @@ component extends="baseHandler" {
/**
* Display media manager
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// get settings according to contentbox
- prc.cbFileBrowserSettings = variables.settingService.buildFileBrowserSettings();
+ prc.cbFileBrowserSettings = variables.settingService.buildFileBrowserSettings();
// this is the default, so ignore
prc.cbFileBrowserSettings.title = "Content Library";
// build argument list for widget
- prc.fbArgs = { widget : true, settings : prc.cbFileBrowserSettings };
+ prc.fbArgs = { widget: true, settings: prc.cbFileBrowserSettings };
// Light up
prc.tabContent_mediaManager = true;
@@ -34,4 +40,4 @@ component extends="baseHandler" {
event.setView( "mediamanager/index" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc b/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc
index a065509995..c35444e8a8 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/menus.cfc
@@ -6,41 +6,47 @@
* Manage custom site menus
*/
component extends="baseHandler" {
-
// Dependencies
property name="menuService" inject="menuService@contentbox";
+
property name="menuItemService" inject="menuItemService@contentbox";
- property name="HTMLHelper" inject="HTMLHelper@coldbox";
+ property name="HTMLHelper" inject="HTMLHelper@coldbox";
// Public properties
this.preHandler_except = "pager";
// pre handler
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// exit Handlers
- prc.xehMenus = "#prc.cbAdminEntryPoint#.menus";
+ prc.xehMenus = "#prc.cbAdminEntryPoint#.menus";
prc.xehMenuEditor = "#prc.cbAdminEntryPoint#.menus.editor";
prc.xehMenuRemove = "#prc.cbAdminEntryPoint#.menus.remove";
- prc.tabContent = true;
+ prc.tabContent = true;
}
/**
* Menu Manager index
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
- prc.xehMenuSave = "#prc.cbAdminEntryPoint#.menus.save";
+ prc.xehMenuSave = "#prc.cbAdminEntryPoint#.menus.save";
prc.xehMenuExportAll = "#prc.cbAdminEntryPoint#.menus.exportAll";
- prc.xehMenuImport = "#prc.cbAdminEntryPoint#.menus.importAll";
- prc.xehMenuEditor = "#prc.cbAdminEntryPoint#.menus.editor";
- prc.xehMenuSearch = "#prc.cbAdminEntryPoint#.menus";
- prc.xehMenuTable = "#prc.cbAdminEntryPoint#.menus.menuTable";
+ prc.xehMenuImport = "#prc.cbAdminEntryPoint#.menus.importAll";
+ prc.xehMenuEditor = "#prc.cbAdminEntryPoint#.menus.editor";
+ prc.xehMenuSearch = "#prc.cbAdminEntryPoint#.menus";
+ prc.xehMenuTable = "#prc.cbAdminEntryPoint#.menus.menuTable";
// Get all menus
- prc.menus = variables.menuService.list(
- criteria : { "site" : prc.oCurrentSite },
- sortOrder: "title",
- asQuery : false
- );
+ prc.menus = variables.menuService.list(
+ criteria = { "site": prc.oCurrentSite },
+ sortOrder = "title",
+ asQuery = false
+ );
// Light up
prc.tabContent_menu = true;
@@ -51,16 +57,19 @@ component extends="baseHandler" {
/**
* custom filebrowser "widget" for media item selections
*/
- function filebrowser( event, rc, prc ){
+ function filebrowser( event, rc, prc ) {
// callback
- rc.callback = "opener.fbMenuItemSelect";
+ rc.callback = "opener.fbMenuItemSelect";
// get settings according to contentbox
- prc.cbSetting = settingService.buildFileBrowserSettings();
+ prc.cbSetting = settingService.buildFileBrowserSettings();
// load jquery as it is standalone
prc.cbSetting.loadJQuery = true;
- var args = { widget : true, settings : prc.cbSetting };
- return runEvent( event = "contentbox-filebrowser:home.index", eventArguments = args );
+ var args = { widget: true, settings: prc.cbSetting };
+ return runEvent(
+ event = "contentbox-filebrowser:home.index",
+ eventArguments = args
+ );
}
/**
@@ -68,8 +77,11 @@ component extends="baseHandler" {
*
* @return plain
*/
- function slugify( event, rc, prc ){
- event.renderData( data = trim( variables.HTMLHelper.slugify( rc.slug ) ), type = "plain" );
+ function slugify( event, rc, prc ) {
+ event.renderData(
+ data = trim( variables.HTMLHelper.slugify( rc.slug ) ),
+ type = "plain"
+ );
}
/**
@@ -77,11 +89,11 @@ component extends="baseHandler" {
*
* @return json
*/
- function slugUnique( event, rc, prc ){
+ function slugUnique( event, rc, prc ) {
// Params
event.paramValue( "slug", "" ).paramValue( "menuID", "" );
// set default data result
- var data = { "UNIQUE" : false };
+ 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 ) );
@@ -93,29 +105,29 @@ component extends="baseHandler" {
/**
* Show Editor
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
event.paramValue( "menuID", 0 );
// get new or persisted
prc.menuItems = "";
- prc.menu = variables.menuService.get( rc.menuID );
+ prc.menu = variables.menuService.get( rc.menuID );
if ( prc.menu.isLoaded() ) {
prc.menuItems = variables.menuService.buildEditableMenu( prc.menu.getMenuItems() );
}
// exit handlers
- prc.xehMenuSave = "#prc.cbAdminEntryPoint#.menus.save";
- prc.xehMenuEditor = "#prc.cbAdminEntryPoint#.menus.editor";
+ prc.xehMenuSave = "#prc.cbAdminEntryPoint#.menus.save";
+ prc.xehMenuEditor = "#prc.cbAdminEntryPoint#.menus.editor";
prc.xehMenuPreview = "#prc.cbAdminEntryPoint#.menus.preview";
- prc.xehMenuItem = "#prc.cbAdminEntryPoint#.menus.createMenuItem";
- prc.xehSlugify = "#prc.cbAdminEntryPoint#.menus.slugify";
- prc.xehSlugCheck = "#prc.cbAdminEntryPoint#.menus.slugUnique";
+ prc.xehMenuItem = "#prc.cbAdminEntryPoint#.menus.createMenuItem";
+ prc.xehSlugify = "#prc.cbAdminEntryPoint#.menus.slugify";
+ prc.xehSlugCheck = "#prc.cbAdminEntryPoint#.menus.slugUnique";
// get registered providers
prc.providers = menuItemService.getProviders();
// add assets
prc.cssAppendList = "";
- prc.jsAppendList = "";
+ prc.jsAppendList = "";
// view
event.setView( "menus/editor" );
@@ -126,12 +138,12 @@ component extends="baseHandler" {
*
* @return The rendered menu item
*/
- function createMenuItem( event, rc, prc ){
+ function createMenuItem( event, rc, prc ) {
prc.provider = menuItemService.getProvider( arguments.rc.type );
// get new or persisted
- var args = {
- menuItem : entityNew( prc.provider.getEntityName() ),
- provider : prc.provider
+ var args = {
+ menuItem: entityNew( prc.provider.getEntityName() ),
+ provider: prc.provider
};
// set new or persisted id in args
@@ -139,7 +151,10 @@ component extends="baseHandler" {
args.menuItemID = args.menuItem.getMenuItemID();
} else {
args.menuItemID = "new-#createUUID()#";
- args.menuItem.setMenu( variables.menuService.new().setSite( prc.oCurrentSite ) );
+ args.menuItem.setMenu( variables
+ .menuService
+ .new()
+ .setSite( prc.oCurrentSite ) );
}
savecontent variable="local.renderedMenuItem" {
@@ -148,10 +163,10 @@ component extends="baseHandler" {
class=""dd-item dd3-item""
data-id=""#encodeForHTMLAttribute( args.menuItemID )#""
:key=""#encodeForHTMLAttribute( args.menuItemID )#"">"
- )
- writeOutput( view( view: "menus/provider", args: args ) );
+ );
+ writeOutput( view( view = "menus/provider", args = args ) );
writeOutput( "" );
- };
+ }
event.renderData( data = renderedMenuItem, type = "text" );
}
@@ -161,17 +176,21 @@ component extends="baseHandler" {
*
* @return html
*/
- function menuTable( event, rc, prc ){
+ function menuTable( event, rc, prc ) {
// params
- event.paramValue( "searchMenu", "" ).paramValue( "isFiltering", false, true );
+ event.paramValue( "searchMenu", "" ).paramValue(
+ "isFiltering",
+ false,
+ true
+ );
// search content with filters and all
var results = variables.menuService.search(
- searchTerm = rc.searchMenu,
- sortOrder = "createdDate desc",
- siteID = prc.oCurrentSite.getSiteID()
- );
- prc.menus = results.menus;
+ searchTerm = rc.searchMenu,
+ sortOrder = "createdDate desc",
+ siteID = prc.oCurrentSite.getSiteID()
+ );
+ prc.menus = results.menus;
prc.menuCount = results.count;
// exit handlers
@@ -185,7 +204,7 @@ component extends="baseHandler" {
/**
* Save Menu
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
event
.paramValue( "slug", "" )
.paramValue( "title", "" )
@@ -195,17 +214,20 @@ component extends="baseHandler" {
if ( !len( rc.slug ) ) {
rc.slug = variables.HTMLHelper.slugify( rc.title );
}
- var oMenu = variables.menuService.get( rc.menuID );
+ var oMenu = variables.menuService.get( rc.menuID );
var originalSlug = oMenu.getSlug();
// populate and get menu
populate( model = oMenu, exclude = "menuID,menuItems" );
oMenu.populateMenuItems( deserializeJSON( rc.menuItems ) );
// announce event
- announce( "cbadmin_preMenuSave", { menu : oMenu, menuID : rc.menuID } );
+ announce( "cbadmin_preMenuSave", { menu: oMenu, menuID: rc.menuID } );
// save menu
variables.menuService.save( oMenu.setSite( prc.oCurrentSite ) );
// announce event
- announce( "cbadmin_postMenuSave", { menu : oMenu, originalSlug : originalSlug } );
+ announce(
+ "cbadmin_postMenuSave",
+ { menu: oMenu, originalSlug: originalSlug }
+ );
// messagebox
cbMessageBox().setMessage( "info", "Menu saved!" );
// relocate
@@ -218,7 +240,7 @@ component extends="baseHandler" {
*
* @return text
*/
- function preview( event, rc, prc ){
+ function preview( event, rc, prc ) {
event
.paramValue( "slug", "" )
.paramValue( "title", "" )
@@ -228,7 +250,7 @@ component extends="baseHandler" {
if ( !len( rc.slug ) ) {
rc.slug = variables.HTMLHelper.slugify( rc.title );
}
- var oMenu = menuService.new().setSite( prc.oCurrentSite );
+ var oMenu = menuService.new().setSite( prc.oCurrentSite );
var originalSlug = oMenu.getSlug();
// populate and get menu
populate( model = oMenu, exclude = "menuID,menuItems" );
@@ -241,7 +263,7 @@ component extends="baseHandler" {
/**
* Remove a menu
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// params
event.paramValue( "menuID", "" );
@@ -252,25 +274,28 @@ component extends="baseHandler" {
}
// Inflate to array
- rc.menuID = listToArray( rc.menuID );
+ rc.menuID = listToArray( rc.menuID );
var messages = [];
// Iterate and remove
for ( var thisMenuID in rc.menuID ) {
var oMenu = variables.menuService.get( thisMenuID );
if ( isNull( oMenu ) ) {
- arrayAppend( messages, "Invalid menuID sent: #thisMenuID#, so skipped removal" );
+ arrayAppend(
+ messages,
+ "Invalid menuID sent: #thisMenuID#, so skipped removal"
+ );
} else {
// GET id to be sent for announcing later
var menuID = oMenu.getMenuID();
- var title = oMenu.getSlug();
+ var title = oMenu.getSlug();
// announce event
- announce( "cbadmin_preMenuRemove", { menu : oMenu, menuID : menuID } );
+ announce( "cbadmin_preMenuRemove", { menu: oMenu, menuID: menuID } );
// Delete it
variables.menuService.delete( oMenu );
arrayAppend( messages, "Menu '#title#' removed" );
// announce event
- announce( "cbadmin_postMenuRemove", { menuID : menuID } );
+ announce( "cbadmin_postMenuRemove", { menuID: menuID } );
}
}
@@ -284,24 +309,33 @@ component extends="baseHandler" {
*
* @return json,xml
*/
- function export( event, rc, prc ){
- return variables.menuService.get( rc.menuID ).getMemento( profile: "export" );
+ function export( event, rc, prc ) {
+ return variables
+ .menuService
+ .get( rc.menuID )
+ .getMemento( profile = "export" );
}
/**
* Export Multiple menus
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
// Set a high timeout for long exports
setting requestTimeout="9999";
- param rc.menuID = "";
+ param rc.menuID = "";
// Export all or some
if ( len( rc.menuID ) ) {
- return rc.menuID
+ return rc
+ .menuID
.listToArray()
- .map( function( id ){
- return variables.menuService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .menuService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.menuService.getAllForExport( prc.oCurrentSite );
}
@@ -310,20 +344,20 @@ component extends="baseHandler" {
/**
* Import menu from json data
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
event.paramValue( "importFile", "" ).paramValue( "overrideContent", false );
try {
- if ( len( rc.importFile ) and fileExists( rc.importFile ) ) {
- var importLog = variables.menuService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = variables.menuService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -332,4 +366,4 @@ component extends="baseHandler" {
relocate( prc.xehMenus );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc b/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc
index 69b73b4f8f..15d9ba4d0f 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/modules.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,16 +6,21 @@
* Manage modules
*/
component extends="baseHandler" {
-
// Dependencies
property name="moduleService" inject="moduleService@contentbox";
- property name="routingService" inject="coldbox:routingService";
+ property name="routingService" inject="coldbox:routingService";
// PrePost Actions
this.prehandler_except = "execute";
// pre handler
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabModules = true;
}
@@ -23,40 +28,53 @@ component extends="baseHandler" {
/**
* Build Module Links
*/
- function buildModuleLink( event, rc, prc ){
+ function buildModuleLink( event, rc, prc ) {
return cb.buildModuleLink(
- module = event.getValue( "module", "" ),
- linkTo = event.getValue( "moduleEvent", "" ),
- queryString = event.getValue( "moduleQS", "" )
- );
+ module = event.getValue( "module", "" ),
+ linkTo = event.getValue( "moduleEvent", "" ),
+ queryString = event.getValue( "moduleQS", "" )
+ );
}
/**
* proxy a call to a module, all module calls are supposed to return content
* This is used to proxy /cbadmin/{module} type of calls
*/
- function execute( event, rc, prc ){
+ function execute( event, rc, prc ) {
event
.paramValue( "moduleEntryPoint", "" )
.paramValue( "moduleHandler", "" )
.paramValue( "moduleAction", "index" );
// Clean incoming routed URL from base proxy: cbadmin/module
- var routedURL = event.getCurrentRoutedURL().replacenocase( "cbadmin/module", "" );
+ var routedURL = event.getCurrentRoutedURL().replacenocase( "cbadmin/module", "" );
// Discover it's route
var routeResults = routingService.findRoute( routedURL, event );
// Check if route is discovered, basically if we get handler => contentbox-ui:page then it was not found
if ( routeResults.route.handler == "contentbox-ui:page" ) {
- cbMessageBox().warn( "No module where found with the incoming route: #encodeForHTML( routedURL )#" );
+ cbMessageBox().warn(
+ "No module where found with the incoming route: #encodeForHTML( routedURL )#"
+ );
return relocate( prc.xehModules );
}
// Process the route, this discovers the route
- prc.contentbox_moduleEvent = routingService.processRoute( routeResults, event, rc, prc );
+ prc.contentbox_moduleEvent = routingService.processRoute(
+ routeResults,
+ event,
+ rc,
+ prc
+ );
// Default module actions
- if ( isSimpleValue( routeResults.route.action ) and !routeResults.route.action.len() ) {
+ if (
+ isSimpleValue( routeResults.route.action ) &&
+ !routeResults
+ .route
+ .action
+ .len()
+ ) {
prc.contentbox_moduleEvent &= ".index";
}
@@ -69,7 +87,7 @@ component extends="baseHandler" {
}
// stash the module view, so it renders in the admin layout if not set already
- if ( !structKeyExists( prc, "viewModule" ) or !len( prc.viewModule ) ) {
+ if ( !structKeyExists( prc, "viewModule" ) || !len( prc.viewModule ) ) {
prc.viewModule = routeResults.route.module;
}
@@ -83,13 +101,13 @@ component extends="baseHandler" {
/**
* Module Manager
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
- prc.xehModuleRemove = "#prc.cbAdminEntryPoint#.modules.remove";
- prc.xehModuleUpload = "#prc.cbAdminEntryPoint#.modules.upload";
- prc.xehModuleReset = "#prc.cbAdminEntryPoint#.modules.reset";
- prc.xehModuleRescan = "#prc.cbAdminEntryPoint#.modules.rescan";
- prc.xehModuleActivate = "#prc.cbAdminEntryPoint#.modules.activate";
+ prc.xehModuleRemove = "#prc.cbAdminEntryPoint#.modules.remove";
+ prc.xehModuleUpload = "#prc.cbAdminEntryPoint#.modules.upload";
+ prc.xehModuleReset = "#prc.cbAdminEntryPoint#.modules.reset";
+ prc.xehModuleRescan = "#prc.cbAdminEntryPoint#.modules.rescan";
+ prc.xehModuleActivate = "#prc.cbAdminEntryPoint#.modules.activate";
prc.xehmoduleDeactivate = "#prc.cbAdminEntryPoint#.modules.deactivate";
// tab
@@ -101,8 +119,8 @@ component extends="baseHandler" {
}
// Get all modules
- var modules = variables.moduleService.findModules();
- prc.modules = modules.modules;
+ var modules = variables.moduleService.findModules();
+ prc.modules = modules.modules;
prc.modulesCount = modules.count;
// view
@@ -112,7 +130,7 @@ component extends="baseHandler" {
/**
* Activate a module
*/
- function activate( event, rc, prc ){
+ function activate( event, rc, prc ) {
variables.moduleService.activateModule( rc.moduleName );
cbMessageBox().info( "Modules Activated, woohoo!" );
relocate( prc.xehModules );
@@ -121,7 +139,7 @@ component extends="baseHandler" {
/**
* Deactivate a module
*/
- function deactivate( event, rc, prc ){
+ function deactivate( event, rc, prc ) {
variables.moduleService.deactivateModule( rc.moduleName );
cbMessageBox().info( "Modules Deactivated!" );
relocate( prc.xehModules );
@@ -130,7 +148,7 @@ component extends="baseHandler" {
/**
* Reset all modules
*/
- function reset( event, rc, prc ){
+ function reset( event, rc, prc ) {
variables.moduleService.resetModules();
cbMessageBox().info( "Modules Reset!" );
relocate( prc.xehModules );
@@ -139,7 +157,7 @@ component extends="baseHandler" {
/**
* Rescan all modules
*/
- function rescan( event, rc, prc ){
+ function rescan( event, rc, prc ) {
variables.moduleService.startup();
cbMessageBox().info( "Modules Rescaned and Revamped!" );
relocate( prc.xehModules );
@@ -148,10 +166,10 @@ component extends="baseHandler" {
/**
* Remove a module
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
variables.moduleService.deleteModule( rc.moduleName );
cbMessageBox().info( "Module Removed Forever!" );
relocate( prc.xehModules );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/pages.cfc b/modules/contentbox/modules/contentbox-admin/handlers/pages.cfc
index d2946ce219..a0813571ff 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/pages.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/pages.cfc
@@ -6,40 +6,44 @@
* Manage site pages
*/
component extends="baseContentHandler" {
-
// Dependencies
property name="ormService" inject="pageService@contentbox";
-
// Properties
- variables.handler = "pages";
+ variables.handler = "pages";
variables.defaultOrdering = "order asc, createdDate desc";
- variables.entity = "Page";
- variables.entityPlural = "pages";
- variables.securityPrefix = "PAGES";
+ variables.entity = "Page";
+ variables.entityPlural = "pages";
+ variables.securityPrefix = "PAGES";
/**
* Pre Handler interceptions
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
super.preHandler( argumentCollection = arguments );
// exit Handlers
- prc.xehPages = "#prc.cbAdminEntryPoint#.pages.index";
+ prc.xehPages = "#prc.cbAdminEntryPoint#.pages.index";
prc.xehPageEditor = "#prc.cbAdminEntryPoint#.pages.editor";
prc.xehPageRemove = "#prc.cbAdminEntryPoint#.pages.remove";
- prc.xehTemplates = "#prc.cbAdminEntryPoint#.ContentTemplates.index";
+ prc.xehTemplates = "#prc.cbAdminEntryPoint#.ContentTemplates.index";
}
/**
* Show Content
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit handlers
- prc.xehPageSearch = "#prc.cbAdminEntryPoint#.pages.index";
- prc.xehPageTable = "#prc.cbAdminEntryPoint#.pages.contentTable";
+ prc.xehPageSearch = "#prc.cbAdminEntryPoint#.pages.index";
+ prc.xehPageTable = "#prc.cbAdminEntryPoint#.pages.contentTable";
prc.xehPageBulkStatus = "#prc.cbAdminEntryPoint#.pages.bulkstatus";
- prc.xehPageExportAll = "#prc.cbAdminEntryPoint#.pages.exportAll";
- prc.xehPageImport = "#prc.cbAdminEntryPoint#.pages.importAll";
- prc.xehPageClone = "#prc.cbAdminEntryPoint#.pages.clone";
+ prc.xehPageExportAll = "#prc.cbAdminEntryPoint#.pages.exportAll";
+ prc.xehPageImport = "#prc.cbAdminEntryPoint#.pages.importAll";
+ prc.xehPageClone = "#prc.cbAdminEntryPoint#.pages.clone";
// Light up
prc.tabContent_Pages = true;
@@ -51,13 +55,13 @@ component extends="baseContentHandler" {
/**
* Content table brought via ajax
*/
- function contentTable( event, rc, prc ){
+ function contentTable( event, rc, prc ) {
// exit handlers
- prc.xehPageSearch = "#prc.cbAdminEntryPoint#.pages.index";
+ prc.xehPageSearch = "#prc.cbAdminEntryPoint#.pages.index";
prc.xehPageQuickLook = "#prc.cbAdminEntryPoint#.pages.quickLook";
- prc.xehPageOrder = "#prc.cbAdminEntryPoint#.pages.changeOrder";
- prc.xehPageExport = "#prc.cbAdminEntryPoint#.pages.export";
- prc.xehPageClone = "#prc.cbAdminEntryPoint#.pages.clone";
+ prc.xehPageOrder = "#prc.cbAdminEntryPoint#.pages.changeOrder";
+ prc.xehPageExport = "#prc.cbAdminEntryPoint#.pages.export";
+ prc.xehPageClone = "#prc.cbAdminEntryPoint#.pages.clone";
// Super size it
super.contentTable( argumentCollection = arguments );
}
@@ -65,7 +69,7 @@ component extends="baseContentHandler" {
/**
* Change the status of many content objects
*/
- function bulkStatus( event, rc, prc ){
+ function bulkStatus( event, rc, prc ) {
arguments.relocateTo = prc.xehPages;
super.bulkStatus( argumentCollection = arguments );
}
@@ -73,10 +77,14 @@ component extends="baseContentHandler" {
/**
* Show the editor
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// Get active layout record and available page only layouts
- prc.themeRecord = variables.themeService.getActiveTheme();
- prc.availableLayouts = reReplaceNoCase( prc.themeRecord.layouts, "blog,?", "" );
+ prc.themeRecord = variables.themeService.getActiveTheme();
+ prc.availableLayouts = reReplaceNoCase(
+ prc.themeRecord.layouts,
+ "blog,?",
+ ""
+ );
// Super size it
super.editor( argumentCollection = arguments );
}
@@ -84,16 +92,16 @@ component extends="baseContentHandler" {
/**
* Save a page
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
arguments.adminPermission = "PAGES_ADMIN,PAGES_EDITOR";
- arguments.relocateTo = prc.xehPages;
+ arguments.relocateTo = prc.xehPages;
super.save( argumentCollection = arguments );
}
/**
* Clone a page
*/
- function clone( event, rc, prc ){
+ function clone( event, rc, prc ) {
arguments.relocateTo = prc.xehPages;
super.clone( argumentCollection = arguments );
}
@@ -101,7 +109,7 @@ component extends="baseContentHandler" {
/**
* Remove a page
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
arguments.relocateTo = prc.xehPages;
super.remove( argumentCollection = arguments );
}
@@ -109,7 +117,7 @@ component extends="baseContentHandler" {
/**
* Called by editors to bring a modal selector of content
*/
- function editorSelector( event, rc, prc ){
+ function editorSelector( event, rc, prc ) {
// Sorting
arguments.sortOrder = "slug asc";
// Supersize me
@@ -119,9 +127,9 @@ component extends="baseContentHandler" {
/**
* Import pages
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
arguments.relocateTo = prc.xehPages;
super.importAll( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc
index 863b11dea4..ef9cd6b2f8 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/permissionGroups.cfc
@@ -6,21 +6,29 @@
* Manage Permission Groups
*/
component extends="baseHandler" {
-
// Dependencies
- property name="permissionGroupService" inject="permissionGroupService@contentbox";
+ property
+ name="permissionGroupService"
+ inject="permissionGroupService@contentbox";
+
property name="permissionService" inject="permissionService@contentbox";
/**
* Pre handler
*
- * @event
- * @action
+ * @event
+ * @action
* @eventArguments
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabUsers = true;
}
@@ -28,18 +36,18 @@ component extends="baseHandler" {
/**
* List Groups
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
- prc.xehGroupRemove = "#prc.cbAdminEntryPoint#.permissionGroups.remove";
- prc.xehGroupEditor = "#prc.cbAdminEntryPoint#.permissionGroups.editor";
- prc.xehGroupSave = "#prc.cbAdminEntryPoint#.permissionGroups.save";
+ prc.xehGroupRemove = "#prc.cbAdminEntryPoint#.permissionGroups.remove";
+ prc.xehGroupEditor = "#prc.cbAdminEntryPoint#.permissionGroups.editor";
+ prc.xehGroupSave = "#prc.cbAdminEntryPoint#.permissionGroups.save";
prc.xehGroupPermissions = "#prc.cbAdminEntryPoint#.permissionGroups.permissions";
- prc.xehExport = "#prc.cbAdminEntryPoint#.permissionGroups.export";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.permissionGroups.exportAll";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.permissionGroups.importAll";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.permissionGroups.export";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.permissionGroups.exportAll";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.permissionGroups.importAll";
// Get all groups
- prc.aGroups = permissionGroupService.list( sortOrder = "name", asQuery = false );
+ prc.aGroups = permissionGroupService.list( sortOrder = "name", asQuery = false );
// Tab
prc.tabUsers_permissionGroups = true;
// view
@@ -49,33 +57,43 @@ component extends="baseHandler" {
/**
* Save groups
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// Inflate the right Permissions according to toggle pattern: permissions_id_toggle
- rc.permissions = rc
- .filter( function( key, value ){
- return key.findNoCase( "permissions_" );
- } )
- .reduce( function( results, key, value ){
- results.append( getToken( key, "2", "_" ) );
- return results;
- }, [] );
+ rc.permissions = rc.filter(
+ function( key, value ) {
+ return key.findNoCase( "permissions_" );
+ }
+ ).reduce(
+ function( results, key, value ) {
+ results.append( getToken(
+ key,
+ "2",
+ "_"
+ ) );
+ return results;
+ },
+ []
+ );
// populate and get
var oGroup = populate(
- model : permissionGroupService.get( rc.permissionGroupID ),
- composeRelationships: true,
- exclude : "permissionGroupID"
+ model = permissionGroupService.get( rc.permissionGroupID ),
+ composeRelationships = true,
+ exclude = "permissionGroupID"
);
// Validate
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
- announce( "cbadmin_postPermissionGroupSave", { group : oGroup } );
+ announce( "cbadmin_postPermissionGroupSave", { group: oGroup } );
// messagebox
cbMessageBox().setMessage( "info", "Permission Group saved!" );
} else {
@@ -89,9 +107,12 @@ component extends="baseHandler" {
/**
* Remove a group
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// announce event
- announce( "cbadmin_prePermissionGroupRemove", { permissionGroupID : rc.permissionGroupID } );
+ announce(
+ "cbadmin_prePermissionGroupRemove",
+ { permissionGroupID: rc.permissionGroupID }
+ );
var allGroups = permissionGroupService.getAll( rc.permissionGroupID );
@@ -104,25 +125,27 @@ component extends="baseHandler" {
}
// announce event
- announce( "cbadmin_postPermissionGroupRemove", { permissionGroupID : rc.permissionGroupID } );
+ announce(
+ "cbadmin_postPermissionGroupRemove",
+ { permissionGroupID: rc.permissionGroupID }
+ );
// Message
cbMessageBox().setMessage( "info", "Permission Group Removed!" );
// relocate
relocate( prc.xehPermissionGroups );
}
-
/**
* Create or Edit Groups
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
param rc.permissionGroupID = 0;
// Get or fail
- prc.oGroup = variables.permissionGroupService.get( rc.permissionGroupID );
+ 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" );
}
@@ -130,22 +153,31 @@ component extends="baseHandler" {
/**
* Export a permission group
*/
- function export( event, rc, prc ){
- return variables.permissionGroupService.get( event.getValue( "permissionGroupID", 0 ) ).getMemento();
+ function export( event, rc, prc ) {
+ return variables
+ .permissionGroupService
+ .get( event.getValue( "permissionGroupID", 0 ) )
+ .getMemento();
}
/**
* Export all entries
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
param rc.permissionGroupID = "";
// Export all or some
if ( len( rc.permissionGroupID ) ) {
- return rc.permissionGroupID
+ return rc
+ .permissionGroupID
.listToArray()
- .map( function( id ){
- return variables.permissionGroupService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .permissionGroupService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.permissionGroupService.getAllForExport();
}
@@ -154,23 +186,21 @@ component extends="baseHandler" {
/**
* Import all permission groups
*/
- function importAll( event, 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 = permissionGroupService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = permissionGroupService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
cbMessageBox().info( "Permission Groups imported sucessfully!" );
flash.put( "importLog", importLog );
} else {
cbMessageBox().error(
- "The import file is invalid: #encodeForHTML( rc.importFile )# cannot continue with import"
- );
+ "The import file is invalid: #encodeForHTML( rc.importFile )# cannot continue with import"
+ );
}
- } catch ( any e ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -178,4 +208,4 @@ component extends="baseHandler" {
relocate( prc.xehPermissionGroups );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc b/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc
index 044b74bcf9..d7dd1233ef 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/permissions.cfc
@@ -6,20 +6,25 @@
* Manage Permissions
*/
component extends="baseHandler" {
-
// Dependencies
property name="permissionService" inject="permissionService@contentbox";
/**
* Pre handler
*
- * @event
- * @action
+ * @event
+ * @action
* @eventArguments
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabUsers = true;
}
@@ -28,19 +33,19 @@ component extends="baseHandler" {
* Manage permissions
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
prc.xehPermissionRemove = "#prc.cbAdminEntryPoint#.permissions.remove";
- prc.xehPermissionSave = "#prc.cbAdminEntryPoint#.permissions.save";
- prc.xehExport = "#prc.cbAdminEntryPoint#.permissions.export";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.permissions.exportAll";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.permissions.importAll";
+ prc.xehPermissionSave = "#prc.cbAdminEntryPoint#.permissions.save";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.permissions.export";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.permissions.exportAll";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.permissions.importAll";
// Get all permissions
- prc.permissions = permissionService.list( sortOrder = "permission" );
+ prc.permissions = permissionService.list( sortOrder = "permission" );
// Tab
prc.tabUsers_Permissions = true;
// view
@@ -51,24 +56,27 @@ component extends="baseHandler" {
* Save permissions
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// UCASE permission
- rc.permission = uCase( rc.permission );
+ rc.permission = uCase( rc.permission );
// populate and get
- var oPermission = populate( model: permissionService.get( rc.permissionID ), exclude: "permissionID" );
- var vResults = validate( oPermission );
+ var oPermission = populate( 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
- announce( "cbadmin_postPermissionSave", { permission : oPermission } );
+ announce( "cbadmin_postPermissionSave", { permission: oPermission } );
// messagebox
cbMessageBox().setMessage( "info", "Permission saved!" );
} else {
@@ -83,18 +91,24 @@ component extends="baseHandler" {
* Remove permissions
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// announce event
- announce( "cbadmin_prePermissionRemove", { permissionID : rc.permissionID } );
+ announce(
+ "cbadmin_prePermissionRemove",
+ { permissionID: rc.permissionID }
+ );
// delete by id
if ( !permissionService.deletePermission( rc.permissionID ) ) {
cbMessageBox().setMessage( "warning", "Invalid Permission detected!" );
} else {
// announce event
- announce( "cbadmin_postPermissionRemove", { permissionID : rc.permissionID } );
+ announce(
+ "cbadmin_postPermissionRemove",
+ { permissionID: rc.permissionID }
+ );
// Message
cbMessageBox().setMessage( "info", "Permission and all relationships Removed!" );
}
@@ -104,22 +118,31 @@ component extends="baseHandler" {
/**
* Export a permission
*/
- function export( event, rc, prc ){
- return variables.permissionService.get( event.getValue( "permissionID", 0 ) ).getMemento();
+ function export( event, rc, prc ) {
+ return variables
+ .permissionService
+ .get( event.getValue( "permissionID", 0 ) )
+ .getMemento();
}
/**
* Export all permissions as json/xml
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
param rc.permissionID = "";
// Export all or some
if ( len( rc.permissionID ) ) {
- return rc.permissionID
+ return rc
+ .permissionID
.listToArray()
- .map( function( id ){
- return variables.permissionService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .permissionService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.permissionService.getAllForExport();
}
@@ -128,21 +151,21 @@ component extends="baseHandler" {
/**
* Import permissions
*/
- function importAll( event, 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 = variables.permissionService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = variables.permissionService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -150,4 +173,4 @@ component extends="baseHandler" {
relocate( prc.xehPermissions );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc
index 47792c00ff..8f4d0366ce 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/roles.cfc
@@ -6,21 +6,27 @@
* Manage roles
*/
component extends="baseHandler" {
-
// Dependencies
property name="roleService" inject="roleService@contentbox";
+
property name="permissionService" inject="permissionService@contentbox";
/**
* Pre handler
*
- * @event
- * @action
+ * @event
+ * @action
* @eventArguments
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabUsers = true;
}
@@ -29,21 +35,21 @@ component extends="baseHandler" {
* Manage roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
- prc.xehRoleRemove = "#prc.cbAdminEntryPoint#.roles.remove";
- prc.xehRoleEditor = "#prc.cbAdminEntryPoint#.roles.editor";
- prc.xehRoleSave = "#prc.cbAdminEntryPoint#.roles.save";
+ prc.xehRoleRemove = "#prc.cbAdminEntryPoint#.roles.remove";
+ prc.xehRoleEditor = "#prc.cbAdminEntryPoint#.roles.editor";
+ prc.xehRoleSave = "#prc.cbAdminEntryPoint#.roles.save";
prc.xehRolePermissions = "#prc.cbAdminEntryPoint#.roles.permissions";
- prc.xehExport = "#prc.cbAdminEntryPoint#.roles.export";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.roles.exportAll";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.roles.importAll";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.roles.export";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.roles.exportAll";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.roles.importAll";
// Get all roles
- prc.roles = roleService.list( sortOrder = "role", asQuery = false );
+ prc.roles = roleService.list( sortOrder = "role", asQuery = false );
// Tab
prc.tabUsers_roles = true;
// view
@@ -54,36 +60,46 @@ component extends="baseHandler" {
* Save Roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// Inflate the right Permissions according to toggle pattern: permissions_id_toggle
- rc.permissions = rc
- .filter( function( key, value ){
- return key.findNoCase( "permissions_" );
- } )
- .reduce( function( results, key, value ){
- results.append( getToken( key, "2", "_" ) );
- return results;
- }, [] );
+ rc.permissions = rc.filter(
+ function( key, value ) {
+ return key.findNoCase( "permissions_" );
+ }
+ ).reduce(
+ function( results, key, value ) {
+ results.append( getToken(
+ key,
+ "2",
+ "_"
+ ) );
+ return results;
+ },
+ []
+ );
// populate and get
prc.oRole = populate(
- model : roleService.get( rc.roleID ),
- composeRelationships: true,
- exclude : "roleID"
+ model = roleService.get( rc.roleID ),
+ composeRelationships = true,
+ exclude = "roleID"
);
// Validate
var vResults = validate( prc.oRole );
if ( !vResults.hasErrors() ) {
// announce event
- announce( "cbadmin_preRoleSave", { role : prc.oRole, roleID : rc.roleID } );
+ announce(
+ "cbadmin_preRoleSave",
+ { role: prc.oRole, roleID: rc.roleID }
+ );
// save role
roleService.save( prc.oRole );
// announce event
- announce( "cbadmin_postRoleSave", { role : prc.oRole } );
+ announce( "cbadmin_postRoleSave", { role: prc.oRole } );
// messagebox
cbMessageBox().setMessage( "info", "Role saved!" );
// relocate
@@ -99,12 +115,12 @@ component extends="baseHandler" {
* Remove Roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// announce event
- announce( "cbadmin_preRoleRemove", { roleID : rc.roleID } );
+ announce( "cbadmin_preRoleRemove", { roleID: rc.roleID } );
var allRoles = roleService.getAll( rc.roleID );
@@ -117,7 +133,7 @@ component extends="baseHandler" {
}
// announce event
- announce( "cbadmin_postRoleRemove", { roleID : rc.roleID } );
+ announce( "cbadmin_postRoleRemove", { roleID: rc.roleID } );
// Message
cbMessageBox().setMessage( "info", "Role Removed!" );
// relocate
@@ -127,7 +143,7 @@ component extends="baseHandler" {
/**
* Create or Edit Roles
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
param rc.roleId = 0;
// Get or fail
if ( isNull( prc.oRole ) ) {
@@ -136,7 +152,7 @@ component extends="baseHandler" {
// Load permissions
prc.aPermissions = variables.permissionService.list( sortOrder = "permission", asQuery = false );
// Exit handlers
- prc.xehRoleSave = "#prc.cbAdminEntryPoint#.roles.save";
+ prc.xehRoleSave = "#prc.cbAdminEntryPoint#.roles.save";
// View
event.setView( "roles/editor" );
}
@@ -145,29 +161,38 @@ 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" );
+ function export( event, rc, prc ) {
+ return variables
+ .roleService
+ .get( event.getValue( "roleID", 0 ) )
+ .getMemento( includes = "permissions" );
}
/**
* Export all roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
param rc.roleID = "";
// Export all or some
if ( len( rc.roleID ) ) {
- return rc.roleID
+ return rc
+ .roleID
.listToArray()
- .map( function( id ){
- return variables.roleService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .roleService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.roleService.getAllForExport();
}
@@ -177,23 +202,23 @@ component extends="baseHandler" {
* Import roles
*
* @event
- * @rc
- * @prc
+ * @rc
+ * @prc
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
event.paramValue( "importFile", "" );
event.paramValue( "overrideContent", false );
try {
- if ( len( rc.importFile ) and fileExists( rc.importFile ) ) {
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
var importLog = roleService.importFromFile( importFile = rc.importFile, override = rc.overrideContent );
cbMessageBox().info( "Roles imported sucessfully!" );
flash.put( "importLog", importLog );
} else {
cbMessageBox().error(
- "The import file is invalid: #encodeForHTML( rc.importFile )# cannot continue with import"
- );
+ "The import file is invalid: #encodeForHTML( rc.importFile )# cannot continue with import"
+ );
}
- } catch ( any e ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -201,4 +226,4 @@ component extends="baseHandler" {
relocate( prc.xehRoles );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc b/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc
index 19ee2e8496..52b679bb01 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/securityRules.cfc
@@ -2,31 +2,35 @@
* Manage Security Rules
*/
component extends="baseHandler" {
-
// Dependencies
property name="ruleService" inject="securityRuleService@contentbox";
+
property name="permissionService" inject="permissionService@contentbox";
+
property name="roleService" inject="roleService@contentbox";
- property name="securityInterceptor" inject="coldbox:interceptor:cbsecurity@global";
+
+ property
+ name="securityInterceptor"
+ inject="coldbox:interceptor:cbsecurity@global";
// index
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Exit Handler
- prc.xehSaveRule = "#prc.cbAdminEntryPoint#.securityRules.save";
+ prc.xehSaveRule = "#prc.cbAdminEntryPoint#.securityRules.save";
prc.xehRemoveRule = "#prc.cbAdminEntryPoint#.securityRules.remove";
prc.xehEditorRule = "#prc.cbAdminEntryPoint#.securityRules.editor";
- prc.xehRuleOrder = "#prc.cbAdminEntryPoint#.securityRules.changeOrder";
+ prc.xehRuleOrder = "#prc.cbAdminEntryPoint#.securityRules.changeOrder";
prc.xehApplyRules = "#prc.cbAdminEntryPoint#.securityRules.apply";
prc.xehResetRules = "#prc.cbAdminEntryPoint#.securityRules.reset";
- prc.xehExport = "#prc.cbAdminEntryPoint#.securityRules.export";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.securityRules.exportAll";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.securityRules.importAll";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.securityRules.export";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.securityRules.exportAll";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.securityRules.importAll";
// get content pieces
prc.rules = ruleService.getAll( sortOrder = "order asc" );
// tab
- prc.tabSystem = true;
+ prc.tabSystem = true;
prc.tabSystem_securityRules = true;
// view
@@ -38,7 +42,7 @@ component extends="baseHandler" {
}
// Reset Rules
- function reset( event, rc, prc ){
+ function reset( event, rc, prc ) {
ruleService.resetRules();
securityInterceptor.configure();
securityInterceptor.afterAspectsLoad( argumentCollection = arguments );
@@ -49,7 +53,7 @@ component extends="baseHandler" {
}
// Apply the security rules
- function apply( event, rc, prc ){
+ function apply( event, rc, prc ) {
securityInterceptor.configure();
securityInterceptor.afterAspectsLoad( argumentCollection = arguments );
cbMessageBox().info( "Security Rules Applied!" );
@@ -57,26 +61,36 @@ component extends="baseHandler" {
}
// change order for all rules
- function changeOrder( event, rc, prc ){
+ function changeOrder( event, rc, prc ) {
event.paramValue( "tableID", "rules" ).paramValue( "newRulesOrder", "" );
// decode + cleanup incoming rules data
// We replace _ to - due to the js plugin issue of not liking dashes
var aOrderedContent = urlDecode( rc.newRulesOrder )
- .replace( "_", "-", "all" )
+ .replace(
+ "_",
+ "-",
+ "all"
+ )
.listToArray( "&" )
- .map( function( thisItem ){
- return reReplaceNoCase(
- arguments.thisItem,
- "#rc.tableID#\[\]\=",
- "",
- "all"
- );
- } )
+ .map(
+ function( thisItem ) {
+ return reReplaceNoCase(
+ arguments.thisItem,
+ "#rc.tableID#\[\]\=",
+ "",
+ "all"
+ );
+ }
+ )
// Inflate
- .map( function( thisId, index ){
- return variables.ruleService.get( arguments.thisId ).setOrder( arguments.index );
- } );
-
+ .map(
+ function( thisId, index ) {
+ return variables
+ .ruleService
+ .get( arguments.thisId )
+ .setOrder( arguments.index );
+ }
+ );
// save them
if ( arrayLen( aOrderedContent ) ) {
@@ -87,17 +101,19 @@ component extends="baseHandler" {
event
.getResponse()
.setData(
- aOrderedContent.map( function( thisItem ){
- return arguments.thisItem.getContentID();
- } )
+ aOrderedContent.map(
+ function( thisItem ) {
+ return arguments.thisItem.getContentID();
+ }
+ )
)
.addMessage( "Rules ordered successfully!" );
}
// editor
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// tab
- prc.tabSystem = true;
+ prc.tabSystem = true;
prc.tabSystem_securityRules = true;
// get new or persisted
@@ -107,25 +123,28 @@ component extends="baseHandler" {
// Load permissions
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" );
}
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// populate and get content
- prc.rule = populate( model: variables.ruleService.get( rc.ruleID ), exclude: "ruleID" );
+ prc.rule = populate( model = variables.ruleService.get( rc.ruleID ), exclude = "ruleID" );
// validate it
var vResults = validate( prc.rule );
if ( !vResults.hasErrors() ) {
// announce event
- announce( "cbadmin_preSecurityRulesSave", { rule : prc.rule, ruleID : rc.ruleID } );
+ announce(
+ "cbadmin_preSecurityRulesSave",
+ { rule: prc.rule, ruleID: rc.ruleID }
+ );
// save rule
variables.ruleService.saveRule( prc.rule );
// announce event
- announce( "cbadmin_postSecurityRulesSave", { rule : prc.rule } );
+ announce( "cbadmin_postSecurityRulesSave", { rule: prc.rule } );
// Message + Relocate
cbMessageBox().info( "Security Rule saved! Isn't that awesome!" );
relocate( prc.xehsecurityRules );
@@ -135,16 +154,16 @@ component extends="baseHandler" {
}
}
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
event.paramValue( "ruleID", "" );
// check for length
if ( len( rc.ruleID ) ) {
// announce event
- announce( "cbadmin_preSecurityRulesRemove", { ruleID : rc.ruleID } );
+ announce( "cbadmin_preSecurityRulesRemove", { ruleID: rc.ruleID } );
// remove using hibernate bulk
ruleService.deleteByID( listToArray( rc.ruleID ) );
// announce event
- announce( "cbadmin_postSecurityRulesRemove", { ruleID : rc.ruleID } );
+ announce( "cbadmin_postSecurityRulesRemove", { ruleID: rc.ruleID } );
// message
cbMessageBox().info( "Security Rule Removed!" );
} else {
@@ -154,38 +173,49 @@ component extends="baseHandler" {
}
// Export Entry
- function export( event, rc, prc ){
- return variables.ruleService.get( event.getValue( "ruleID", 0 ) ).getMemento();
+ function export( event, rc, prc ) {
+ return variables
+ .ruleService
+ .get( event.getValue( "ruleID", 0 ) )
+ .getMemento();
}
// Export All Entries
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
param rc.securityRuleID = "";
// Export all or some
if ( len( rc.securityRuleID ) ) {
- return rc.securityRuleID
+ return rc
+ .securityRuleID
.listToArray()
- .map( function( id ){
- return variables.ruleService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .ruleService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.ruleService.getAllForExport();
}
}
// import entries
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
event.paramValue( "importFile", "" );
event.paramValue( "overrideContent", false );
try {
- if ( len( rc.importFile ) and fileExists( rc.importFile ) ) {
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -193,4 +223,4 @@ component extends="baseHandler" {
relocate( prc.xehSecurityRules );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc b/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc
index c88c45f396..54d8bbebb1 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/settings.cfc
@@ -6,16 +6,25 @@
* Manage system settings
*/
component extends="baseHandler" {
-
// Dependencies
property name="settingsService" inject="settingService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="pageService" inject="pageService@contentbox";
+
property name="editorService" inject="editorService@contentbox";
+
property name="mediaService" inject="mediaService@contentbox";
+
property name="LoginTrackerService" inject="LoginTrackerService@contentbox";
+
property name="mailService" inject="mailservice@cbMailservices";
- property name="markdownEditor" inject="markdownEditor@contentbox-markdowneditor";
+
+ property
+ name="markdownEditor"
+ inject="markdownEditor@contentbox-markdowneditor";
+
property name="twoFactorService" inject="twoFactorService@contentbox";
/**
@@ -23,24 +32,24 @@ component extends="baseHandler" {
*
* @return html
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Exit Handler
- prc.xehSaveSettings = "#prc.cbAdminEntryPoint#.settings.save";
- prc.xehEmailTest = "#prc.cbAdminEntryPoint#.settings.emailTest";
+ prc.xehSaveSettings = "#prc.cbAdminEntryPoint#.settings.save";
+ prc.xehEmailTest = "#prc.cbAdminEntryPoint#.settings.emailTest";
// Get All registered editors so we can display them
- prc.editors = variables.editorService.getRegisteredEditorsMap();
+ prc.editors = variables.editorService.getRegisteredEditorsMap();
// Get All registered markups so we can display them
- prc.markups = variables.editorService.getRegisteredMarkups();
+ prc.markups = variables.editorService.getRegisteredMarkups();
// Get all registered media providers so we can display them
- prc.mediaProviders = variables.mediaService.getRegisteredProvidersMap();
+ prc.mediaProviders = variables.mediaService.getRegisteredProvidersMap();
// Get All registered two factor providers so we can display them
prc.twoFactorProviders = variables.twoFactorService.getRegisteredProvidersMap();
// tab
prc.tabSystem_Settings = true;
// cb helper
- prc.cb = variables.CBHelper;
+ prc.cb = variables.CBHelper;
// caches
- prc.cacheNames = variables.cachebox.getCacheNames();
+ prc.cacheNames = variables.cachebox.getCacheNames();
// Markdown Editor Availability
variables.markdownEditor.loadAssets();
// view
@@ -52,19 +61,19 @@ component extends="baseHandler" {
*
* @return json
*/
- function emailTest( event, rc, prc ){
+ function emailTest( event, rc, prc ) {
var mail = mailservice.newMail(
- to = rc.cb_site_outgoingEmail,
- from = rc.cb_site_outgoingEmail,
- subject = "ContentBox Test",
- server = rc.cb_site_mail_server,
- username = rc.cb_site_mail_username,
- password = rc.cb_site_mail_password,
- port = rc.cb_site_mail_smtp,
- useTLS = rc.cb_site_mail_tls,
- useSSL = rc.cb_site_mail_ssl,
- body = "Test Email From ContentBox"
- );
+ to = rc.cb_site_outgoingEmail,
+ from = rc.cb_site_outgoingEmail,
+ subject = "ContentBox Test",
+ server = rc.cb_site_mail_server,
+ username = rc.cb_site_mail_username,
+ password = rc.cb_site_mail_password,
+ port = rc.cb_site_mail_smtp,
+ useTLS = rc.cb_site_mail_tls,
+ useSSL = rc.cb_site_mail_ssl,
+ body = "Test Email From ContentBox"
+ );
// send it out
var results = mailService.send( mail ).getResults();
@@ -74,34 +83,38 @@ component extends="baseHandler" {
/**
* Save settings
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// announce event
- announce( "cbadmin_preSettingsSave", { oldSettings : prc.cbSettings, newSettings : rc } );
+ announce(
+ "cbadmin_preSettingsSave",
+ { oldSettings: prc.cbSettings, newSettings: rc }
+ );
// bulk save the options
variables.settingsService.bulkSave( rc );
// Do blog entry point change?
if (
- rc.keyExists( "cb_site_blog_entrypoint" ) && prc.cbSettings[ "cb_site_blog_entrypoint" ] != rc.cb_site_blog_entrypoint
+ rc.keyExists( "cb_site_blog_entrypoint" ) &&
+ prc.cbSettings[ "cb_site_blog_entrypoint" ] != rc.cb_site_blog_entrypoint
) {
var routingService = variables.controller.getRoutingService();
// Reroute using passed cb_site_blog_entryPoint just in case
routingService.setRoutes(
- routingService
- .getRoutes()
- .map( function( item ){
- if ( arguments.item.namespaceRouting eq "blog" ) {
- arguments.item.pattern = item.regexpattern = replace(
- rc[ "cb_site_blog_entrypoint" ],
- "/",
- "-",
- "all"
- ) & "/";
- }
- return arguments.item;
- } )
- );
+ routingService.getRoutes().map(
+ function( item ) {
+ if ( arguments.item.namespaceRouting EQ "blog" ) {
+ arguments.item.pattern = item.regexpattern = replace(
+ rc[ "cb_site_blog_entrypoint" ],
+ "/",
+ "-",
+ "all"
+ ) & "/";
+ }
+ return arguments.item;
+ }
+ )
+ );
}
// announce event
announce( "cbadmin_postSettingsSave" );
@@ -117,17 +130,17 @@ component extends="baseHandler" {
*
* @return html
*/
- function raw( event, rc, prc ){
+ function raw( event, rc, prc ) {
// exit Handlers
- prc.xehSettingRemove = "#prc.cbAdminEntryPoint#.settings.remove";
- prc.xehSettingsave = "#prc.cbAdminEntryPoint#.settings.saveRaw";
- prc.xehFlushCache = "#prc.cbAdminEntryPoint#.settings.flushCache";
- prc.xehFlushSingletons = "#prc.cbAdminEntryPoint#.settings.flushSingletons";
- prc.xehViewCached = "#prc.cbAdminEntryPoint#.settings.viewCached";
- prc.xehMappingDump = "#prc.cbAdminEntryPoint#.settings.mappingDump";
+ prc.xehSettingRemove = "#prc.cbAdminEntryPoint#.settings.remove";
+ prc.xehSettingsave = "#prc.cbAdminEntryPoint#.settings.saveRaw";
+ prc.xehFlushCache = "#prc.cbAdminEntryPoint#.settings.flushCache";
+ prc.xehFlushSingletons = "#prc.cbAdminEntryPoint#.settings.flushSingletons";
+ prc.xehViewCached = "#prc.cbAdminEntryPoint#.settings.viewCached";
+ prc.xehMappingDump = "#prc.cbAdminEntryPoint#.settings.mappingDump";
prc.xehRawSettingsTable = "#prc.cbAdminEntryPoint#.settings.rawtable";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.settings.exportAll";
- prc.xehSettingsImport = "#prc.cbAdminEntryPoint#.settings.importAll";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.settings.exportAll";
+ prc.xehSettingsImport = "#prc.cbAdminEntryPoint#.settings.importAll";
// Get Interception Points
prc.interceptionPoints = controller.getInterceptorService().getInterceptionPoints();
@@ -145,7 +158,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function rawtable( event, rc, prc ){
+ function rawtable( event, rc, prc ) {
// params
event
.paramValue( "page", 1 )
@@ -154,28 +167,28 @@ component extends="baseHandler" {
.paramValue( "siteId", "" );
// prepare paging object
- prc.oPaging = getInstance( "Paging@contentbox" );
- prc.paging = prc.oPaging.getBoundaries();
+ prc.oPaging = getInstance( "Paging@contentbox" );
+ prc.paging = prc.oPaging.getBoundaries();
prc.pagingLink = event.buildLink( "#prc.xehRawSettings#.page.@page@?" );
prc.pagingLink = "javascript:settingsPaginate(@page@)";
- prc.xehExport = "#prc.cbAdminEntryPoint#.settings.export";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.settings.export";
// View all?
var offset = prc.paging.startRow - 1;
- var max = prc.cbSettings.cb_paging_maxrows;
+ var max = prc.cbSettings.cb_paging_maxrows;
if ( rc.viewAll ) {
offset = max = 0;
}
// Get settings
var results = variables.settingsService.search(
- search : rc.search,
- siteId : rc.siteId,
- offset : offset,
- max : max,
- sortOrder: "name asc, site asc"
- );
- prc.settings = results.settings;
+ search = rc.search,
+ siteId = rc.siteId,
+ offset = offset,
+ max = max,
+ sortOrder = "name asc, site asc"
+ );
+ prc.settings = results.settings;
prc.settingsCount = results.count;
event.setView( view = "settings/rawSettingsTable", layout = "ajax" );
@@ -184,22 +197,31 @@ component extends="baseHandler" {
/**
* Export a setting
*/
- function export( event, rc, prc ){
- return variables.settingsService.get( event.getValue( "settingID", 0 ) ).getMemento();
+ function export( event, rc, prc ) {
+ return variables
+ .settingsService
+ .get( event.getValue( "settingID", 0 ) )
+ .getMemento();
}
/**
* Export multiple settings
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
param rc.settingID = "";
// Export all or some
if ( len( rc.settingID ) ) {
- return rc.settingID
+ return rc
+ .settingID
.listToArray()
- .map( function( id ){
- return variables.settingsService.get( arguments.id ).getMemento( profile: "export" );
- } );
+ .map(
+ function( id ) {
+ return variables
+ .settingsService
+ .get( arguments.id )
+ .getMemento( profile = "export" );
+ }
+ );
} else {
return variables.settingsService.getAllForExport();
}
@@ -208,21 +230,21 @@ component extends="baseHandler" {
/**
* Import all settings from a file packet
*/
- function importAll( event, rc, prc ){
+ function importAll( event, rc, prc ) {
event.paramValue( "importFile", "" );
event.paramValue( "overrideSettings", false );
try {
- if ( len( rc.importFile ) and fileExists( rc.importFile ) ) {
- var importLog = settingsService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideSettings
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = settingsService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideSettings );
cbMessageBox().info( "Settings 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 ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stacktrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -235,7 +257,7 @@ component extends="baseHandler" {
*
* @return html
*/
- function mappingDump( event, rc, prc ){
+ function mappingDump( event, rc, prc ) {
// params
event.paramValue( "id", "" );
prc.mapping = wirebox.getBinder().getMapping( rc.id );
@@ -245,16 +267,16 @@ component extends="baseHandler" {
/**
* Save all raw settings
*/
- function saveRaw( event, rc, prc ){
+ function saveRaw( event, rc, prc ) {
// params
event.paramValue( "page", 1 ).paramValue( "isCore", false );
// populate and get setting
var setting = populate(
- model : settingsService.get( rc.settingID ),
- composeRelationships: true,
- nullEmptyInclude : "site",
- exclude : "settingID"
+ model = settingsService.get( rc.settingID ),
+ composeRelationships = true,
+ nullEmptyInclude = "site",
+ exclude = "settingID"
);
// save new setting
@@ -269,15 +291,15 @@ component extends="baseHandler" {
/**
* Remove a setting
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// announce event
- announce( "cbadmin_preSettingRemove", { settingID : rc.settingID } );
+ announce( "cbadmin_preSettingRemove", { settingID: rc.settingID } );
// delete by id
if ( !settingsService.deleteByID( rc.settingID ) ) {
cbMessageBox().setMessage( "warning", "Invalid Setting detected!" );
} else {
// announce event
- announce( "cbadmin_postSettingRemove", { settingID : rc.settingID } );
+ announce( "cbadmin_postSettingRemove", { settingID: rc.settingID } );
// flush cache
settingsService.flushSettingsCache();
cbMessageBox().setMessage( "info", "Setting Removed!" );
@@ -288,13 +310,13 @@ component extends="baseHandler" {
/**
* Flush settings cache
*/
- function flushCache( event, rc, prc ){
- var data = { error : false, messages : "" };
+ function flushCache( event, rc, prc ) {
+ var data = { error: false, messages: "" };
try {
settingsService.flushSettingsCache();
data.messages = "Settings cache flushed!";
- } catch ( Any e ) {
- data[ "ERROR" ] = true;
+ } catch (Any e) {
+ data[ "ERROR" ] = true;
data[ "MESSAGES" ] = "Error executing flush, please check logs: #e.message#";
log.error( e.message & e.detail, e );
}
@@ -304,9 +326,12 @@ component extends="baseHandler" {
/**
* Flush WireBox singletons
*/
- function flushSingletons( event, rc, prc ){
+ function flushSingletons( event, rc, prc ) {
wirebox.clearSingletons();
- cbMessageBox().setMessage( "info", "All singletons flushed and awaiting re-creation." );
+ cbMessageBox().setMessage(
+ "info",
+ "All singletons flushed and awaiting re-creation."
+ );
relocate( event = prc.xehRawSettings, queryString = "##wirebox" );
}
@@ -315,8 +340,8 @@ component extends="baseHandler" {
*
* @return html
*/
- function viewCached( event, rc, prc ){
- var cache = settingsService.getSettingsCacheProvider();
+ function viewCached( event, rc, prc ) {
+ var cache = settingsService.getSettingsCacheProvider();
var cacheKey = settingsService.getSettingsCacheKey();
// get Cached Settings
prc.settings = cache.get( cacheKey );
@@ -330,11 +355,11 @@ component extends="baseHandler" {
*
* @return html
*/
- function authLogs( event, rc, prc ){
- prc.featureEnabled = prc.cbsettings.cb_security_login_blocker;
- prc.xehTruncate = "#prc.cbAdminEntryPoint#.settings.truncateAuthLogs";
+ function authLogs( event, rc, prc ) {
+ prc.featureEnabled = prc.cbsettings.cb_security_login_blocker;
+ prc.xehTruncate = "#prc.cbAdminEntryPoint#.settings.truncateAuthLogs";
// Get all logs
- prc.logs = variables.loginTrackerService.getAll( sortOrder = "attempts", asQuery = false );
+ prc.logs = variables.loginTrackerService.getAll( sortOrder = "attempts", asQuery = false );
// Raw tab
prc.tabSystem_authLogs = true;
// View
@@ -344,9 +369,9 @@ component extends="baseHandler" {
/**
* truncate all auth logs
*/
- any function truncateAuthLogs( event, rc, prc ){
+ any function truncateAuthLogs( event, rc, prc ) {
variables.loginTrackerService.truncate();
relocate( "#prc.cbAdminEntryPoint#.settings.authLogs" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc b/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc
index 301f0132f6..fb51385a89 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/sites.cfc
@@ -2,16 +2,23 @@
* Manage ContentBox Sites
*/
component extends="baseHandler" {
-
// Dependencies
property name="siteService" inject="siteService@contentbox";
+
property name="themeService" inject="themeService@contentbox";
+
property name="pageService" inject="pageService@contentbox";
/**
* Pre handler
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabSystem = true;
}
@@ -19,13 +26,13 @@ component extends="baseHandler" {
/**
* Show sites
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Exit Handler
prc.xehSiteRemove = "#prc.cbAdminEntryPoint#.sites.remove";
prc.xehSiteEditor = "#prc.cbAdminEntryPoint#.sites.editor";
- prc.xehExportAll = "#prc.cbAdminEntryPoint#.sites.exportAll";
- prc.xehExport = "#prc.cbAdminEntryPoint#.sites.export";
- prc.xehImportAll = "#prc.cbAdminEntryPoint#.sites.importAll";
+ prc.xehExportAll = "#prc.cbAdminEntryPoint#.sites.exportAll";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.sites.export";
+ prc.xehImportAll = "#prc.cbAdminEntryPoint#.sites.importAll";
// get content pieces
prc.sites = variables.siteService.getAll( sortOrder = "name asc" );
@@ -40,7 +47,7 @@ component extends="baseHandler" {
/**
* Site Editor
*/
- function editor( event, rc, prc ){
+ function editor( event, rc, prc ) {
// tab
prc.tabSystem_sites = true;
// get new or persisted
@@ -50,12 +57,12 @@ component extends="baseHandler" {
// Get all registered themes
prc.themes = variables.themeService.getThemes();
// pages
- prc.pages = variables.pageService.search(
- sortOrder = "slug asc",
- isPublished = true,
- siteID = prc.site.getsiteID(),
- propertyList = "contentID,slug,title"
- ).pages;
+ prc.pages = variables.pageService.search(
+ sortOrder = "slug asc",
+ isPublished = true,
+ siteID = prc.site.getsiteID(),
+ propertyList = "contentID,slug,title"
+ ).pages;
prc.registeredDisks = cbfs()
.getDisks()
@@ -72,18 +79,21 @@ component extends="baseHandler" {
/**
* Save a Site
*/
- function save( event, rc, prc ){
+ function save( event, rc, prc ) {
// populate and get content
- prc.site = populate( model: variables.siteService.get( rc.siteID ), exclude: "siteID" );
+ prc.site = populate( model = variables.siteService.get( rc.siteID ), exclude = "siteID" );
// validate it
var vResults = validate( prc.site );
if ( !vResults.hasErrors() ) {
// announce event
- announce( "cbadmin_preSiteSave", { site : prc.site, siteID : rc.siteID } );
+ announce(
+ "cbadmin_preSiteSave",
+ { site: prc.site, siteID: rc.siteID }
+ );
// save rule
variables.siteService.save( prc.site );
// announce event
- announce( "cbadmin_postSiteSave", { site : prc.site } );
+ announce( "cbadmin_postSiteSave", { site: prc.site } );
// Message
cbMessageBox().info( "Site saved!" );
relocate( prc.xehSitesManager );
@@ -96,15 +106,15 @@ component extends="baseHandler" {
/**
* Remove a site
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
// Get requested site to remove
var oSite = variables.siteService.get( rc.siteID );
// announce event
- announce( "cbadmin_preSiteRemove", { site : oSite } );
+ announce( "cbadmin_preSiteRemove", { site: oSite } );
// Now delete it
variables.siteService.delete( oSite );
// announce event
- announce( "cbadmin_postSiteRemove", { siteID : rc.siteID } );
+ announce( "cbadmin_postSiteRemove", { siteID: rc.siteID } );
// Message
cbMessageBox().setMessage( "info", "Site Removed!" );
// relocate
@@ -114,7 +124,7 @@ component extends="baseHandler" {
/**
* Change current editing site
*/
- function changeSite( event, rc, prc ){
+ function changeSite( event, rc, prc ) {
variables.siteService.setCurrentWorkingsiteID( rc.siteID );
relocate( prc.xehDashboard );
}
@@ -122,16 +132,19 @@ component extends="baseHandler" {
/**
* Export a site
*/
- function export( event, rc, prc ){
+ 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" );
}
/**
* Export all sites
*/
- function exportAll( event, rc, prc ){
+ function exportAll( event, rc, prc ) {
// Set a high timeout for long exports
setting requestTimeout="9999";
return variables.siteService.getAllForExport();
@@ -140,21 +153,21 @@ component extends="baseHandler" {
/**
* Import sites
*/
- function importAll( event, 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 = variables.siteService.importFromFile(
- importFile = rc.importFile,
- override = rc.overrideContent
- );
+ if ( len( rc.importFile ) && fileExists( rc.importFile ) ) {
+ var importLog = variables.siteService.importFromFile( importFile = rc.importFile,
+ override = rc.overrideContent );
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 ) {
+ } catch (any e) {
rethrow;
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
@@ -163,4 +176,4 @@ component extends="baseHandler" {
relocate( prc.xehSitesManager );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/subscribers.cfc b/modules/contentbox/modules/contentbox-admin/handlers/subscribers.cfc
index 901a93ad0e..1ba9eccfc4 100644
--- a/modules/contentbox/modules/contentbox-admin/handlers/subscribers.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/subscribers.cfc
@@ -6,27 +6,33 @@
* Manage Comment subscriptions
*/
component extends="baseHandler" {
-
// Dependencies
- property name="commentSubscriptionService" inject="commentSubscriptionService@contentbox";
+ property
+ name="commentSubscriptionService"
+ inject="commentSubscriptionService@contentbox";
+
property name="subscriberService" inject="subscriberService@contentbox";
// pre handler
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabComments = true;
}
// index
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
prc.maxCommentSubscriptions = 4;
// queries for view
- prc.topCommentSubscriptions = commentSubscriptionService.getGroupedSubscriptions(
- max = prc.maxCommentSubscriptions
- );
- prc.commentSubscriptions = commentSubscriptionService.getGroupedSubscriptions();
+ prc.topCommentSubscriptions = commentSubscriptionService.getGroupedSubscriptions( max = prc.maxCommentSubscriptions );
+ prc.commentSubscriptions = commentSubscriptionService.getGroupedSubscriptions();
prc.commentSubscriptionCount = commentSubscriptionService.getGroupedSubscriptionCount();
- prc.uniqueSubscriberCount = subscriberService.getUniqueSubscriberCount();
+ prc.uniqueSubscriberCount = subscriberService.getUniqueSubscriberCount();
// tab
prc.tabComments_subscribers = true;
@@ -35,4 +41,4 @@ component extends="baseHandler" {
event.setView( "subscribers/index" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc b/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc
index 010103e2d2..def174e02b 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/themes.cfc
@@ -2,21 +2,21 @@
* Manage Themes
*/
component extends="baseHandler" {
-
// Dependencies
property name="themeService" inject="themeService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
/**
* Active Theme
*/
- function active( event, rc, prc ){
+ function active( event, rc, prc ) {
// exit Handlers
- prc.xehPreview = "#prc.cbEntryPoint#.__preview";
+ prc.xehPreview = "#prc.cbEntryPoint#.__preview";
prc.xehSaveSettings = "#prc.cbAdminEntryPoint#.themes.saveSettings";
// Get them info
- prc.activeTheme = variables.themeService.getActiveTheme();
+ prc.activeTheme = variables.themeService.getActiveTheme();
prc.themeService = variables.themeService;
// Tab
@@ -29,15 +29,15 @@ component extends="baseHandler" {
/**
* Manage themes
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
- prc.xehThemes = "#prc.cbAdminEntryPoint#.themes.index";
- prc.xehThemeRemove = "#prc.cbAdminEntryPoint#.themes.remove";
- prc.xehThemeUpload = "#prc.cbAdminEntryPoint#.themes.upload";
+ prc.xehThemes = "#prc.cbAdminEntryPoint#.themes.index";
+ prc.xehThemeRemove = "#prc.cbAdminEntryPoint#.themes.remove";
+ prc.xehThemeUpload = "#prc.cbAdminEntryPoint#.themes.upload";
prc.xehFlushRegistry = "#prc.cbAdminEntryPoint#.themes.rebuildRegistry";
- prc.xehActivate = "#prc.cbAdminEntryPoint#.themes.activate";
- prc.xehPreview = "#prc.cbEntryPoint#.__preview";
- prc.xehSaveSettings = "#prc.cbAdminEntryPoint#.themes.saveSettings";
+ prc.xehActivate = "#prc.cbAdminEntryPoint#.themes.activate";
+ prc.xehPreview = "#prc.cbEntryPoint#.__preview";
+ prc.xehSaveSettings = "#prc.cbAdminEntryPoint#.themes.saveSettings";
// Rescan if newly installed theme?
if ( event.getValue( "rescan", false ) ) {
@@ -45,8 +45,8 @@ component extends="baseHandler" {
}
// Get all layouts
- prc.themes = variables.themeService.getThemes();
- prc.activeTheme = variables.themeService.getActiveTheme();
+ prc.themes = variables.themeService.getThemes();
+ prc.activeTheme = variables.themeService.getActiveTheme();
prc.themeService = variables.themeService;
// Tab
@@ -59,11 +59,11 @@ component extends="baseHandler" {
/**
* Save theme settings
*/
- function saveSettings( event, rc, prc ){
+ function saveSettings( event, rc, prc ) {
prc.xehActiveTheme = "#prc.cbAdminEntryPoint#.themes.active";
- var vResults = validate(
- target : rc,
- constraints: variables.themeService.getSettingsConstraints( rc.themeName )
+ var vResults = validate(
+ target = rc,
+ constraints = variables.themeService.getSettingsConstraints( rc.themeName )
);
// Validate results
@@ -73,7 +73,7 @@ component extends="baseHandler" {
}
// Announce event
- announce( "cbadmin_preThemeSettingsSave", { name : rc.themeName } );
+ announce( "cbadmin_preThemeSettingsSave", { name: rc.themeName } );
// Results validated, save settings
variables.themeService.saveThemeSettings( name = rc.themeName, settings = rc );
@@ -81,7 +81,7 @@ component extends="baseHandler" {
cbMessageBox().info( message = "Theme settings saved!" );
// Announce event
- announce( "cbadmin_postThemeSettingsSave", { name : rc.themeName } );
+ announce( "cbadmin_postThemeSettingsSave", { name: rc.themeName } );
// Relocate
relocate( prc.xehActiveTheme );
@@ -90,7 +90,7 @@ component extends="baseHandler" {
/**
* Activate a theme for the site
*/
- function activate( event, rc, prc ){
+ function activate( event, rc, prc ) {
// Activate the theme
variables.themeService.activateTheme( rc.themeName );
// clear caches
@@ -104,7 +104,7 @@ component extends="baseHandler" {
/**
* Rebuild theme registry
*/
- function rebuildRegistry( event, rc, prc ){
+ function rebuildRegistry( event, rc, prc ) {
variables.themeService.buildThemeRegistry();
cbMessageBox().info( "Themes re-scanned and registered!" );
relocate( prc.xehThemes );
@@ -113,13 +113,15 @@ component extends="baseHandler" {
/**
* Remove a theme
*/
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
if ( variables.themeService.removeTheme( rc.themeName ) ) {
cbMessageBox().info( "Theme Removed Forever!" );
} else {
- cbMessageBox().error( "Error removing theme, please check your logs for more information!" );
+ cbMessageBox().error(
+ "Error removing theme, please check your logs for more information!"
+ );
}
relocate( prc.xehThemes );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc b/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc
index 97d7b32c13..2002eb68f3 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/tools.cfc
@@ -6,18 +6,29 @@
* Tools for ContentBox.
*/
component extends="baseHandler" {
-
// DI
property name="moduleService" inject="moduleService@contentbox";
+
property name="themeService" inject="themeService@contentbox";
+
property name="widgetService" inject="widgetService@contentbox";
+
property name="roleService" inject="roleService@contentbox";
+
property name="templateService" inject="emailtemplateService@contentbox";
+
property name="HTMLHelper" inject="HTMLHelper@coldbox";
+
property name="staticExporter" inject="staticExporter@contentbox";
// pre handler
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
prc.tabTools = true;
}
@@ -25,14 +36,14 @@ component extends="baseHandler" {
/**
* Import Into ContentBox
*/
- function importer( event, rc, prc ){
+ function importer( event, rc, prc ) {
// Exit Handler
- rc.xehDataImport = "#prc.cbAdminEntryPoint#.tools.doDataImport";
- rc.xehCBPreImport = "#prc.cbAdminEntryPoint#.tools.doCBPreImport";
- rc.xehCBImport = "#prc.cbAdminEntryPoint#.tools.doCBImport";
+ rc.xehDataImport = "#prc.cbAdminEntryPoint#.tools.doDataImport";
+ rc.xehCBPreImport = "#prc.cbAdminEntryPoint#.tools.doCBPreImport";
+ rc.xehCBImport = "#prc.cbAdminEntryPoint#.tools.doCBImport";
// tab
prc.tabTools_import = true;
- prc.roles = roleService.list( sortOrder = "role" );
+ prc.roles = roleService.list( sortOrder = "role" );
// view
event.setView( "tools/importer" );
}
@@ -40,7 +51,7 @@ component extends="baseHandler" {
/**
* Pre Import checks
*/
- function doCBPreImport( event, rc, prc ){
+ function doCBPreImport( event, rc, prc ) {
event.paramValue( "CBUpload", "" );
// make sure upload was valid
if ( len( rc.CBUpload ) && fileExists( rc.CBUpload ) ) {
@@ -48,19 +59,23 @@ component extends="baseHandler" {
importer.setup( importFile = rc.CBUpload );
// check validity of package
if ( importer.isValid() ) {
- prc.contents = deserializeJSON( importer.getDescriptorContents() );
+ prc.contents = deserializeJSON( importer.getDescriptorContents() );
// railo and acf dates don't get along...let's normalize them first
- var badDateRegex = " -\d{4}$";
- prc.contents.exportDate = reReplace( prc.contents.exportDate, badDateRegex, "" );
+ var badDateRegex = " -\d{4}$";
+ prc.contents.exportDate = reReplace(
+ prc.contents.exportDate,
+ badDateRegex,
+ ""
+ );
} else {
cbMessageBox().warn(
- "Sorry, the imported ContentBox package was not valid. Please verify you have the right file and try again."
- );
+ "Sorry, the imported ContentBox package was not valid. Please verify you have the right file and try again."
+ );
}
} else {
cbMessageBox().error(
- "Sorry, there was a problem verifying your ContentBox import package. Please try again."
- );
+ "Sorry, there was a problem verifying your ContentBox import package. Please try again."
+ );
}
event.setView( view = "tools/importerPreview", layout = "ajax" );
}
@@ -68,22 +83,24 @@ component extends="baseHandler" {
/**
* Import action
*/
- function doCBImport( event, rc, prc ){
+ function doCBImport( event, rc, prc ) {
event.paramValue( "CBUpload", "" );
event.paramValue( "overwrite", false );
try {
- if ( len( rc.CBUpload ) and fileExists( rc.CBUpload ) ) {
+ if ( len( rc.CBUpload ) && fileExists( rc.CBUpload ) ) {
var importer = getInstance( "ContentBoxImporter@contentbox" );
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." );
}
- } catch ( any e ) {
+ } catch (any e) {
var errorMessage = "Error importing file: #e.message# #e.detail# #e.stackTrace#";
log.error( errorMessage, e );
cbMessageBox().error( errorMessage );
@@ -94,7 +111,7 @@ component extends="baseHandler" {
/**
* Do a data import
*/
- function doDataImport( event, rc, prc ){
+ function doDataImport( event, rc, prc ) {
event.paramValue( "dsn", "" );
event.paramValue( "dsnUsername", "" );
event.paramValue( "dsnPassword", "" );
@@ -105,7 +122,7 @@ component extends="baseHandler" {
setting requesttimeout="18000";
// validate
- if ( !len( rc.dsn ) or !len( rc.defaultPassword ) ) {
+ if ( !len( rc.dsn ) || !len( rc.defaultPassword ) ) {
cbMessageBox().warn( "Please fill out all required fields." );
relocate( prc.xehToolsImport );
}
@@ -114,8 +131,10 @@ 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!" );
- } catch ( any e ) {
+ cbMessageBox().info(
+ "Content imported successfully! Please check out your ContentBox now!"
+ );
+ } catch (any e) {
cbMessageBox().error( "Error importing from datasource: #e.message# #e.detail#" );
}
@@ -125,18 +144,18 @@ component extends="baseHandler" {
/**
* Show the exporter console
*/
- function exporter( event, rc, prc ){
+ function exporter( event, rc, prc ) {
// Exit Handlers
- prc.xehExport = "#prc.cbAdminEntryPoint#.tools.doExport";
+ prc.xehExport = "#prc.cbAdminEntryPoint#.tools.doExport";
prc.xehPreviewExport = "#prc.cbAdminEntryPoint#.tools.previewExport";
prc.xehSiteGenerator = "#prc.cbAdminEntryPoint#.tools.doStaticSite";
// tab
prc.tabTools_export = true;
- prc.modules = variables.moduleService.findModules( moduleType = "custom" ).modules;
- prc.themes = variables.themeService.getCustomThemes();
- prc.widgets = variables.widgetService.getWidgets();
- prc.widgetService = variables.widgetService;
+ prc.modules = variables.moduleService.findModules( moduleType = "custom" ).modules;
+ prc.themes = variables.themeService.getCustomThemes();
+ prc.widgets = variables.widgetService.getWidgets();
+ prc.widgetService = variables.widgetService;
// view
event.setView( "tools/exporter" );
@@ -145,14 +164,19 @@ component extends="baseHandler" {
/**
* Preview of the export
*/
- function previewExport( event, rc, prc ){
+ function previewExport( event, rc, prc ) {
// get targets
- var targets = prepareExportTargets( rc );
+ var targets = prepareExportTargets( rc );
var contentBoxExporter = getInstance( "ContentBoxExporter@contentbox" );
// build up exporter instance from targets in rc
- prc.descriptor = contentBoxExporter.setup( targets ).getDescriptor();
+ prc.descriptor = contentBoxExporter.setup( targets ).getDescriptor();
// Sort the content
- prc.aSortedContent = structSort( prc.descriptor.content, "text", "asc", "name" );
+ prc.aSortedContent = structSort(
+ prc.descriptor.content,
+ "text",
+ "asc",
+ "name"
+ );
// render back the descriptor data as json
event.setView( view = "tools/exporterPreview", layout = "ajax" );
}
@@ -160,50 +184,50 @@ component extends="baseHandler" {
/**
* Process a real export
*/
- function doExport( event, rc, prc ){
+ function doExport( event, rc, prc ) {
// get targets
- var targets = prepareExportTargets( rc );
+ var targets = prepareExportTargets( rc );
var contentBoxExporter = getInstance( "ContentBoxExporter@contentbox" );
- var exportResult = contentBoxExporter.setup( targets ).export();
+ var exportResult = contentBoxExporter.setup( targets ).export();
// export the content
- var exportFilePath = exportResult.exportfile;
+ var exportFilePath = exportResult.exportfile;
// save success message
- var filename = variables.HTMLHelper.slugify( prc.oCurrentSite.getName() );
+ var filename = variables.HTMLHelper.slugify( prc.oCurrentSite.getName() );
// send it
event.sendFile(
- file : exportFilePath,
- name : fileName,
- mimetype : "application/zip",
- abortAtEnd: true
- );
+ file = exportFilePath,
+ name = fileName,
+ mimetype = "application/zip",
+ abortAtEnd = true
+ );
}
/**
* Export a static site
*/
- function doStaticSite( event, rc, prc ){
+ function doStaticSite( event, rc, prc ) {
event.paramValue( "blogContent", false );
// Export Site
var results = staticExporter.export(
- includeBlog = rc.blogContent,
- event = event,
- rc = rc,
- prc = prc,
- site = prc.oCurrentSite
- );
+ includeBlog = rc.blogContent,
+ event = event,
+ rc = rc,
+ prc = prc,
+ site = prc.oCurrentSite
+ );
// export the content
var exportFilePath = results.exportFile;
// save success message
- var filename = variables.HTMLHelper.slugify( prc.oCurrentSite.getName() );
+ var filename = variables.HTMLHelper.slugify( prc.oCurrentSite.getName() );
// send it
event.sendFile(
- file : exportFilePath,
- name : fileName,
- mimetype : "application/zip",
- abortAtEnd: true
- );
+ file = exportFilePath,
+ name = fileName,
+ mimetype = "application/zip",
+ abortAtEnd = true
+ );
}
/**************************************** PRIVATE ****************************************/
@@ -212,15 +236,26 @@ component extends="baseHandler" {
* Looks at incoming export variables and prepares correct target elements from
* the RC. Prefix is `EXPORT_`
*/
- private struct function prepareExportTargets( required struct rc ){
- return arguments.rc
- .filter( function( key, value ){
- return left( arguments.key, 7 ) == "EXPORT_";
- } )
- .reduce( function( results, key, value ){
- results[ replaceNoCase( arguments.key, "EXPORT_", "", "one" ) ] = arguments.value;
- return results;
- }, {} );
+ private struct function prepareExportTargets( required struct rc ) {
+ return arguments
+ .rc
+ .filter(
+ function( key, value ) {
+ return left( arguments.key, 7 ) == "EXPORT_";
+ }
+ )
+ .reduce(
+ function( results, key, value ) {
+ results[ replaceNoCase(
+ arguments.key,
+ "EXPORT_",
+ "",
+ "one"
+ ) ] = arguments.value;
+ return results;
+ },
+ {}
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc b/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc
index 19af9086ee..97ecc43b8d 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/versions.cfc
@@ -1,18 +1,20 @@
-/**
+/**
* Manage content versions
*/
component extends="baseHandler" {
-
// Dependencies
property name="contentVersionService" inject="contentVersionService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
+
property name="JSONPrettyPrint" inject="JSONPrettyPrint@JSONPrettyPrint";
/**
* Versions History Index
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// param contentID
event.paramValue( "contentID", "" );
// Get Content object
@@ -21,17 +23,17 @@ component extends="baseHandler" {
// Do according to type
switch ( prc.content.getContentType() ) {
case "Page": {
- prc.xehBackTrack = "#prc.cbAdminEntryPoint#.pages";
+ prc.xehBackTrack = "#prc.cbAdminEntryPoint#.pages";
prc.xehOpenContent = CBHelper.linkContent( prc.content );
break;
}
case "Entry": {
- prc.xehBackTrack = "#prc.cbAdminEntryPoint#.entries";
+ prc.xehBackTrack = "#prc.cbAdminEntryPoint#.entries";
prc.xehOpenContent = CBHelper.linkContent( prc.content );
break;
}
case "ContentStore": {
- prc.xehBackTrack = "#prc.cbAdminEntryPoint#.contentStore";
+ prc.xehBackTrack = "#prc.cbAdminEntryPoint#.contentStore";
prc.xehOpenContent = "";
break;
}
@@ -41,7 +43,14 @@ component extends="baseHandler" {
announce( "cbadmin_onVersionIndex" );
// Pager with all versions
- prc.versionsPager = pager( event, rc, prc, rc.contentID, 0, false );
+ prc.versionsPager = pager(
+ event,
+ rc,
+ prc,
+ rc.contentID,
+ 0,
+ false
+ );
// view
event.setView( "versions/index" );
@@ -61,31 +70,31 @@ component extends="baseHandler" {
required contentID,
numeric max = 10,
boolean viewFullHistory = true
- ){
+ ) {
// Incoming
- prc.versionsPager_max = arguments.max;
- prc.versionsPager_contentID = arguments.contentID;
+ prc.versionsPager_max = arguments.max;
+ prc.versionsPager_contentID = arguments.contentID;
prc.versionsPager_viewFullHistory = arguments.viewFullHistory;
// Get Content
prc.versionsPager_content = contentService.get( arguments.contentID );
// Get the latest versions
- var results = contentVersionService.findRelatedVersions( contentID = arguments.contentID, max = arguments.max );
- prc.versionsPager_count = results.count;
+ var results = contentVersionService.findRelatedVersions( contentID = arguments.contentID, max = arguments.max );
+ prc.versionsPager_count = results.count;
prc.versionsPager_versions = results.versions;
// nice UI number
- if ( prc.versionsPager_max gt prc.versionsPager_count ) {
+ if ( prc.versionsPager_max GT prc.versionsPager_count ) {
prc.versionsPager_max = prc.versionsPager_count;
}
// exit handlers
prc.xehVersionQuickLook = "#prc.cbAdminEntryPoint#.versions.quickLook";
- prc.xehVersionHistory = "#prc.cbAdminEntryPoint#.versions.index";
- prc.xehVersionRemove = "#prc.cbAdminEntryPoint#.versions.remove";
- prc.xehVersionRollback = "#prc.cbAdminEntryPoint#.versions.rollback";
- prc.xehVersionDiff = "#prc.cbAdminEntryPoint#.versions.diff";
+ prc.xehVersionHistory = "#prc.cbAdminEntryPoint#.versions.index";
+ prc.xehVersionRemove = "#prc.cbAdminEntryPoint#.versions.remove";
+ prc.xehVersionRollback = "#prc.cbAdminEntryPoint#.versions.rollback";
+ prc.xehVersionDiff = "#prc.cbAdminEntryPoint#.versions.diff";
// render out widget
return view( view = "versions/pager", module = "contentbox-admin" );
@@ -94,7 +103,7 @@ component extends="baseHandler" {
/**
* Version quick look
*/
- function quickLook( event, rc, prc ){
+ function quickLook( event, rc, prc ) {
// get content version
prc.contentVersion = contentVersionService.get( event.getValue( "versionID", 0 ) );
event.setView( view = "versions/quickLook", layout = "ajax" );
@@ -103,22 +112,28 @@ component extends="baseHandler" {
/**
* Remove permanently a version
*/
- function remove( event, rc, prc ){
- var results = { "ERROR" : false, "MESSAGES" : "" };
+ function remove( event, rc, prc ) {
+ var results = { "ERROR": false, "MESSAGES": "" };
event.paramValue( "versionID", "" );
// check for length
if ( len( rc.versionID ) ) {
// announce event
- announce( "cbadmin_preContentVersionRemove", { contentVersionID : rc.versionID } );
+ announce(
+ "cbadmin_preContentVersionRemove",
+ { contentVersionID: rc.versionID }
+ );
// remove using hibernate bulk
contentVersionService.deleteByID( rc.versionID );
// announce event
- announce( "cbadmin_postContentVersionRemove", { contentVersionID : rc.versionID } );
+ announce(
+ "cbadmin_postContentVersionRemove",
+ { contentVersionID: rc.versionID }
+ );
// results
results.messages = "Version removed!";
} else {
- results.error = true;
+ results.error = true;
results.messages = "No versionID sent to remove!";
}
// return in json
@@ -128,18 +143,19 @@ component extends="baseHandler" {
/**
* Rollback a version
*/
- function rollback( event, rc, prc ){
- var results = { "ERROR" : false, "MESSAGES" : "" };
+ function rollback( event, rc, prc ) {
+ var results = { "ERROR": false, "MESSAGES": "" };
event.paramValue( "revertID", "" );
// get version
var oVersion = contentVersionService.get( rc.revertID );
if ( !isNull( oVersion ) ) {
// announce event
- announce( "cbadmin_preContentVersionRollback", { contentVersion : oVersion } );
+ announce(
+ "cbadmin_preContentVersionRollback",
+ { contentVersion: oVersion }
+ );
// Try to revert this version
- oVersion
- .getRelatedContent()
- .addNewContentVersion(
+ oVersion.getRelatedContent().addNewContentVersion(
content = oVersion.getContent(),
changelog = "Reverting to version #oVersion.getVersion()#",
author = prc.oCurrentAuthor
@@ -147,11 +163,14 @@ component extends="baseHandler" {
// save
contentVersionService.save( oVersion );
// announce event
- announce( "cbadmin_postContentVersionRollback", { contentVersion : oVersion } );
+ announce(
+ "cbadmin_postContentVersionRollback",
+ { contentVersion: oVersion }
+ );
// results
results.messages = "Version #oVersion.getVersion()# rollback was successfull!";
} else {
- results.error = true;
+ results.error = true;
results.messages = "The versionID sent is not valid!";
}
// return in json
@@ -161,20 +180,20 @@ component extends="baseHandler" {
/**
* Diff different versions
*/
- function diff( event, rc, prc ){
+ function diff( event, rc, prc ) {
// exit handlers
prc.xehVersionDiff = "#prc.cbAdminEntryPoint#.versions.diff";
// Get the Page content
prc.currentContent = variables.contentVersionService.get( rc.version );
- prc.oldContent = variables.contentVersionService.get( rc.oldVersion );
+ prc.oldContent = variables.contentVersionService.get( rc.oldVersion );
prc.currentVersion = prc.currentContent.getVersion();
- prc.oldVersion = prc.oldContent.getVersion();
+ prc.oldVersion = prc.oldContent.getVersion();
// Diff them
- prc.leftA = listToArray( prc.oldContent.getContent(), chr( 10 ) );
+ prc.leftA = listToArray( prc.oldContent.getContent(), chr( 10 ) );
prc.rightA = listToArray( prc.currentContent.getContent(), chr( 10 ) );
- prc.diff = "";
+ prc.diff = "";
// Manual setup just in case
if ( arrayLen( prc.leftA ) GT arrayLen( prc.rightA ) ) {
@@ -189,4 +208,4 @@ component extends="baseHandler" {
event.setView( view = "versions/diff", layout = "ajax" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc b/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc
index fe50253267..0d9d6be257 100755
--- a/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc
+++ b/modules/contentbox/modules/contentbox-admin/handlers/widgets.cfc
@@ -6,30 +6,35 @@
* Manage widgets
*/
component extends="baseHandler" {
-
// Dependencies
property name="widgetService" inject="widgetService@contentbox";
// pre handler
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
// Tab control
- prc.tabLookAndFeel = true;
+ prc.tabLookAndFeel = true;
prc.tabLookAndFeel_widgets = true;
}
// index
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// exit Handlers
prc.xehWidgetRemove = "#prc.cbAdminEntryPoint#.widgets.remove";
prc.xehWidgetUpload = "#prc.cbAdminEntryPoint#.widgets.upload";
- prc.xehWidgetDocs = "#prc.cbAdminEntryPoint#.widgets.docs";
+ prc.xehWidgetDocs = "#prc.cbAdminEntryPoint#.widgets.docs";
prc.xehWidgetEditor = "#prc.cbAdminEntryPoint#.widgets.edit";
prc.xehWidgetCreate = "#prc.cbAdminEntryPoint#.widgets.create";
- prc.xehWidgetTest = "#prc.cbAdminEntryPoint#.widgets.viewWidgetInstance";
+ prc.xehWidgetTest = "#prc.cbAdminEntryPoint#.widgets.viewWidgetInstance";
// Get all widgets
- prc.widgets = widgetService.getWidgets();
- prc.categories = widgetService.getWidgetCategories();
+ prc.widgets = widgetService.getWidgets();
+ prc.categories = widgetService.getWidgetCategories();
prc.widgetService = widgetService;
// view
@@ -37,50 +42,58 @@ component extends="baseHandler" {
}
// docs
- function docs( event, rc, prc ){
+ function docs( event, rc, prc ) {
prc.widgetName = widgetService.ripExtension( urlDecode( rc.widget ) );
prc.widgetType = urlDecode( rc.type );
- prc.icon = widgetService.getWidgetIcon( rc.widget, rc.type );
+ prc.icon = widgetService.getWidgetIcon( rc.widget, rc.type );
// get widget
- prc.oWidget = widgetService.getWidget( prc.widgetName, prc.widgetType );
+ prc.oWidget = widgetService.getWidget( prc.widgetName, prc.widgetType );
// get its metadata
- prc.metadata = prc.oWidget.getPublicMethods();
+ prc.metadata = prc.oWidget.getPublicMethods();
// presetn view
event.setView( view = "widgets/docs", layout = "ajax" );
}
// Remove
- function remove( event, rc, prc ){
+ function remove( event, rc, prc ) {
widgetService.removeWidget( rc.widgetFile );
cbMessageBox().info( "Widget Removed Forever!" );
relocate( prc.xehWidgets );
}
-
-
// Editor Selector
- function editorSelector( event, rc, prc ){
+ function editorSelector( event, rc, prc ) {
// Get all widgets, categories and setup the service on context
- prc.widgets = widgetService.getWidgets();
- prc.categories = widgetService.getWidgetCategories();
+ prc.widgets = widgetService.getWidgets();
+ prc.categories = widgetService.getWidgetCategories();
prc.widgetService = widgetService;
// render it out
event.setView( view = "widgets/editorSelector", layout = "ajax" );
}
// Preview Widget
- function preview( event, rc, prc ){
+ function preview( event, rc, prc ) {
// get widget
var widget = WidgetService.getWidget( name = rc.widgetname, type = rc.widgettype );
try {
- event.renderData( data = invoke( widget, rc.widgetudf, rc ), type = "html" );
- } catch ( any e ) {
+ 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"
+ );
}
}
- function viewWidgetInstance( event, rc, prc ){
+ function viewWidgetInstance( event, rc, prc ) {
// param data
event
.paramValue( "modal", false )
@@ -89,23 +102,31 @@ component extends="baseHandler" {
// get widget
var widget = widgetService.getWidget( name = rc.widgetname, type = rc.widgettype );
- prc.md = widgetService.getWidgetRenderArgs(
- udf = rc.widgetudf,
- widget = rc.widgetname,
- type = rc.widgettype
- );
+ prc.md = widgetService.getWidgetRenderArgs(
+ udf = rc.widgetudf,
+ widget = rc.widgetname,
+ type = rc.widgettype
+ );
prc.widget = {
- name : rc.widgetname,
- widgetType : rc.widgettype,
- widget : widget,
- udf : rc.widgetudf,
- module : find( "@", rc.widgetname ) ? listGetAt( rc.widgetname, 2, "@" ) : "",
- category : !isNull( widget.getCategory() ) ? widget.getCategory() : rc.widgetType == "Core" ? "Miscellaneous" : rc.widgetType,
- icon : !isNull( widget.getIcon() ) ? widget.getIcon() : ""
+ name : rc.widgetname,
+ widgetType: rc.widgettype,
+ widget : widget,
+ udf : rc.widgetudf,
+ module : find( "@", rc.widgetname )
+ ? listGetAt(
+ rc.widgetname,
+ 2,
+ "@"
+ )
+ : "",
+ category: !isNull( widget.getCategory() )
+ ? widget.getCategory()
+ : rc.widgetType == "Core" ? "Miscellaneous" : rc.widgetType,
+ icon: !isNull( widget.getIcon() ) ? widget.getIcon() : ""
};
// get its metadata
- prc.metadata = widget.getPublicMethods();
- prc.vals = rc;
+ prc.metadata = widget.getPublicMethods();
+ prc.vals = rc;
prc.vals[ "widgetUDF" ] = prc.widget.udf;
if ( event.isAjax() ) {
event.renderData( data = view( view = "widgets/instance", layout = "ajax" ) );
@@ -114,4 +135,4 @@ component extends="baseHandler" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/helpers/Mixins.cfm b/modules/contentbox/modules/contentbox-admin/helpers/Mixins.cfm
index 15a4151e61..c6db77ed8e 100644
--- a/modules/contentbox/modules/contentbox-admin/helpers/Mixins.cfm
+++ b/modules/contentbox/modules/contentbox-admin/helpers/Mixins.cfm
@@ -7,19 +7,19 @@
*
* @return The rendered component
*/
- function cbAdminComponent( required component, struct args = {} ){
+ function cbAdminComponent( required component, struct args = {} ) {
return view(
- view : "_components/#arguments.component#",
- args : arguments.args,
- prePostExempt : true,
- module : "contentbox-admin"
+ view = "_components/#arguments.component#",
+ args = arguments.args,
+ prePostExempt = true,
+ module = "contentbox-admin"
);
}
/**
* Shortcut to cbAdminComponent()
*/
- function $cbc(){
+ function $cbc() {
return cbAdminComponent( argumentCollection = arguments );
}
@@ -28,15 +28,17 @@
*
* @param fileName The name of the file to get the path for within the admin module
*/
- function cbAdminElixirPath( required fileName ){
- var moduleRoot = event.getModuleRoot( "contentbox-admin" );
- var manifest = getCache( "template" ).getOrSet(
- "cbAdminElixirManifest",
- () => deserializeJSON( fileRead( expandPath( moduleRoot & "/includes/rev-manifest.json" ) ) )
- );
+ function cbAdminElixirPath( required fileName ) {
+ var moduleRoot = event.getModuleRoot( "contentbox-admin" );
+ var manifest = getCache( "template" ).getOrSet(
+ "cbAdminElixirManifest",
+ () => deserializeJSON(
+ fileRead( expandPath( moduleRoot & "/includes/rev-manifest.json" ) )
+ )
+ );
var qualifiedPath = right( moduleRoot, len( moduleRoot ) - 1 ) & "/includes/" & fileName;
- return manifest.keyExists( qualifiedPath ) ? manifest[ qualifiedPath ] : '/' & qualifiedPath;
+ return manifest.keyExists( qualifiedPath ) ? manifest[ qualifiedPath ] : "/" & qualifiedPath;
}
diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc
index da29a99c65..bc0948a47e 100755
--- a/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc
+++ b/modules/contentbox/modules/contentbox-admin/interceptors/CBRequest.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,27 +6,35 @@
* This simulates the onRequest start for the admin interface
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="securityService" inject="securityService@contentbox";
+
property name="settingService" inject="settingService@contentbox";
+
property name="siteService" inject="siteService@contentbox";
+
property name="adminMenuService" inject="adminMenuService@contentbox";
+
property name="cbHelper" inject="CBHelper@contentbox";
/**
* Configure CB Request
*/
- function configure(){
+ function configure() {
variables.childModulesRegex = arrayToList( getModuleConfig( "contentbox-admin" ).childModules, "|" );
}
/**
* Fired on ContentBox Admin and Child Module requests
*/
- function preProcess( event, data, rc, prc ){
+ function preProcess( event, data, rc, prc ) {
// Only execute for admin or child modules
- if ( !reFindNoCase( "^(contentbox-admin|#variables.childModulesRegex#)", event.getCurrentEvent() ) ) {
+ if (
+ !reFindNoCase(
+ "^(contentbox-admin|#variables.childModulesRegex#)",
+ event.getCurrentEvent()
+ )
+ ) {
return;
}
@@ -38,11 +46,11 @@ component extends="coldbox.system.Interceptor" {
/************************************** SETUP CONTEXT REQUEST *********************************************/
// store module root
- prc.cbRoot = getContextRoot() & event.getModuleRoot( "contentbox-admin" );
+ prc.cbRoot = getContextRoot() & event.getModuleRoot( "contentbox-admin" );
// cb helper
- prc.CBHelper = variables.cbHelper;
+ prc.CBHelper = variables.cbHelper;
// store admin module entry point
- prc.cbAdminEntryPoint = getModuleConfig( "contentbox-admin" ).entryPoint;
+ prc.cbAdminEntryPoint = getModuleConfig( "contentbox-admin" ).entryPoint;
// store filebrowser entry point
prc.cbFileBrowserEntryPoint = getModuleConfig( "contentbox-filebrowser" ).entryPoint;
// store site entry point if loaded
@@ -52,18 +60,18 @@ component extends="coldbox.system.Interceptor" {
prc.cbEntryPoint = "";
}
// Place all sites in prc for usage by the UI switcher
- prc.allSites = variables.siteService.getAllFlat( isActive: true );
+ prc.allSites = variables.siteService.getAllFlat( isActive = true );
// Get the current working site object on PRC
- prc.oCurrentSite = variables.siteService.getCurrentWorkingSite();
+ prc.oCurrentSite = variables.siteService.getCurrentWorkingSite();
// Place global cb options on scope
- prc.cbSettings = variables.settingService.getAllSettings();
- prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() );
+ prc.cbSettings = variables.settingService.getAllSettings();
+ prc.cbSiteSettings = variables.settingService.getAllSiteSettings( prc.oCurrentSite.getSlug() );
// Place widgets root location
- prc.cbWidgetRoot = getContextRoot() & event.getModuleRoot( "contentbox" ) & "/widgets";
+ prc.cbWidgetRoot = getContextRoot() & event.getModuleRoot( "contentbox" ) & "/widgets";
// store admin menu service
prc.adminMenuService = variables.adminMenuService;
// Sidemenu collapsed
- prc.sideMenuClass = "";
+ prc.sideMenuClass = "";
// Is sidemenu collapsed for user?
if ( prc.oCurrentAuthor.getPreference( "sidemenuCollapse", false ) == "true" ) {
@@ -72,83 +80,83 @@ component extends="coldbox.system.Interceptor" {
/************************************** FORCE SSL *********************************************/
- if ( prc.cbSettings.cb_admin_ssl and !event.isSSL() ) {
+ if ( prc.cbSettings.cb_admin_ssl && !event.isSSL() ) {
relocate( event = event.getCurrentRoutedURL(), ssl = true );
}
/************************************** FORCE PASSWORD RESET *********************************************/
if (
- !findNoCase( "contentbox-security:security", event.getCurrentEvent() )
- &&
- prc.oCurrentAuthor.getIsPasswordReset()
+ !findNoCase( "contentbox-security:security", event.getCurrentEvent() ) &&
+ prc.oCurrentAuthor.getIsPasswordReset()
) {
var token = securityService.generateResetToken( prc.oCurrentAuthor );
- getInstance( "messagebox@cbMessagebox" ).info(
- prc.CBHelper.r( "messages.password_reset_detected@security" )
+ getInstance( "messagebox@cbMessagebox" ).info( prc.CBHelper.r( "messages.password_reset_detected@security" ) );
+ relocate(
+ event = "#prc.cbAdminEntryPoint#.security.verifyReset",
+ queryString = "token=#token#"
);
- relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#token#" );
return;
}
/************************************** NAVIGATION EXIT HANDLERS *********************************************/
// Global Admin Exit Handlers
- prc.xehDashboard = "#prc.cbAdminEntryPoint#.dashboard";
- prc.xehAbout = "#prc.cbAdminEntryPoint#.dashboard.about";
+ prc.xehDashboard = "#prc.cbAdminEntryPoint#.dashboard";
+ prc.xehAbout = "#prc.cbAdminEntryPoint#.dashboard.about";
// Entries Tab
- prc.xehEntries = "#prc.cbAdminEntryPoint#.entries";
- prc.xehEntriesEditor = "#prc.cbAdminEntryPoint#.entries.editor";
- prc.xehCategories = "#prc.cbAdminEntryPoint#.categories";
- prc.xehTemplates = "#prc.cbAdminEntryPoint#.contentTemplates";
+ prc.xehEntries = "#prc.cbAdminEntryPoint#.entries";
+ prc.xehEntriesEditor = "#prc.cbAdminEntryPoint#.entries.editor";
+ prc.xehCategories = "#prc.cbAdminEntryPoint#.categories";
+ prc.xehTemplates = "#prc.cbAdminEntryPoint#.contentTemplates";
// Content Tab
- prc.xehPages = "#prc.cbAdminEntryPoint#.pages";
- prc.xehPagesEditor = "#prc.cbAdminEntryPoint#.pages.editor";
- prc.xehContentStore = "#prc.cbAdminEntryPoint#.contentStore";
- prc.xehContentStoreEditor = "#prc.cbAdminEntryPoint#.contentStore.editor";
- prc.xehMediaManager = "#prc.cbAdminEntryPoint#.mediamanager";
- prc.xehMenuManager = "#prc.cbAdminEntryPoint#.menus";
- prc.xehMenuManagerEditor = "#prc.cbAdminEntryPoint#.menus.editor";
+ prc.xehPages = "#prc.cbAdminEntryPoint#.pages";
+ prc.xehPagesEditor = "#prc.cbAdminEntryPoint#.pages.editor";
+ prc.xehContentStore = "#prc.cbAdminEntryPoint#.contentStore";
+ prc.xehContentStoreEditor = "#prc.cbAdminEntryPoint#.contentStore.editor";
+ prc.xehMediaManager = "#prc.cbAdminEntryPoint#.mediamanager";
+ prc.xehMenuManager = "#prc.cbAdminEntryPoint#.menus";
+ prc.xehMenuManagerEditor = "#prc.cbAdminEntryPoint#.menus.editor";
// Comments Tab
- prc.xehComments = "#prc.cbAdminEntryPoint#.comments";
- prc.xehCommentsettings = "#prc.cbAdminEntryPoint#.comments.settings";
+ prc.xehComments = "#prc.cbAdminEntryPoint#.comments";
+ prc.xehCommentsettings = "#prc.cbAdminEntryPoint#.comments.settings";
// Look and Feel Tab
- prc.xehThemes = "#prc.cbAdminEntryPoint#.themes";
- prc.xehWidgets = "#prc.cbAdminEntryPoint#.widgets";
- prc.xehGlobalHTML = "#prc.cbAdminEntryPoint#.globalHTML";
+ prc.xehThemes = "#prc.cbAdminEntryPoint#.themes";
+ prc.xehWidgets = "#prc.cbAdminEntryPoint#.widgets";
+ prc.xehGlobalHTML = "#prc.cbAdminEntryPoint#.globalHTML";
// Modules
- prc.xehModules = "#prc.cbAdminEntryPoint#.modules";
+ prc.xehModules = "#prc.cbAdminEntryPoint#.modules";
// Authors Tab
- prc.xehAuthors = "#prc.cbAdminEntryPoint#.authors";
- prc.xehAuthorNew = "#prc.cbAdminEntryPoint#.authors.new";
- prc.xehAuthorEditor = "#prc.cbAdminEntryPoint#.authors.editor";
- prc.xehPermissions = "#prc.cbAdminEntryPoint#.permissions";
- prc.xehPermissionGroups = "#prc.cbAdminEntryPoint#.permissionGroups";
- prc.xehRoles = "#prc.cbAdminEntryPoint#.roles";
- prc.xehSavePreference = "#prc.cbAdminEntryPoint#.authors.saveSinglePreference";
+ prc.xehAuthors = "#prc.cbAdminEntryPoint#.authors";
+ prc.xehAuthorNew = "#prc.cbAdminEntryPoint#.authors.new";
+ prc.xehAuthorEditor = "#prc.cbAdminEntryPoint#.authors.editor";
+ prc.xehPermissions = "#prc.cbAdminEntryPoint#.permissions";
+ prc.xehPermissionGroups = "#prc.cbAdminEntryPoint#.permissionGroups";
+ prc.xehRoles = "#prc.cbAdminEntryPoint#.roles";
+ prc.xehSavePreference = "#prc.cbAdminEntryPoint#.authors.saveSinglePreference";
// Tools
- prc.xehToolsImport = "#prc.cbAdminEntryPoint#.tools.importer";
+ prc.xehToolsImport = "#prc.cbAdminEntryPoint#.tools.importer";
// System
- prc.xehSettings = "#prc.cbAdminEntryPoint#.settings";
- prc.xehSitesManager = "#prc.cbAdminEntryPoint#.sites";
- prc.xehChangeSite = "#prc.cbAdminEntryPoint#.sites.changeSite";
- prc.xehSecurityRules = "#prc.cbAdminEntryPoint#.securityrules";
- prc.xehRawSettings = "#prc.cbAdminEntryPoint#.settings.raw";
+ prc.xehSettings = "#prc.cbAdminEntryPoint#.settings";
+ prc.xehSitesManager = "#prc.cbAdminEntryPoint#.sites";
+ prc.xehChangeSite = "#prc.cbAdminEntryPoint#.sites.changeSite";
+ prc.xehSecurityRules = "#prc.cbAdminEntryPoint#.securityrules";
+ prc.xehRawSettings = "#prc.cbAdminEntryPoint#.settings.raw";
// Stats
- prc.xehSubscribers = "#prc.cbAdminEntryPoint#.subscribers";
+ prc.xehSubscribers = "#prc.cbAdminEntryPoint#.subscribers";
// Login/Logout
- prc.xehDoLogout = "#prc.cbAdminEntryPoint#.security.doLogout";
- prc.xehLogin = "#prc.cbAdminEntryPoint#.security.login";
+ prc.xehDoLogout = "#prc.cbAdminEntryPoint#.security.doLogout";
+ prc.xehLogin = "#prc.cbAdminEntryPoint#.security.login";
// CK Editor Integration Handlers For usage with the Quick Post
- prc.xehCKFileBrowserURL = "#prc.cbAdminEntryPoint#/ckfilebrowser/";
+ prc.xehCKFileBrowserURL = "#prc.cbAdminEntryPoint#/ckfilebrowser/";
prc.xehCKFileBrowserURLImage = "#prc.cbAdminEntryPoint#/ckfilebrowser/";
prc.xehCKFileBrowserURLFlash = "#prc.cbAdminEntryPoint#/ckfilebrowser/";
// Search global
- prc.xehSearchGlobal = "#prc.cbAdminEntryPoint#.content.search";
+ prc.xehSearchGlobal = "#prc.cbAdminEntryPoint#.content.search";
// Prepare Admin Actions
- prc.xehAdminAction = "#prc.cbAdminEntryPoint#.dashboard.reload";
+ prc.xehAdminAction = "#prc.cbAdminEntryPoint#.dashboard.reload";
// Installer Check
- prc.installerCheck = variables.settingService.isInstallationPresent();
+ prc.installerCheck = variables.settingService.isInstallationPresent();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/CheckForForceTwoFactorEnrollment.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/CheckForForceTwoFactorEnrollment.cfc
index 584c2763ff..913f7d8ae2 100644
--- a/modules/contentbox/modules/contentbox-admin/interceptors/CheckForForceTwoFactorEnrollment.cfc
+++ b/modules/contentbox/modules/contentbox-admin/interceptors/CheckForForceTwoFactorEnrollment.cfc
@@ -6,11 +6,10 @@
* Checks for two factor enforcement
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="twoFactorService" inject="id:TwoFactorService@contentbox";
- property name="securityService" inject="id:securityService@contentbox";
+ property name="securityService" inject="id:securityService@contentbox";
// static ecluded event patterns
variables.EXCLUDED_EVENT_PATTERNS = [
"contentbox-security:security.changeLang",
@@ -23,11 +22,11 @@ component extends="coldbox.system.Interceptor" {
"contentbox-security:security.doPasswordChange"
];
-
/**
* Configure
*/
- function configure(){
+ function configure() {
+
}
/**
@@ -39,7 +38,7 @@ component extends="coldbox.system.Interceptor" {
buffer,
rc,
prc
- ){
+ ) {
// Do not execute on the security module
if ( reFindNoCase( "^contentbox\-security\:", event.getCurrentEvent() ) ) {
return;
@@ -58,7 +57,6 @@ component extends="coldbox.system.Interceptor" {
return;
}
-
// User already enrolled
if ( prc.oCurrentAuthor.getIs2FactorAuth() ) {
return;
@@ -74,4 +72,4 @@ component extends="coldbox.system.Interceptor" {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc
index 39c3b2911a..a6018a6439 100644
--- a/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc
+++ b/modules/contentbox/modules/contentbox-admin/interceptors/MenuCleanup.cfc
@@ -6,101 +6,134 @@
* Menu cleanup interceptor
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="menuItemService" inject="id:menuItemService@contentbox";
/**
* Configure
*/
- function configure(){
+ function configure() {
+
}
/**
* Fires after the save of a page
* Will cleanup any slug changes for menus
*/
- function cbadmin_postPageSave( required any event, required struct data ){
- var criteria = menuItemService.newCriteria();
+ function cbadmin_postPageSave( required any event, required struct data ) {
+ var criteria = menuItemService.newCriteria();
var menuItemsInNeed = criteria.isEq( "contentSlug", "#arguments.data.originalSlug#" ).list();
for ( var menuItem in menuItemsInNeed ) {
- menuItem.setContentSlug( arguments.data.content.getSlug() );
+ menuItem.setContentSlug( arguments
+ .data
+ .content
+ .getSlug() );
menuItemService.save( entity = menuItem );
}
}
+
/**
* Fires before deletion of a page
* Will cleanup any slug changes for menus
*/
- function cbadmin_prePageRemove( required any event, required struct data ){
- var criteria = menuItemService.newCriteria();
- var menuItemsInNeed = criteria.isEq( "contentSlug", "#arguments.data.content.getSlug()#" ).list();
+ function cbadmin_prePageRemove( required any event, required struct data ) {
+ var criteria = menuItemService.newCriteria();
+ var menuItemsInNeed = criteria.isEq(
+ "contentSlug",
+ "#arguments
+ .data
+ .content
+ .getSlug()#"
+ ).list();
for ( var menuItem in menuItemsInNeed ) {
menuItem.setContentSlug( javacast( "null", "" ) );
menuItem.setActive( false );
menuItemService.save( entity = menuItem );
}
}
+
/**
* Fires after the save of an entry
* Will cleanup any slug changes for menus
*/
- function cbadmin_postEntrySave( required any event, required struct data ){
- var criteria = menuItemService.newCriteria();
+ function cbadmin_postEntrySave( required any event, required struct data ) {
+ var criteria = menuItemService.newCriteria();
var menuItemsInNeed = criteria.isEq( "contentSlug", "#arguments.data.originalSlug#" ).list();
for ( var menuItem in menuItemsInNeed ) {
- menuItem.setContentSlug( arguments.data.content.getSlug() );
+ menuItem.setContentSlug( arguments
+ .data
+ .content
+ .getSlug() );
menuItemService.save( entity = menuItem );
}
}
+
/**
* Fires before deletion of an entry
* Will cleanup any slug changes for menus
*/
- function cbadmin_preEntryRemove( required any event, required struct data ){
- var criteria = menuItemService.newCriteria();
- var menuItemsInNeed = criteria.isEq( "contentSlug", "#arguments.data.content.getSlug()#" ).list();
+ function cbadmin_preEntryRemove( required any event, required struct data ) {
+ var criteria = menuItemService.newCriteria();
+ var menuItemsInNeed = criteria.isEq(
+ "contentSlug",
+ "#arguments
+ .data
+ .content
+ .getSlug()#"
+ ).list();
for ( var menuItem in menuItemsInNeed ) {
menuItem.setContentSlug( javacast( "null", "" ) );
menuItem.setActive( false );
menuItemService.save( entity = menuItem );
}
}
+
/**
* Fires after the save of a menu
* Will cleanup any slug changes for child menus
*/
- function cbadmin_postMenuSave( required any event, required struct data ){
+ function cbadmin_postMenuSave( required any event, required struct data ) {
// Update all affected menuitems if any on slug updates
- var criteria = menuItemService.newCriteria();
+ var criteria = menuItemService.newCriteria();
var menuItems = criteria.isEq( "menuSlug", "#arguments.data.originalSlug#" ).list();
for ( var item in menuItems ) {
- item.setMenuSlug( arguments.data.menu.getSlug() );
+ item.setMenuSlug( arguments
+ .data
+ .menu
+ .getSlug() );
menuItemService.save( entity = item );
}
}
+
/**
* Fires before deletion of a menu
* Will cleanup any slug changes for menus
*/
- function cbadmin_preMenuRemove( required any event, required struct data ){
- var criteria = menuItemService.newCriteria();
- var menuItemsInNeed = criteria.isEq( "menuSlug", "#arguments.data.menu.getSlug()#" ).list();
+ function cbadmin_preMenuRemove( required any event, required struct data ) {
+ var criteria = menuItemService.newCriteria();
+ var menuItemsInNeed = criteria.isEq(
+ "menuSlug",
+ "#arguments
+ .data
+ .menu
+ .getSlug()#"
+ ).list();
for ( var menuItem in menuItemsInNeed ) {
menuItem.setMenuSlug( javacast( "null", "" ) );
menuItem.setActive( false );
menuItemService.save( entity = menuItem );
}
}
+
/**
* Fires after the rename of a media item
* Will cleanup any name changes for menus
*/
- function fb_postFileRename( required any event, required struct data ){
+ function fb_postFileRename( required any event, required struct data ) {
var rc = event.getCollection();
// make sure we have settings
if ( structKeyExists( rc, "filebrowser" ) ) {
- var settings = rc.filebrowser.settings;
+ var settings = rc.filebrowser.settings;
// old path is full path from directoryRoot up...so strip that out
var oldFileName = replaceNoCase(
arguments.data.original,
@@ -109,9 +142,9 @@ component extends="coldbox.system.Interceptor" {
"all"
);
// match with mediaPath and leftover name
- var matcher = settings.mediaPath & oldFileName;
+ var matcher = settings.mediaPath & oldFileName;
// Update all affected menuitems if any on slug updates
- var criteria = menuItemService.newCriteria();
+ var criteria = menuItemService.newCriteria();
var menuItems = criteria.isEq( "mediaPath", "#matcher#" ).list();
for ( var item in menuItems ) {
item.setMediaPath( settings.mediaPath & "/" & arguments.data.newName );
@@ -119,11 +152,12 @@ component extends="coldbox.system.Interceptor" {
}
}
}
+
/**
* Fires before deletion of a file
*/
- function fb_preFileRemoval( required any event, required struct data ){
- var criteria = menuItemService.newCriteria();
+ function fb_preFileRemoval( required any event, required struct data ) {
+ var criteria = menuItemService.newCriteria();
var menuItemsInNeed = criteria.isEq( "mediaPath", "#arguments.data.path#" ).list();
for ( var menuItem in menuItemsInNeed ) {
menuItem.setMediaPath( javacast( "null", "" ) );
@@ -132,4 +166,4 @@ component extends="coldbox.system.Interceptor" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc b/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc
index a2270bb311..57153ef209 100644
--- a/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc
+++ b/modules/contentbox/modules/contentbox-admin/interceptors/UnenrollTwoFactorOnProviderChange.cfc
@@ -10,18 +10,18 @@ component extends="coldbox.system.Interceptor" {
/**
* Configure
*/
- function configure(){
+ function configure() {
+
}
/**
* Unenrolls all users from two-factor authentication on two-factor provider change
*/
- public void function cbadmin_preSettingsSave( required any event, required struct data ){
+ public void function cbadmin_preSettingsSave( required any event, required struct data ) {
// Verify settings sent?
if (
- !data.oldSettings.keyExists( "cb_security_2factorAuth_provider" ) || !data.newSettings.keyExists(
- "cb_security_2factorAuth_provider"
- )
+ !data.oldSettings.keyExists( "cb_security_2factorAuth_provider" ) ||
+ !data.newSettings.keyExists( "cb_security_2factorAuth_provider" )
) {
return;
}
@@ -31,4 +31,4 @@ component extends="coldbox.system.Interceptor" {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc b/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc
index c2e3209931..1fe9585a06 100644
--- a/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc
+++ b/modules/contentbox/modules/contentbox-admin/models/ui/BootstrapFileUpload.cfc
@@ -6,14 +6,13 @@
* A convenient way to create a Bootstrap-themed file upload field
*/
component {
-
// DI
property name="html" inject="HTMLHelper@coldbox";
/**
- * Constructor
+ * Constructor
*/
- BootstrapFileUpload function init(){
+ BootstrapFileUpload function init() {
// Return instance
return this;
}
@@ -34,8 +33,8 @@ component {
*/
public string function renderIt(
required string name,
- boolean required = true,
- string id = "",
+ boolean required = true,
+ string id = "",
string label,
numeric columnWidth = 3,
useRemoveButton = true,
@@ -43,49 +42,48 @@ component {
changeButtonText = "Change",
removeButtonText = "Remove",
accept = ""
- ){
+ ) {
savecontent variable="renderedContent" {
// cfformat-ignore-start
- writeoutput(
- '
'
- );
// cfformat-ignore-end
}
return renderedContent;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc b/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc
index a3e2c00bb1..a9d07a8e03 100755
--- a/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc
+++ b/modules/contentbox/modules/contentbox-admin/models/ui/PageBreadcrumbVisitor.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,7 +10,7 @@ component singleton {
/**
* Constructor
*/
- PageBreadcrumbVisitor function init(){
+ PageBreadcrumbVisitor function init() {
return this;
}
@@ -19,23 +19,22 @@ component singleton {
*
* @page The page content object
*/
- function visit( required page ){
+ function visit( required page ) {
var bc = "";
if ( arguments.page.hasParent() ) {
bc &= visit( arguments.page.getParent() );
}
-
// cfformat-ignore-start
if ( len( arguments.page.getTitle() ) ) {
- bc &= "
-
- #arguments.page.getTitle()#
- ";
- }
+bc &= "
+
+#arguments.page.getTitle()#
+ ";
+}
// cfformat-ignore-end
return bc;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/ModuleConfig.cfc
index 71c8a19f21..f3ea5995c1 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/ModuleConfig.cfc
@@ -6,29 +6,28 @@
* ContentBox Admin CKEditor Module
*/
component {
-
// Module Properties
- this.title = "ContentBox CKEditor";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox CKEditor Module";
- this.viewParentLookup = true;
+ this.title = "ContentBox CKEditor";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox CKEditor Module";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
- this.entryPoint = "cbadmin/ckeditor";
- this.dependencies = [ "contentbox-admin" ];
+ this.entryPoint = "cbadmin/ckeditor";
+ this.dependencies = [ "contentbox-admin"];
/**
* Configure
*/
- function configure(){
+ function configure() {
// SES Routes
- routes = [ { pattern : "/:handler/:action?" } ];
+ routes = [ { pattern: "/:handler/:action?" }];
// Custom Declared Points
interceptorSettings = {
// CB Admin Custom Events
- customInterceptionPoints : [
+ customInterceptionPoints: [
"cbadmin_ckeditorToolbar",
"cbadmin_ckeditorExtraPlugins",
"cbadmin_ckeditorExtraConfig",
@@ -43,7 +42,7 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
var editorService = wirebox.getInstance( "EditorService@contentbox" );
editorService.registerEditor( wirebox.getInstance( "CKEditor@contentbox-ckeditor" ) );
}
@@ -51,9 +50,9 @@ component {
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
var editorService = wirebox.getInstance( "EditorService@contentbox" );
editorService.unregisterEditor( "ckeditor" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/elixir-module.js b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/elixir-module.js
index bb96fafa0d..91cc5cf32e 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/elixir-module.js
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/elixir-module.js
@@ -15,7 +15,7 @@ module.exports = function( mix ) {
const destination = "modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/includes/ckeditor";
if ( fs.existsSync( destination ) ){
- fs.rmdirSync( destination, { recursive: true } );
+ fs.rmSync( destination, { recursive: true, force: true } );
}
fs.ensureDirSync( destination );
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc
index aa61c1ade4..6126d2fae1 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-ckeditor/models/CKEditor.cfc
@@ -5,12 +5,7 @@
* ---
* CKEditor Implementation
*/
-component
- implements="contentbox.models.ui.editors.IEditor"
- accessors ="true"
- singleton
-{
-
+component implements="contentbox.models.ui.editors.IEditor" accessors ="true" singleton {
// DI
property name="log" inject="logbox:logger:{this}";
@@ -35,19 +30,22 @@ component
required coldbox,
required settingService,
required html
- ){
+ ) {
// register dependencies
variables.interceptorService = arguments.coldbox.getInterceptorService();
- variables.requestService = arguments.coldbox.getRequestService();
- variables.coldbox = arguments.coldbox;
- variables.settingService = arguments.settingService;
- variables.html = arguments.html;
+ variables.requestService = arguments.coldbox.getRequestService();
+ variables.coldbox = arguments.coldbox;
+ variables.settingService = arguments.settingService;
+ variables.html = arguments.html;
// Store admin entry point and base URL settings
ADMIN_ENTRYPOINT = arguments.coldbox.getSetting( "modules" )[ "contentbox-admin" ].entryPoint;
- ADMIN_ROOT = arguments.coldbox.getSetting( "modules" )[ "contentbox-admin" ].mapping;
- CKEDITOR_ROOT = arguments.coldbox.getSetting( "modules" )[ "contentbox-ckeditor" ].mapping;
- HTML_BASE_URL = variables.requestService.getContext().getHTMLBaseURL();
+ ADMIN_ROOT = arguments.coldbox.getSetting( "modules" )[ "contentbox-admin" ].mapping;
+ CKEDITOR_ROOT = arguments.coldbox.getSetting( "modules" )[ "contentbox-ckeditor" ].mapping;
+ HTML_BASE_URL = variables
+ .requestService
+ .getContext()
+ .getHTMLBaseURL();
return this;
}
@@ -55,96 +53,115 @@ component
/**
* Get the internal name of an editor
*/
- function getName(){
+ function getName() {
return "ckeditor";
}
/**
* Get the display name of an editor
*/
- function getDisplayName(){
+ function getDisplayName() {
return "CKEditor";
- };
+ }
/**
* Startup the editor(s) on a page
*/
- function startup(){
+ function startup() {
// prepare toolbar announcement on startup
var iData = {
- toolbar : deserializeJSON( settingService.getSetting( "cb_editors_ckeditor_toolbar" ) ),
- excerptToolbar : deserializeJSON( settingService.getSetting( "cb_editors_ckeditor_excerpt_toolbar" ) )
+ toolbar : deserializeJSON( settingService.getSetting( "cb_editors_ckeditor_toolbar" ) ),
+ excerptToolbar: deserializeJSON( settingService.getSetting( "cb_editors_ckeditor_excerpt_toolbar" ) )
};
// Announce the editor toolbar is about to be processed
interceptorService.announce( "cbadmin_ckeditorToolbar", iData );
// Load extra plugins according to our version
- var iData2 = { extraPlugins : listToArray( settingService.getSetting( "cb_editors_ckeditor_extraplugins" ) ) };
+ var iData2 = { extraPlugins: listToArray( settingService.getSetting( "cb_editors_ckeditor_extraplugins" ) ) };
// Announce extra plugins to see if user implements more.
interceptorService.announce( "cbadmin_ckeditorExtraPlugins", iData2 );
// Load extra configuration
- var iData3 = { extraConfig : "" };
+ var iData3 = { extraConfig: "" };
// Announce extra configuration
interceptorService.announce( "cbadmin_ckeditorExtraConfig", iData3 );
// Load contentsCss configuration
- var iData4 = { contentsCss : [] };
+ var iData4 = { contentsCss: [] };
// Announce extra configuration
interceptorService.announce( "cbadmin_ckeditorContentsCss", iData4 );
// Now prepare our JavaScript and load it. No need to send assets to the head as CKEditor comes pre-bundled
- return compileJS( iData, iData2, iData3, iData4 );
+ return compileJS(
+ iData,
+ iData2,
+ iData3,
+ iData4
+ );
}
/**
* This is fired once editor javascript loads, you can use this to return back functions, asset calls, etc.
* return the appropriate JavaScript
*/
- function loadAssets(){
+ function loadAssets() {
var js = "";
// Load Assets, they are included with ContentBox
- html.addAsset( asset: "#variables.CKEDITOR_ROOT#/includes/ckeditor/ckeditor.js", defer: true );
- html.addAsset( asset: "#variables.CKEDITOR_ROOT#/includes/ckeditor/adapters/jquery.js", defer: true );
-
+ html.addAsset(
+ asset = "#variables.CKEDITOR_ROOT#/includes/ckeditor/ckeditor.js",
+ defer = true
+ );
+ html.addAsset(
+ asset = "#variables.CKEDITOR_ROOT#/includes/ckeditor/adapters/jquery.js",
+ defer = true
+ );
// cfformat-ignore-start
savecontent variable="js" {
- writeOutput( "
- function getContentEditor(){
- return $content.ckeditorGet();
- }
- function getExcerptEditor(){
- return $excerpt.ckeditorGet();
- }
- function checkIsDirty(){
- return $content.ckeditorGet().checkDirty();
- }
- function getEditorContent(){
- return $content.ckeditorGet().getData();
- }
- function getEditorExcerpt(){
- return $excerpt.ckeditorGet().getData();
- }
- function updateEditorContent(){
- CKEDITOR.instances.content.updateElement();
- }
- function updateEditorExcerpt(){
- CKEDITOR.instances.excerpt.updateElement();
- }
- function setEditorContent( editorName, content ){
- $( '##' + editorName ).ckeditorGet().setData( content );
- }
- function insertEditorContent( editorName, content ){
- // if simple value, insert as html
- if( jQuery.type( content ) == 'string' )
- $( '##' + editorName ).ckeditorGet().insertHtml( content );
- // else insert as element
- else
- $( '##' + editorName ).ckeditorGet().insertElement( content );
- }
- ");
- }
+writeOutput(
+"
+function getContentEditor(){
+return $content.ckeditorGet();
+}
+function getExcerptEditor(){
+return $excerpt.ckeditorGet();
+}
+function checkIsDirty(){
+return $content.ckeditorGet().checkDirty();
+}
+function getEditorContent(){
+return $content.ckeditorGet().getData();
+}
+function getEditorExcerpt(){
+return $excerpt.ckeditorGet().getData();
+}
+function updateEditorContent(){
+CKEDITOR.instances.content.updateElement();
+}
+function updateEditorExcerpt(){
+CKEDITOR.instances.excerpt.updateElement();
+}
+function setEditorContent( editorName, content ){
+$( '##' + editorName ).ckeditorGet().setData( content );
+}
+function insertEditorContent( editorName, content ){
+// if simple value, insert as html
+if( jQuery.type( content ) == 'string' )
+$( '##' + editorName ).ckeditorGet().insertHtml( content );
+// else insert as element
+else
+$( '##' + editorName ).ckeditorGet().insertElement( content );
+}
+"
+);
+}
// cfformat-ignore-end
return js;
- };
+ }
+
+ /**
+ * Shutdown the editor(s) on a page
+ */
+ function shutdown() {
+
+ }
/**
* Compile the needed JS to display into the screen
@@ -154,13 +171,13 @@ component
required iData2,
required iData3,
required iData4
- ){
- var js = "";
- var event = requestService.getContext();
+ ) {
+ var js = "";
+ var event = requestService.getContext();
var cbAdminEntryPoint = event.getValue( name = "cbAdminEntryPoint", private = true );
// CK Editor Integration Handlers
- var xehCKFileBrowserURL = "#cbAdminEntryPoint#/ckfilebrowser/";
+ var xehCKFileBrowserURL = "#cbAdminEntryPoint#/ckfilebrowser/";
var xehCKFileBrowserURLImage = "#cbAdminEntryPoint#/ckfilebrowser/";
var xehCKFileBrowserURLFlash = "#cbAdminEntryPoint#/ckfilebrowser/";
@@ -174,58 +191,52 @@ component
if ( len( arguments.iData3.extraConfig ) ) {
extraConfig = "#arguments.iData3.extraConfig#,";
}
-
/**
- We build the compiled JS with the knowledge of some inline variables we have context to
- $excerpt - The excerpt jquery object
- $content - The content jquery object
- $withExcerpt - an argument telling us if an excerpt is available to render or not
- */
-
+ * We build the compiled JS with the knowledge of some inline variables we have context to
+ * $excerpt - The excerpt jquery object
+ * $content - The content jquery object
+ * $withExcerpt - an argument telling us if an excerpt is available to render or not
+ */
// cfformat-ignore-start
savecontent variable="js" {
- writeOutput( "
- // toolbar Configuration
- var ckToolbar = $.parseJSON( '#serializeJSON( arguments.iData.toolbar )#' );
- var ckExcerptToolbar = $.parseJSON( '#serializeJSON( arguments.iData.excerptToolbar )#' );
-
- // Activate ckeditor on content object
- $content.ckeditor( function(){}, {
- #extraPlugins#
- #extraConfig#
- contentsCss : [ '#arrayToList( arguments.iData4.contentsCss, "', '" )#' ],
- toolbar : ckToolbar,
- toolbarCanCollapse : true,
- height : 400,
- filebrowserBrowseUrl : '#event.buildLink( xehCKFileBrowserURL )#',
- filebrowserImageBrowseUrl : '#event.buildLink( xehCKFileBrowserURLIMage )#',
- filebrowserFlashBrowseUrl : '#event.buildLink( xehCKFileBrowserURLFlash )#',
- baseHref : '#HTML_BASE_URL#/'
- } );
-
- // Active Excerpts
- if( $withExcerpt ){
- $excerpt.ckeditor( function(){}, {
- #extraConfig#
- contentsCss : [ '#arrayToList( arguments.iData4.contentsCss, "', '" )#' ],
- toolbar : ckExcerptToolbar,
- toolbarCanCollapse : true,
- height : 200,
- filebrowserBrowseUrl : '#event.buildLink( xehCKFileBrowserURL )#',
- baseHref : '#HTML_BASE_URL#/'
- } );
- }
- ");
- }
+writeOutput(
+"
+// toolbar Configuration
+var ckToolbar = $.parseJSON( '#serializeJSON( arguments.iData.toolbar )#' );
+var ckExcerptToolbar = $.parseJSON( '#serializeJSON( arguments.iData.excerptToolbar )#' );
+
+// Activate ckeditor on content object
+$content.ckeditor( function(){}, {
+#extraPlugins#
+#extraConfig#
+contentsCss : [ '#arrayToList( arguments.iData4.contentsCss, "', '" )#' ],
+toolbar : ckToolbar,
+toolbarCanCollapse : true,
+height : 400,
+filebrowserBrowseUrl : '#event.buildLink( xehCKFileBrowserURL )#',
+filebrowserImageBrowseUrl : '#event.buildLink( xehCKFileBrowserURLIMage )#',
+filebrowserFlashBrowseUrl : '#event.buildLink( xehCKFileBrowserURLFlash )#',
+baseHref : '#HTML_BASE_URL#/'
+} );
+
+// Active Excerpts
+if( $withExcerpt ){
+$excerpt.ckeditor( function(){}, {
+#extraConfig#
+contentsCss : [ '#arrayToList( arguments.iData4.contentsCss, "', '" )#' ],
+toolbar : ckExcerptToolbar,
+toolbarCanCollapse : true,
+height : 200,
+filebrowserBrowseUrl : '#event.buildLink( xehCKFileBrowserURL )#',
+baseHref : '#HTML_BASE_URL#/'
+} );
+}
+"
+);
+}
// cfformat-ignore-end
return js;
}
- /**
- * Shutdown the editor(s) on a page
- */
- function shutdown(){
- }
-
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc
index 3a6fe57782..85fcfbb471 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/ModuleConfig.cfc
@@ -6,120 +6,126 @@
* ContentBox file browser module
*/
component {
-
// Module Properties
- this.title = "File Browser";
- this.author = "Ortus Solutions";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "A file-directory browser and selector";
+ this.title = "File Browser";
+ this.author = "Ortus Solutions";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "A file-directory browser and selector";
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
- this.viewParentLookup = true;
+ this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point
- this.entryPoint = "cbFileBrowser";
- this.dependencies = [ "contentbox-admin" ];
+ this.entryPoint = "cbFileBrowser";
+ this.dependencies = [ "contentbox-admin"];
/**
* Configure the module
*/
- function configure(){
+ function configure() {
// module settings - stored in modules.name.settings
settings = {
// The title name for usage inline and the layout
- title : "FileBrowser",
+ title : "FileBrowser",
// the directory root path to start the visualizer on, absolute path, set it to contentbox default location
- directoryRoot : expandPath( "/contentbox-custom/_content" ),
+ directoryRoot : expandPath( "/contentbox-custom/_content" ),
// Secure the visualization or creation of stuff above the directory root or not
- traversalSecurity : true,
+ traversalSecurity : true,
// Show files on the visualizer or not
- showFiles : true,
+ showFiles : true,
// Ability to create folders
- createFolders : true,
+ createFolders : true,
// Ability to remove stuff
- deleteStuff : true,
+ deleteStuff : true,
// Allow downloads
- allowDownload : true,
+ allowDownload : true,
// Allow uploads
- allowUploads : true,
+ allowUploads : true,
// CFFile Upload accepted mime types, blank means all.
- acceptMimeTypes : "",
+ acceptMimeTypes : "",
// Name filtering applies to both files and directories. This is also a regex
- nameFilter : ".*",
+ nameFilter : ".*",
// Exclusion Filter: A list of files/directory regex names to exclude from showing
- excludeFilter : "Application\.cfc",
+ excludeFilter : "Application\.cfc",
// Extension filtering that applies to file extensions to display, matches the filter argument to directoryList()
- extensionFilter : "",
+ extensionFilter : "",
// Image Name filtering applies to both files and directories. This is also a regex. Where the filterType=image.
- imgNameFilter : "^((?!\.).)*$|.+\.(jpg|jpeg|bmp|gif|png)/? *",
+ imgNameFilter : "^((?!\.).)*$|.+\.(jpg|jpeg|bmp|gif|png)/? *",
// Flash Name filtering applies to both files and directories. This is also a regex. Where the filterType=flash.
- flashNameFilter : "^((?!\.).)*$|.+\.(swf|fla)/? *",
+ flashNameFilter : "^((?!\.).)*$|.+\.(swf|fla)/? *",
// Volume Chooser, display the volume navigator
- volumeChooser : false,
+ volumeChooser : false,
// Load jQuery
- loadJQuery : true,
+ loadJQuery : true,
// Load Select Callback hooks
- loadSelectCallbacks : true,
+ loadSelectCallbacks: true,
// Quick View image width in pixels
- quickViewWidth : 400,
+ quickViewWidth : 400,
// HTML Uploads
- html5uploads : {
+ html5uploads : {
// max file size in mbytes
- maxfilesize : 100,
+ maxfilesize: 100,
// max multiple upload files
- maxfiles : 25
+ maxfiles : 25
},
- useMediaPath : false,
- mediaPath : "__media"
+ useMediaPath: false,
+ mediaPath : "__media"
};
// clean directory root
- settings.directoryRoot = reReplace( settings.directoryRoot, "\\", "/", "all" );
+ settings.directoryRoot = reReplace(
+ settings.directoryRoot,
+ "\\",
+ "/",
+ "all"
+ );
if ( right( settings.directoryRoot, 1 ) EQ "/" ) {
settings.directoryRoot = left( settings.directoryRoot, len( settings.directoryRoot ) - 1 );
}
// i18n
- cbi18n = { resourceBundles : { "fb" : "#moduleMapping#/includes/i18n/fb" } };
+ cbi18n = { resourceBundles: { "fb": "#moduleMapping#/includes/i18n/fb" } };
// Layout Settings
- layoutSettings = { defaultLayout : "filebrowser.cfm" };
+ layoutSettings = { defaultLayout: "filebrowser.cfm" };
// Custom Declared Points
interceptorSettings = {
- customInterceptionPoints : arrayToList( [
- "fb_preTitleBar",
- "fb_postTitleBar",
- "fb_preLocationBar",
- "fb_postLocationBar",
- "fb_preBottomBar",
- "fb_postBottomBar",
- "fb_preFileListing",
- "fb_postFileListing",
- "fb_preUploadBar",
- "fb_postUploadBar",
- "fb_preQuickViewBar",
- "fb_postQuickViewBar",
- // folder creation
- "fb_postFolderCreation",
- "fb_preFolderCreation",
- // removals
- "fb_preFileRemoval",
- "fb_postFileRemoval",
- // renameing
- "fb_preFileRename",
- "fb_postFileRename",
- // downloads
- "fb_preFileDownload",
- "fb_postFileDownload",
- // Uploads
- "fb_preFileUpload",
- "fb_postFileUpload",
- "fb_onFileUploadError",
- // directory read
- "fb_postDirectoryRead"
- ] )
+ customInterceptionPoints: arrayToList(
+ [
+ "fb_preTitleBar",
+ "fb_postTitleBar",
+ "fb_preLocationBar",
+ "fb_postLocationBar",
+ "fb_preBottomBar",
+ "fb_postBottomBar",
+ "fb_preFileListing",
+ "fb_postFileListing",
+ "fb_preUploadBar",
+ "fb_postUploadBar",
+ "fb_preQuickViewBar",
+ "fb_postQuickViewBar",
+ // folder creation
+ "fb_postFolderCreation",
+ "fb_preFolderCreation",
+ // removals
+ "fb_preFileRemoval",
+ "fb_postFileRemoval",
+ // renameing
+ "fb_preFileRename",
+ "fb_postFileRename",
+ // downloads
+ "fb_preFileDownload",
+ "fb_postFileDownload",
+ // Uploads
+ "fb_preFileUpload",
+ "fb_postFileUpload",
+ "fb_onFileUploadError",
+ // directory read
+ "fb_postDirectoryRead"
+ ]
+ )
};
// Custom Declared Interceptors
@@ -129,16 +135,17 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
// Reset the media root setting to the one loaded in ContentBox Settings.
- var mediaService = wirebox.getInstance( "MediaService@contentbox" );
+ var mediaService = wirebox.getInstance( "MediaService@contentbox" );
settings.directoryRoot = mediaService.getCoreMediaRoot( absolute = true );
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/config/Router.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/config/Router.cfc
index 6694d108b7..038445dac4 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/config/Router.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/config/Router.cfc
@@ -7,7 +7,7 @@
*/
component {
- function configure(){
+ function configure() {
route( "/filelisting" ).to( "home.filelisting" );
route( "/createFolder" ).to( "home.createFolder" );
route( "/remove" ).to( "home.remove" );
@@ -19,4 +19,4 @@ component {
route( "/:handler/:action" ).end();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Editor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Editor.cfc
index 15f84aa823..ca1a135897 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Editor.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Editor.cfc
@@ -2,32 +2,41 @@
* Image Editor
*/
component extends="coldbox.system.EventHandler" {
-
property name="cb" inject="CBHelper@contentbox";
/**
* Pre handler
*/
- function preHandler( event, currentAction, rc, prc ){
- prc.activeDisk = cbfs().get( variables.cb.site().getMediaDisk() ?: "contentbox" );
+ function preHandler( event, currentAction, rc, prc ) {
+ prc.activeDisk = cbfs().get(
+ variables
+ .cb
+ .site()
+ .getMediaDisk() ?:
+ "contentbox"
+ );
}
/**
* Index
*/
- any function index( event, rc, prc ){
+ any function index( event, rc, prc ) {
event
.paramValue( "imagePath", "" )
.paramValue( "imageSrc", "" )
.paramValue( "imageName", "" );
- var thisImage = imageRead( prc.activeDisk.url( rc.imagepath ) );
- var info = imageInfo( thisImage );
- prc.width = info.width;
- prc.height = info.height;
+ var thisImage = imageRead( prc.activeDisk.url( rc.imagepath ) );
+ var info = imageInfo( thisImage );
+ prc.width = info.width;
+ prc.height = info.height;
prc.imageRelPath = rc.imageSrc;
- prc.imageSrc = reReplace( event.buildLink( "" ), "\/$", "" ) & rc.imageSrc;
- prc.fileType = listLast( rc.imageName, "." );
+ prc.imageSrc = reReplace(
+ event.buildLink( "" ),
+ "\/$",
+ ""
+ ) & rc.imageSrc;
+ prc.fileType = listLast( rc.imageName, "." );
if ( event.isAjax() ) {
event.renderData( data = view( view = "editor/index", layout = "ajax" ) );
@@ -39,7 +48,7 @@ component extends="coldbox.system.EventHandler" {
/**
* Info
*/
- any function info( event, rc, prc ){
+ any function info( event, rc, prc ) {
event
.paramValue( "filePath", "" )
.paramValue( "fileSrc", "" )
@@ -48,10 +57,10 @@ component extends="coldbox.system.EventHandler" {
if ( !isImageFile( prc.activeDisk.url( rc.filePath ) ) ) {
prc.fileInfo = prc.activeDisk.info( rc.filePath );
} else {
- prc.fileInfo = prc.activeDisk.info( rc.filePath );
- prc.imgInfo = imageInfo( imageRead( prc.activeDisk.url( rc.filePath ) ) );
+ prc.fileInfo = prc.activeDisk.info( rc.filePath );
+ prc.imgInfo = imageInfo( imageRead( prc.activeDisk.url( rc.filePath ) ) );
prc.fileRelPath = rc.fileSrc;
- prc.fileSrc = event.buildLink( "" ) & rc.fileSrc;
+ prc.fileSrc = event.buildLink( "" ) & rc.fileSrc;
}
if ( event.isAjax() ) {
@@ -64,7 +73,7 @@ component extends="coldbox.system.EventHandler" {
/**
* Crop image
*/
- any function crop( event, rc, prc ){
+ any function crop( event, rc, prc ) {
// params
event
.paramValue( "imgX", "" )
@@ -74,8 +83,7 @@ component extends="coldbox.system.EventHandler" {
.paramValue( "imgPath", "" )
.paramValue( "imgName", "" )
.paramValue( "imgEdited", false )
- .paramValue( "type", "" )
- ;
+ .paramValue( "type", "" );
if ( len( rc.imgLoc ) ) {
if ( rc.imgEdited ) {
@@ -108,7 +116,7 @@ component extends="coldbox.system.EventHandler" {
/**
* Scale image
*/
- any function imageScale( event, rc, prc ){
+ any function imageScale( event, rc, prc ) {
// params
event
.paramValue( "width", "" )
@@ -129,12 +137,16 @@ component extends="coldbox.system.EventHandler" {
} else {
// read the image and create a ColdFusion image object
// read the image and create a ColdFusion image object --->
- var path = findNoCase( "http", rc.imgPath ) ? rc.imgPath : prc.activeDisk.url( rc.imgPath );
+ var path = findNoCase( "http", rc.imgPath ) ? rc.imgPath : prc.activeDisk.url( rc.imgPath );
var sourceImage = imageRead( path );
}
// crop the image using the supplied coords from the url request
- imageResize( sourceImage, rc.width, rc.height );
+ imageResize(
+ sourceImage,
+ rc.width,
+ rc.height
+ );
cfimage( action = "writeToBrowser", source = sourceImage );
}
@@ -145,7 +157,7 @@ component extends="coldbox.system.EventHandler" {
/**
* Flip/rotate image
*/
- any function imageTransform( event, rc, prc ){
+ any function imageTransform( event, rc, prc ) {
// params
event
.paramValue( "imgPath", "" )
@@ -157,7 +169,7 @@ component extends="coldbox.system.EventHandler" {
if ( rc.imgEdited ) {
// read from in memory
if ( !findNoCase( "http", rc.imgPath ) ) {
- rc.imgPath = event.getHTMLBaseURL() & listToArray( rc.imgPath, "/" ).toList( "/" )
+ rc.imgPath = event.getHTMLBaseURL() & listToArray( rc.imgPath, "/" ).toList( "/" );
}
if ( server.keyExists( "lucee" ) ) {
var sourceImage = imageRead( rc.imgPath & "&type=" & rc.type );
@@ -182,7 +194,7 @@ component extends="coldbox.system.EventHandler" {
/**
* Save image
*/
- any function imageSave( event, rc, prc ){
+ any function imageSave( event, rc, prc ) {
// params
event
.paramValue( "imgLoc", "" )
@@ -195,27 +207,27 @@ component extends="coldbox.system.EventHandler" {
if ( len( rc.imgLoc ) ) {
if ( !findNoCase( "http", rc.imgLoc ) ) {
- rc.imgLoc = event.getHTMLBaseURL() & listToArray( rc.imgLoc, "/" ).toList( "/" )
+ rc.imgLoc = event.getHTMLBaseURL() & listToArray( rc.imgLoc, "/" ).toList( "/" );
}
var sourceImage = fileReadBinary( rc.imgLoc );
- if ( rc.overwrite AND !len( rc.saveAs ) ) {
+ if ( rc.overwrite && !len( rc.saveAs ) ) {
prc.activeDisk.create(
- path = rc.imgPath,
- contents = sourceImage,
- overwrite = rc.overwrite
- );
+ path = rc.imgPath,
+ contents = sourceImage,
+ overwrite = rc.overwrite
+ );
} else if ( len( rc.saveAs ) ) {
prc.activeDisk.create(
- path = rc.saveAs,
- contents = sourceImage,
- overwrite = rc.overwrite
- );
+ path = rc.saveAs,
+ contents = sourceImage,
+ overwrite = rc.overwrite
+ );
} else {
prc.activeDisk.create(
- path = getDirectoryFromPath( rc.imgPath ) & "_edited_" & rc.imgName,
- contents = sourceImage,
- overwrite = rc.overwrite
- );
+ path = getDirectoryFromPath( rc.imgPath ) & "_edited_" & rc.imgName,
+ contents = sourceImage,
+ overwrite = rc.overwrite
+ );
}
}
event.noRender();
@@ -229,7 +241,10 @@ component extends="coldbox.system.EventHandler" {
*
* @return sanitized path
*/
- private function sanitizeUrl( required string imgName, required string imgPath ){
+ private function sanitizeUrl(
+ required string imgName,
+ required string imgPath
+ ) {
// strip out image name and re-add encoded
return replace(
arguments.imgPath,
@@ -238,4 +253,4 @@ component extends="coldbox.system.EventHandler" {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc
index ec114c44b6..e12a6c6a5d 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-filebrowser/handlers/Home.cfc
@@ -6,16 +6,17 @@
* This is the main controller of events for the filebrowser
*/
component extends="cbadmin.handlers.baseHandler" {
-
// DI
property name="cookieStorage" inject="cookieStorage@cbStorages";
+
property name="html" inject="HTMLHelper@coldbox";
+
property name="cb" inject="CBHelper@contentbox";
/**
* Pre handler
*/
- function preHandler( event, currentAction, rc, prc ){
+ function preHandler( event, currentAction, rc, prc ) {
// Detect Module Name Override or default it
if ( settingExists( "filebrowser_module_name" ) ) {
prc.fbModuleName = getSetting( "filebrowser_module_name" );
@@ -24,12 +25,18 @@ component extends="cbadmin.handlers.baseHandler" {
}
// Setup the Module Root And Entry Point
- prc.fbModRoot = getModuleConfig( prc.fbModuleName ).mapping;
+ prc.fbModRoot = getModuleConfig( prc.fbModuleName ).mapping;
prc.fbModEntryPoint = getModuleConfig( prc.fbModuleName ).entrypoint;
// Duplicate the settings so we can do overrides a-la-carte
- prc.fbSettings = duplicate( getModuleSettings( prc.fbModuleName ) );
-
- prc.activeDisk = cbfs().get( variables.cb.site().getMediaDisk() ?: "contentbox" );
+ prc.fbSettings = duplicate( getModuleSettings( prc.fbModuleName ) );
+
+ prc.activeDisk = cbfs().get(
+ variables
+ .cb
+ .site()
+ .getMediaDisk() ?:
+ "contentbox"
+ );
// Merge Flash Settings if they exist
if ( structKeyExists( flash.get( "fileBrowser", {} ), "settings" ) ) {
@@ -47,19 +54,19 @@ component extends="cbadmin.handlers.baseHandler" {
prc,
boolean widget = false,
struct settings = {}
- ){
+ ) {
// params
event.paramValue( "callback", "" );
event.paramValue( "cancelCallback", "" );
event.paramValue( "filterType", "" );
// exit handlers
- prc.xehFBBrowser = "#prc.fbModEntryPoint#/filelisting";
- prc.xehFBDownload = "#prc.fbModEntryPoint#/download";
- prc.xehFBUpload = "#prc.fbModEntryPoint#/upload";
+ prc.xehFBBrowser = "#prc.fbModEntryPoint#/filelisting";
+ prc.xehFBDownload = "#prc.fbModEntryPoint#/download";
+ prc.xehFBUpload = "#prc.fbModEntryPoint#/upload";
prc.xehFBNewFolder = "#prc.fbModEntryPoint#/createfolder";
- prc.xehFBRemove = "#prc.fbModEntryPoint#/remove";
- prc.xehFBRename = "#prc.fbModEntryPoint#/rename";
+ prc.xehFBRemove = "#prc.fbModEntryPoint#/remove";
+ prc.xehFBRename = "#prc.fbModEntryPoint#/rename";
// Detect Widget Mode.
if ( arguments.widget ) {
@@ -72,28 +79,40 @@ component extends="cbadmin.handlers.baseHandler" {
}
// Detect sorting changes
- detectPreferences( event, rc, prc );
+ detectPreferences(
+ event,
+ rc,
+ prc
+ );
// load Assets for filebrowser
- loadAssets( event, rc, prc );
+ loadAssets(
+ event,
+ rc,
+ prc
+ );
// Inflate flash params
- inflateFlashParams( event, rc, prc );
+ inflateFlashParams(
+ event,
+ rc,
+ prc
+ );
// Store directory roots and web root
- prc.fbDirRoot = prc.fbSettings.directoryRoot;
+ prc.fbDirRoot = prc.fbSettings.directoryRoot;
prc.fbWebRootPath = expandPath( "./" );
// Check if the incoming path does not exist so we default to the configuration directory root.
- prc.fbCurrentRoot = cleanIncomingPath( prc.fbSettings.directoryRoot );
+ prc.fbCurrentRoot = cleanIncomingPath( prc.fbSettings.directoryRoot );
// Web root cleanups
- prc.fbwebRootPath = cleanIncomingPath( prc.fbwebRootPath );
+ prc.fbwebRootPath = cleanIncomingPath( prc.fbwebRootPath );
// Do a safe current root for JS
prc.fbSafeCurrentRoot = urlEncodedFormat( prc.fbCurrentRoot );
// Get storage preferences
- prc.fbPreferences = getPreferences();
+ prc.fbPreferences = getPreferences();
// set view or render widget?
- prc.widget = arguments.widget;
+ prc.widget = arguments.widget;
if ( arguments.widget ) {
return view( view = "home/index", module = prc.fbModuleName );
} else {
@@ -104,21 +123,25 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Ajax driven file listings
*/
- function filelisting( event, rc, prc ){
+ function filelisting( event, rc, prc ) {
// params
event.paramValue( "path", "" );
event.paramValue( "filterType", "" );
event.paramValue( "verbose", true );
// Detect sorting changes
- detectPreferences( event, rc, prc );
+ detectPreferences(
+ event,
+ rc,
+ prc
+ );
// Exit handlers
prc.xehFBDownload = "#prc.fbModEntryPoint#/download";
- prc.xehFBUpload = "#prc.fbModEntryPoint#/upload";
+ prc.xehFBUpload = "#prc.fbModEntryPoint#/upload";
// Store directory roots and web root
- prc.fbDirRoot = prc.fbSettings.directoryRoot;
+ prc.fbDirRoot = prc.fbSettings.directoryRoot;
prc.fbWebRootPath = expandPath( "./" );
// clean incoming path and decode it.
@@ -130,13 +153,13 @@ component extends="cbadmin.handlers.baseHandler" {
prc.fbCurrentRoot = rc.path;
}
// Web root cleanups
- prc.fbwebRootPath = cleanIncomingPath( prc.fbwebRootPath );
+ prc.fbwebRootPath = cleanIncomingPath( prc.fbwebRootPath );
// Do a safe current root for JS
prc.fbSafeCurrentRoot = urlEncodedFormat( prc.fbCurrentRoot );
// Get storage preferences
prc.fbPreferences = getPreferences();
- prc.fbNameFilter = prc.fbSettings.nameFilter;
+ prc.fbNameFilter = prc.fbSettings.nameFilter;
if ( rc.filterType == "Image" ) {
prc.fbNameFilter = prc.fbSettings.imgNameFilter;
}
@@ -145,7 +168,8 @@ component extends="cbadmin.handlers.baseHandler" {
}
// get directory listing.
- prc.fbListing = prc.activeDisk
+ prc.fbListing = prc
+ .activeDisk
.contents(
directory = prc.fbCurrentRoot,
filter = prc.fbSettings.extensionFilter,
@@ -154,9 +178,11 @@ component extends="cbadmin.handlers.baseHandler" {
type = prc.fbPreferences.listFolder == "dir" ? "dir" : "all",
absolute = "false"
)
- .map( ( file ) => rc.verbose ? prc.activeDisk.info( file ) : file );
+ .map(
+ ( file ) => rc.verbose ? prc.activeDisk.info( file ) : file
+ );
- var iData = { directory : prc.fbCurrentRoot, listing : prc.fbListing };
+ var iData = { directory: prc.fbCurrentRoot, listing: prc.fbListing };
announce( "fb_postDirectoryRead", iData );
@@ -166,8 +192,8 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Creates folders asynchrounsly return json information:
*/
- function createfolder( event, rc, prc ){
- var data = { errors : false, messages : "" };
+ function createfolder( event, rc, prc ) {
+ var data = { errors: false, messages: "" };
// param value
event.paramValue( "path", "" );
@@ -175,17 +201,17 @@ component extends="cbadmin.handlers.baseHandler" {
// Verify credentials else return invalid
if ( !prc.fbSettings.createFolders ) {
- data.errors = true;
+ data.errors = true;
data.messages = $r( "messages.create_folder_disabled@fb" );
event.renderData( data = data, type = "json" );
return;
}
// clean incoming path and names
- rc.path = cleanIncomingPath( urlDecode( trim( rc.path ) ) );
+ rc.path = cleanIncomingPath( urlDecode( trim( rc.path ) ) );
rc.dName = urlDecode( trim( rc.dName ) );
if ( !len( rc.dName ) ) {
- data.errors = true;
+ data.errors = true;
data.messages = $r( "messages.invalid_path_name@fb" );
event.renderData( data = data, type = "json" );
return;
@@ -194,16 +220,22 @@ component extends="cbadmin.handlers.baseHandler" {
// creation
try {
// Announce it
- var iData = { path : rc.path, directoryName : rc.dName };
+ var iData = { path: rc.path, directoryName: rc.dName };
announce( "fb_preFolderCreation", iData );
prc.activeDisk.createDirectory( rc.path & "/" & rc.dName );
- data.errors = false;
- data.messages = $r( resource = "messages.folder_created@fb", values = "#rc.path#/#rc.dName#" );
+ data.errors = false;
+ data.messages = $r(
+ resource = "messages.folder_created@fb",
+ values = "#rc.path#/#rc.dName#"
+ );
// Announce it
announce( "fb_postFolderCreation", iData );
- } catch ( Any e ) {
- data.errors = true;
- data.messages = $r( resource = "messages.error_creating_folder@fb", values = "#e.message# #e.detail#" );
+ } catch (Any e) {
+ data.errors = true;
+ data.messages = $r(
+ resource = "messages.error_creating_folder@fb",
+ values = "#e.message# #e.detail#"
+ );
log.error( data.messages, e );
}
// render stuff out
@@ -213,14 +245,14 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Removes folders + files asynchrounsly return json information:
*/
- function remove( event, rc, prc ){
- var data = { errors : false, messages : "" };
+ function remove( event, rc, prc ) {
+ var data = { errors: false, messages: "" };
// param value
event.paramValue( "path", "" );
// Verify credentials else return invalid
if ( !prc.fbSettings.deleteStuff ) {
- data.errors = true;
+ data.errors = true;
data.messages = $r( "messages.delete_disabled@fb" );
event.renderData( data = data, type = "json" );
return;
@@ -229,7 +261,7 @@ component extends="cbadmin.handlers.baseHandler" {
// clean incoming path and names
rc.path = cleanIncomingPath( urlDecode( trim( rc.path ) ) );
if ( !len( rc.path ) ) {
- data.errors = true;
+ data.errors = true;
data.messages = $r( "messages.invalid_path@fb" );
event.renderData( data = data, type = "json" );
return;
@@ -239,10 +271,10 @@ component extends="cbadmin.handlers.baseHandler" {
// removal
try {
// Announce it
- var iData = { path : thisFile };
+ var iData = { path: thisFile };
announce( "fb_preFileRemoval", iData );
- prc.activeDisk.exists( thisFile )
+ prc.activeDisk.exists( thisFile );
if ( prc.activeDisk.isFile( thisFile ) ) {
prc.activeDisk.delete( thisFile );
@@ -250,14 +282,17 @@ component extends="cbadmin.handlers.baseHandler" {
prc.activeDisk.deleteDirectory( thisFile, true );
}
- data.errors = false;
+ data.errors = false;
data.messages = $r( resource = "messages.removed@fb", values = "#thisFile#" );
// Announce it
announce( "fb_postFileRemoval", iData );
- } catch ( Any e ) {
- data.errors = true;
- data.messages = $r( resource = "messages.error_removing@fb", values = "#e.message# #e.detail#" );
+ } catch (Any e) {
+ data.errors = true;
+ data.messages = $r(
+ resource = "messages.error_removing@fb",
+ values = "#e.message# #e.detail#"
+ );
log.error( data.messages, e );
}
}
@@ -268,14 +303,14 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* download file
*/
- function download( event, rc, prc ){
- var data = { errors : false, messages : "" };
+ function download( event, rc, prc ) {
+ var data = { errors: false, messages: "" };
// param value
event.paramValue( "path", "" );
// Verify credentials else return invalid
if ( !prc.fbSettings.allowDownload ) {
- data.errors = true;
+ data.errors = true;
data.messages = $r( "messages.download_disabled@fb" );
event.renderData( data = data, type = "json" );
return;
@@ -284,17 +319,19 @@ component extends="cbadmin.handlers.baseHandler" {
rc.path = cleanIncomingPath( urlDecode( trim( rc.path ) ) );
if ( !len( rc.path ) ) {
- data.errors = true;
+ data.errors = true;
data.messages = $r( "messages.invalid_path@fb" );
event.renderData( data = data, type = "json" );
return;
}
rc.pathsArray = listToArray( rc.path, "||" );
- if ( fileExists( "#getTempDirectory()#\download.zip" ) ) fileDelete( "#getTempDirectory()#\download.zip" );
+ if ( fileExists( "#getTempDirectory()#\download.zip" ) ) {
+ fileDelete( "#getTempDirectory()#\download.zip" );
+ }
if ( arrayLen( rc.pathsArray ) > 1 ) {
- cfzip( action = "zip", file = "#getTempDirectory()#\download.zip" ) {
+ zip action="zip" file ="#getTempDirectory()#\download.zip" {
for ( var thisFile in rc.pathsArray ) {
- cfzipParam( content = prc.activeDisk.get( thisFile ), entryPath = thisFile );
+ zipParam content ="#prc.activeDisk.get( thisFile )#" entryPath="#thisFile#";
}
}
rc.path = "#getTempDirectory()#\download.zip";
@@ -304,7 +341,7 @@ component extends="cbadmin.handlers.baseHandler" {
try {
// Announce it
// clean incoming path and names
- var iData = { path : rc.path };
+ var iData = { path: rc.path };
announce( "fb_preFileDownload", iData );
if ( rc.pathsArray.len() > 1 ) {
@@ -314,14 +351,16 @@ component extends="cbadmin.handlers.baseHandler" {
prc.activeDisk.download( rc.path );
}
-
- data.errors = false;
+ data.errors = false;
data.messages = $r( resource = "messages.downloaded@fb", values = "#rc.path#" );
// Announce it
announce( "fb_postFileDownload", iData );
- } catch ( Any e ) {
- data.errors = true;
- data.messages = $r( resource = "messages.error_downloading@fb", values = "#e.message# #e.detail#" );
+ } catch (Any e) {
+ data.errors = true;
+ data.messages = $r(
+ resource = "messages.error_downloading@fb",
+ values = "#e.message# #e.detail#"
+ );
log.error( data.messages, e );
// render stuff out
event.renderData( data = data, type = "json" );
@@ -331,8 +370,8 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* rename
*/
- function rename( event, rc, prc ){
- var data = { errors : false, messages : "" };
+ function rename( event, rc, prc ) {
+ var data = { errors: false, messages: "" };
// param value
event.paramValue( "path", "" );
event.paramValue( "name", "" );
@@ -340,8 +379,8 @@ component extends="cbadmin.handlers.baseHandler" {
// clean incoming path and names
rc.path = cleanIncomingPath( urlDecode( trim( rc.path ) ) );
rc.name = urlDecode( trim( rc.name ) );
- if ( !len( rc.path ) OR !len( rc.name ) ) {
- data.errors = true;
+ if ( !len( rc.path ) || !len( rc.name ) ) {
+ data.errors = true;
data.messages = $r( "messages.invalid_path_name@fb" );
event.renderData( data = data, type = "json" );
return;
@@ -350,21 +389,24 @@ component extends="cbadmin.handlers.baseHandler" {
// rename
try {
// Announce it
- var iData = { original : rc.path, newName : rc.name };
+ var iData = { original: rc.path, newName: rc.name };
announce( "fb_preFileRename", iData );
if ( prc.activeDisk.isFile( rc.path ) ) {
prc.activeDisk.move( rc.path, getDirectoryFromPath( rc.path ) & rc.name );
} else {
prc.activeDisk.moveDirectory( rc.path, rc.name );
}
- data.errors = false;
+ data.errors = false;
data.messages = $r( resource = "messages.renamed@fb", values = "#rc.path#" );
// Announce it
announce( "fb_postFileRename", iData );
- } catch ( Any e ) {
- data.errors = true;
- data.messages = $r( resource = "messages.error_renaming@fb", values = "#e.message# #e.detail#" );
+ } catch (Any e) {
+ data.errors = true;
+ data.messages = $r(
+ resource = "messages.error_renaming@fb",
+ values = "#e.message# #e.detail#"
+ );
log.error( data.messages, e );
}
// render stuff out
@@ -374,9 +416,9 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Upload File
*/
- function upload( event, rc, prc ){
+ function upload( event, rc, prc ) {
// setup results
- var data = { "errors" : false, "messages" : "" };
+ var data = { "errors": false, "messages": "" };
// param values
event.paramValue( "path", "" ).paramValue( "manual", false );
@@ -385,7 +427,7 @@ component extends="cbadmin.handlers.baseHandler" {
// Verify credentials else return invalid
if ( !prc.fbSettings.allowUploads ) {
- data.errors = false;
+ data.errors = false;
data.messages = $r( "messages.upload_disabled@fb" );
event.renderData( data = data, type = "json" );
return;
@@ -394,7 +436,7 @@ component extends="cbadmin.handlers.baseHandler" {
// upload
try {
// Announce it
- var iData = { fileField : "FILEDATA", path : rc.path };
+ var iData = { fileField: "FILEDATA", path: rc.path };
announce( "fb_preFileUpload", iData );
// We have to perform this in two separate actions until https://github.com/coldbox-modules/cbfs/issues/21 is implemented
@@ -405,7 +447,8 @@ component extends="cbadmin.handlers.baseHandler" {
"overwrite"
);
- iData.results = prc.activeDisk
+ iData.results = prc
+ .activeDisk
.createFromFile(
source = upload.serverDirectory & "/" & upload.serverFile,
directory = rc.path,
@@ -419,26 +462,29 @@ component extends="cbadmin.handlers.baseHandler" {
if ( log.canDebug() ) {
log.debug( "File Uploaded!", iData.results );
}
- data.errors = false;
+ data.errors = false;
data.messages = $r( "messages.uploaded@fb" );
log.info( data.messages, iData.results );
// Announce it
announce( "fb_postFileUpload", iData );
- } catch ( Any e ) {
- data.errors = true;
- data.messages = $r( resource = "messages.error_uploading@fb", values = "#e.message# #e.detail#" );
+ } catch (Any e) {
+ data.errors = true;
+ data.messages = $r(
+ resource = "messages.error_uploading@fb",
+ values = "#e.message# #e.detail#"
+ );
if ( getSetting( "environment" ) == "development" ) {
data.messages &= "Stack: #e.stacktrace#";
}
log.error( data.messages, e );
// Announce exception
- var iData = { fileField : "FILEDATA", path : rc.path, exception : e };
+ var iData = { fileField: "FILEDATA", path: rc.path, exception: e };
announce( "fb_onFileUploadError", iData );
}
// Manual uploader?
- if ( rc.manual AND !data.errors ) {
+ if ( rc.manual && !data.errors ) {
event.renderData( data = serializeJSON( data ), type = "text" );
} else {
// render stuff out
@@ -451,10 +497,20 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Cleanup of incoming path
*/
- private function cleanIncomingPath( required inPath ){
+ private function cleanIncomingPath( required inPath ) {
// Do some cleanup just in case on incoming path
- inPath = reReplace( inPath, "(/|\\){1,}$", "", "all" );
- inPath = reReplace( inPath, "\\", "/", "all" );
+ inPath = reReplace(
+ inPath,
+ "(/|\\){1,}$",
+ "",
+ "all"
+ );
+ inPath = reReplace(
+ inPath,
+ "\\",
+ "/",
+ "all"
+ );
// clean any leading slashes
return arrayToList( listToArray( inPath, "/" ), "/" );
}
@@ -471,34 +527,44 @@ component extends="cbadmin.handlers.baseHandler" {
prc,
boolean force = false,
struct settings = {}
- ){
+ ) {
// merge the settings structs if passed
if ( !structIsEmpty( arguments.settings ) ) {
mergeSettings( prc.fbSettings, arguments.settings );
}
// Load CSS and JS only if not in Ajax Mode or forced
- if ( !event.isAjax() OR arguments.force ) {
+ if ( !event.isAjax() || arguments.force ) {
// load parent assets if needed
if ( prc.fbSettings.loadJquery ) {
// Add Main Styles
var adminRoot = event.getModuleRoot( "contentbox-admin" );
// we can't use HTML helper here because the elixirPath function won't find the files we need
- var manifest = deserializeJSON( fileRead( expandPath( "#adminRoot#/includes/rev-manifest.json" ) ) );
- addAsset( asset: manifest[ "modules/contentbox/modules/contentbox-admin/includes/css/contentbox.css" ] );
- addAsset( asset: adminRoot & "/includes/js/runtime.js", defer: true );
- addAsset( asset: adminRoot & "/includes/js/vendor.js", defer: true );
+ var manifest = deserializeJSON(
+ fileRead( expandPath( "#adminRoot#/includes/rev-manifest.json" ) )
+ );
+ addAsset(
+ asset = manifest[ "modules/contentbox/modules/contentbox-admin/includes/css/contentbox.css" ]
+ );
+ addAsset(
+ asset = adminRoot & "/includes/js/runtime.js",
+ defer = true
+ );
+ addAsset(
+ asset = adminRoot & "/includes/js/vendor.js",
+ defer = true
+ );
addAsset(
- asset: manifest[ "modules/contentbox/modules/contentbox-admin/includes/js/bootstrap.js" ],
- defer: true
+ asset = manifest[ "modules/contentbox/modules/contentbox-admin/includes/js/bootstrap.js" ],
+ defer = true
);
addAsset(
- asset: manifest[ "modules/contentbox/modules/contentbox-admin/includes/js/app.js" ],
- defer: true
+ asset = manifest[ "modules/contentbox/modules/contentbox-admin/includes/js/app.js" ],
+ defer = true
);
addAsset(
- asset: manifest[ "modules/contentbox/modules/contentbox-admin/includes/js/admin.js" ],
- defer: true
+ asset = manifest[ "modules/contentbox/modules/contentbox-admin/includes/js/admin.js" ],
+ defer = true
);
}
}
@@ -507,13 +573,13 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Get preferences
*/
- private function getPreferences(){
+ private function getPreferences() {
// Get preferences
var prefs = cookieStorage.get( "fileBrowserPrefs", "" );
// not found or not JSON setup defaults
- if ( !len( prefs ) OR NOT isJSON( prefs ) ) {
- prefs = { sorting : "name", listType : "listing" };
+ if ( !len( prefs ) || !isJSON( prefs ) ) {
+ prefs = { sorting: "name", listType: "listing" };
cookieStorage.set( "fileBrowserPrefs", serializeJSON( prefs ) );
} else {
prefs = deserializeJSON( prefs );
@@ -536,8 +602,8 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Detect Preferences: Sorting and List Types
*/
- private function detectPreferences( event, rc, prc ){
- if ( !isNull( rc.sorting ) AND reFindNoCase( "^(name|size|lastModified)$", rc.sorting ) ) {
+ private function detectPreferences( event, rc, prc ) {
+ if ( !isNull( rc.sorting ) && reFindNoCase( "^(name|size|lastModified)$", rc.sorting ) ) {
var prefs = getPreferences();
if ( prefs.sorting NEQ rc.sorting ) {
prefs.sorting = rc.sorting;
@@ -545,17 +611,17 @@ component extends="cbadmin.handlers.baseHandler" {
}
}
- if ( !isNull( rc.listType ) AND reFindNoCase( "^(listing|grid)$", rc.listType ) ) {
+ if ( !isNull( rc.listType ) && reFindNoCase( "^(listing|grid)$", rc.listType ) ) {
var prefs = getPreferences();
- if ( NOT structKeyExists( prefs, "listType" ) OR prefs.listType NEQ rc.listType ) {
+ if ( !structKeyExists( prefs, "listType" ) || prefs.listType NEQ rc.listType ) {
prefs.listType = rc.listType;
cookieStorage.set( "fileBrowserPrefs", serializeJSON( prefs ) );
}
}
- if ( !isNull( rc.listFolder ) AND reFindNoCase( "^(all|dir)$", rc.listFolder ) ) {
+ if ( !isNull( rc.listFolder ) && reFindNoCase( "^(all|dir)$", rc.listFolder ) ) {
var prefs = getPreferences();
- if ( NOT structKeyExists( prefs, "listFolder" ) OR prefs.listFolder NEQ rc.listFolder ) {
+ if ( !structKeyExists( prefs, "listFolder" ) || prefs.listFolder NEQ rc.listFolder ) {
prefs.listFolder = rc.listFolder;
cookieStorage.set( "fileBrowserPrefs", serializeJSON( prefs ) );
}
@@ -565,7 +631,7 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Merge module settings and custom settings
*/
- private struct function mergeSettings( struct oldSettings, struct settings = {} ){
+ private struct function mergeSettings( struct oldSettings, struct settings = {} ) {
// Mrege Settings
structAppend(
arguments.oldSettings,
@@ -593,24 +659,24 @@ component extends="cbadmin.handlers.baseHandler" {
/**
* Inflate flash params if they exist into the appropriate function variables.
*/
- private function inflateFlashParams( event, rc, prc ){
+ private function inflateFlashParams( event, rc, prc ) {
// Check if callbacks stored in flash.
- if ( structKeyExists( flash.get( "fileBrowser", {} ), "callback" ) and len( flash.get( "fileBrowser" ).callback ) ) {
+ if (
+ structKeyExists( flash.get( "fileBrowser", {} ), "callback" ) && len( flash.get( "fileBrowser" ).callback )
+ ) {
rc.callback = flash.get( "fileBrowser" ).callback;
}
// cancel callback
if (
- structKeyExists( flash.get( "fileBrowser", {} ), "cancelCallback" ) and len(
- flash.get( "fileBrowser" ).cancelCallback
- )
+ structKeyExists( flash.get( "fileBrowser", {} ), "cancelCallback" ) &&
+ len( flash.get( "fileBrowser" ).cancelCallback )
) {
rc.cancelCallback = flash.get( "fileBrowser" ).cancelCallback;
}
// filterType
if (
- structKeyExists( flash.get( "fileBrowser", {} ), "filterType" ) and len(
- flash.get( "fileBrowser" ).filterType
- )
+ structKeyExists( flash.get( "fileBrowser", {} ), "filterType" ) &&
+ len( flash.get( "fileBrowser" ).filterType )
) {
rc.filterType = flash.get( "fileBrowser" ).filterType;
}
@@ -621,17 +687,17 @@ component extends="cbadmin.handlers.baseHandler" {
if ( !flash.exists( "filebrowser" ) ) {
var filebrowser = {
- callback : rc.callback,
- cancelCallback : rc.cancelCallback,
- filterType : rc.filterType,
- settings : prc.fbsettings
+ callback : rc.callback,
+ cancelCallback: rc.cancelCallback,
+ filterType : rc.filterType,
+ settings : prc.fbsettings
};
flash.put(
- name = "filebrowser",
- value = filebrowser,
- autoPurge = false
- );
+ name = "filebrowser",
+ value = filebrowser,
+ autoPurge = false
+ );
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc
index d4bc040de6..527bdb52a6 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/ModuleConfig.cfc
@@ -6,29 +6,28 @@
* ContentBox Admin Markdown Editor Module
*/
component {
-
// Module Properties
- this.title = "ContentBox Markdown Editor";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox Markdown Module";
- this.viewParentLookup = true;
+ this.title = "ContentBox Markdown Editor";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox Markdown Module";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
- this.entryPoint = "cbadmin/markdown";
- this.dependencies = [ "contentbox-admin" ];
+ this.entryPoint = "cbadmin/markdown";
+ this.dependencies = [ "contentbox-admin"];
/**
* Configure
*/
- function configure(){
+ function configure() {
// SES Routes
- routes = [ { pattern : "/:handler/:action?" } ];
+ routes = [ { pattern: "/:handler/:action?" }];
// Custom Declared Points
interceptorSettings = {
// CB Admin Custom Events
- customInterceptionPoints : []
+ customInterceptionPoints: []
};
// interceptors
@@ -38,17 +37,19 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
var editorService = wirebox.getInstance( "EditorService@contentbox" );
- editorService.registerEditor( wirebox.getInstance( "MarkdownEditor@contentbox-markdowneditor" ) );
+ editorService.registerEditor(
+ wirebox.getInstance( "MarkdownEditor@contentbox-markdowneditor" )
+ );
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
var editorService = wirebox.getInstance( "EditorService@contentbox" );
editorService.unregisterEditor( "simplemde" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc
index 0b0f255133..622245ef14 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-markdowneditor/models/MarkdownEditor.cfc
@@ -5,12 +5,7 @@
* ---
* SimpleMDE Implementation
*/
-component
- implements="contentbox.models.ui.editors.IEditor"
- accessors ="true"
- singleton
-{
-
+component implements="contentbox.models.ui.editors.IEditor" accessors ="true" singleton {
// DI
property name="log" inject="logbox:logger:{this}";
@@ -25,21 +20,24 @@ component
required coldbox,
required settingService,
required html
- ){
+ ) {
// register dependencies
variables.interceptorService = arguments.coldbox.getInterceptorService();
- variables.requestService = arguments.coldbox.getRequestService();
- variables.coldbox = arguments.coldbox;
- variables.settingService = arguments.settingService;
- variables.html = arguments.html;
+ variables.requestService = arguments.coldbox.getRequestService();
+ variables.coldbox = arguments.coldbox;
+ variables.settingService = arguments.settingService;
+ variables.html = arguments.html;
// Store admin entry point and base URL settings
ADMIN_ENTRYPOINT = arguments.coldbox.getSetting( "modules" )[ "contentbox-admin" ].entryPoint;
- EDITOR_ROOT = arguments.coldbox.getSetting( "modules" )[ "contentbox-markdowneditor" ].mapping;
- HTML_BASE_URL = variables.requestService.getContext().getHTMLBaseURL();
+ EDITOR_ROOT = arguments.coldbox.getSetting( "modules" )[ "contentbox-markdowneditor" ].mapping;
+ HTML_BASE_URL = variables
+ .requestService
+ .getContext()
+ .getHTMLBaseURL();
// Store Toolbars
- variables.toolbarJS = buildToolbarJS( "content" );
+ variables.toolbarJS = buildToolbarJS( "content" );
variables.toolbarExcerptJS = buildToolbarJS( "excerpt" );
// Register our Editor events
@@ -51,30 +49,30 @@ component
/**
* Get the internal name of an editor
*/
- function getName(){
+ function getName() {
return "simplemde";
}
/**
* Get the display name of an editor
*/
- function getDisplayName(){
+ function getDisplayName() {
return "Code Editor";
- };
+ }
/**
* Startup the editor(s) on a page
*/
- function startup(){
+ function startup() {
// prepare toolbar announcement on startup
var iData = {
- toolbar : variables.toolbarJS,
- excerptToolbar : variables.toolbarExcerptJS
+ toolbar : variables.toolbarJS,
+ excerptToolbar: variables.toolbarExcerptJS
};
// Announce the editor toolbar is about to be processed
interceptorService.announce( "cbadmin_mdEditorToolbar", iData );
// Load extra configuration
- var iData2 = { extraConfig : "" };
+ var iData2 = { extraConfig: "" };
// Announce extra configuration
interceptorService.announce( "cbadmin_mdEditorExtraConfig", iData2 );
// Now prepare our JavaScript and load it.
@@ -85,197 +83,204 @@ component
* This is fired once editor javascript loads, you can use this to return back functions, asset calls, etc.
* return the appropriate JavaScript
*/
- function loadAssets(){
+ function loadAssets() {
var js = "";
// Load Assets, they are included with ContentBox
- html.addAsset( "#variables.EDITOR_ROOT#/includes/simplemde/simplemde.min.css" );
- html.addAsset( "#variables.EDITOR_ROOT#/includes/simplemde/simplemde.min.js" );
+ html.addAsset(
+ "#variables.EDITOR_ROOT#/includes/simplemde/simplemde.min.css"
+ );
+ html.addAsset(
+ "#variables.EDITOR_ROOT#/includes/simplemde/simplemde.min.js"
+ );
// Custom Styles
// cfformat-ignore-start
html.addStyleContent(
- "
- .CodeMirror{
- height: 100% !important;
- }
- .CodeMirror-fullscreen{
- z-index: 1000 !important;
- }
- div.fullscreen{
- z-index: 1000 !important;
- }
- ",
- true
- );
-
+"
+.CodeMirror{
+height: 100% !important;
+}
+.CodeMirror-fullscreen{
+z-index: 1000 !important;
+}
+div.fullscreen{
+z-index: 1000 !important;
+}
+",
+true
+);
savecontent variable="js" {
- writeOutput( "
- function getContentEditor(){
- return simpleMDE_content.codemirror;
- }
- function getExcerptEditor(){
- return simpleMDE_excerpt.codemirror;
- }
- function checkIsDirty(){
- return simpleMDE_content.isDirty;
- }
- function getEditorContent(){
- return simpleMDE_content.value();
- }
- function getEditorExcerpt(){
- return simpleMDE_excerpt.value();
- }
- function updateEditorContent(){
- }
- function updateEditorExcerpt(){
- }
- function setEditorContent( editorName, content ){
- if( editorName.indexOf( 'content' ) >= 0 ){
- simpleMDE_content.value( content );
- } else {
- simpleMDE_excerpt.value( content );
- }
- }
- function insertEditorContent( editorName, content ){
- if( editorName.indexOf( 'content' ) >= 0 ){
- simpleMDE_content.codemirror.replaceRange( content, simpleMDE_content.codemirror.getCursor() );
- } else {
- simpleMDE_excerpt.codemirror.replaceRange( content, simpleMDE_excerpt.codemirror.getCursor() );
- }
- }
+writeOutput(
+"
+function getContentEditor(){
+return simpleMDE_content.codemirror;
+}
+function getExcerptEditor(){
+return simpleMDE_excerpt.codemirror;
+}
+function checkIsDirty(){
+return simpleMDE_content.isDirty;
+}
+function getEditorContent(){
+return simpleMDE_content.value();
+}
+function getEditorExcerpt(){
+return simpleMDE_excerpt.value();
+}
+function updateEditorContent(){
+}
+function updateEditorExcerpt(){
+}
+function setEditorContent( editorName, content ){
+if( editorName.indexOf( 'content' ) >= 0 ){
+simpleMDE_content.value( content );
+} else {
+simpleMDE_excerpt.value( content );
+}
+}
+function insertEditorContent( editorName, content ){
+if( editorName.indexOf( 'content' ) >= 0 ){
+simpleMDE_content.codemirror.replaceRange( content, simpleMDE_content.codemirror.getCursor() );
+} else {
+simpleMDE_excerpt.codemirror.replaceRange( content, simpleMDE_excerpt.codemirror.getCursor() );
+}
+}
- // Insert Widgets
- $insertCBWidget = function( editor ){
- // Open the selector widget dialog.
- openRemoteModal(
- getWidgetSelectorURL(),
- { editorName : editor },
- $( window ).width() - 200,
- $( window ).height() - 300,
- true
- );
- };
+// Insert Widgets
+$insertCBWidget = function( editor ){
+// Open the selector widget dialog.
+openRemoteModal(
+ getWidgetSelectorURL(),
+ { editorName : editor },
+ $( window ).width() - 200,
+ $( window ).height() - 300,
+ true
+ );
+};
- // Insert ContentStore
- $insertCBContentStore = function( editor ){
- // Open the selector widget dialog.
- openRemoteModal( getContentStoreSelectorURL(), { editorName: editor } );
- };
+// Insert ContentStore
+$insertCBContentStore = function( editor ){
+// Open the selector widget dialog.
+openRemoteModal( getContentStoreSelectorURL(), { editorName: editor } );
+};
- // Insert Entry Link
- $insertCBEntryLink = function( editor ){
- // Open the selector widget dialog.
- openRemoteModal( getEntrySelectorURL(), { editorName: editor } );
- };
+// Insert Entry Link
+$insertCBEntryLink = function( editor ){
+// Open the selector widget dialog.
+openRemoteModal( getEntrySelectorURL(), { editorName: editor } );
+};
- // Insert Page Link
- $insertCBPageLink = function( editor ){
- // Open the selector widget dialog.
- openRemoteModal( getPageSelectorURL(), { editorName: editor } );
- };
+// Insert Page Link
+$insertCBPageLink = function( editor ){
+// Open the selector widget dialog.
+openRemoteModal( getPageSelectorURL(), { editorName: editor } );
+};
- // Insert Media
- $insertCBMedia = function( editor ){
- simpleMDETargetEditor = editor;
- loadAssetChooser( '$insertCBMediaContent' );
- };
- // Choose Media
- $insertCBMediaContent = function( sPath, sURL, sType ){
- if( !sPath.length || sType === 'dir' ){
- alert( 'Please select a file first.' );
- return;
- }
- var link = '';
- insertEditorContent( simpleMDETargetEditor, link );
- closeRemoteModal();
- }
- ");
- }
+// Insert Media
+$insertCBMedia = function( editor ){
+simpleMDETargetEditor = editor;
+loadAssetChooser( '$insertCBMediaContent' );
+};
+// Choose Media
+$insertCBMediaContent = function( sPath, sURL, sType ){
+if( !sPath.length || sType === 'dir' ){
+ alert( 'Please select a file first.' );
+ return;
+}
+var link = '';
+insertEditorContent( simpleMDETargetEditor, link );
+closeRemoteModal();
+}
+"
+);
+}
// cfformat-ignore-end
return js;
- };
+ }
/**
- * Compile the needed JS to display into the screen
+ * Shutdown the editor(s) on a page
*/
- private function compileJS( required iData, required iData2 ){
+ function shutdown() {
var js = "";
-
- // Determine Extra Configuration
- var extraConfig = "";
- if ( len( arguments.iData2.extraConfig ) ) {
- extraConfig = "#arguments.iData2.extraConfig#,";
- }
-
// cfformat-ignore-start
savecontent variable="js" {
- writeOutput( "
- // Activate on content object
- simpleMDE_content = new SimpleMDE( {
- #extraConfig#
- element : document.getElementById( 'content' ),
- autosave : { enabled : false },
- promptURLs : true,
- tabSize : 4,
- forceSync : true,
- placeholder : 'Type here...',
- spellChecker : false,
- toolbar : #arguments.iData.toolbar#
- } );
-
- // Active Excerpts
- if( $withExcerpt ){
- // Activate on content object
- simpleMDE_excerpt = new SimpleMDE( {
- #extraConfig#
- element : document.getElementById( 'excerpt' ),
- autosave : { enabled : false },
- promptURLs : true,
- tabSize : 4,
- forceSync : true,
- placeholder : 'Type here...',
- spellChecker : false,
- toolbar : #arguments.iData.excerptToolbar#
- } );
- };
-
- // Global Configuration Variables
- simpleMDETargetEditor = '';
- simpleMDE_content.isDirty = false;
-
- // Listen for Editor Changes
- simpleMDE_content.codemirror.on( 'change', function(){
- simpleMDE_content.isDirty = true;
- } );
- " );
- }
+writeOutput(
+"
+// Activate on content object
+simpleMDE_content.toTextArea();
+simpleMDE_content = null;
+// Active Excerpts
+try{
+simpleMDE_excerpt.toTextArea();
+simpleMDE_excerpt = null;
+} catch( error ){
+// ignore.
+}
+"
+);
+}
// cfformat-ignore-end
return js;
}
/**
- * Shutdown the editor(s) on a page
+ * Compile the needed JS to display into the screen
*/
- function shutdown(){
+ private function compileJS( required iData, required iData2 ) {
var js = "";
+ // Determine Extra Configuration
+ var extraConfig = "";
+ if ( len( arguments.iData2.extraConfig ) ) {
+ extraConfig = "#arguments.iData2.extraConfig#,";
+ }
// cfformat-ignore-start
savecontent variable="js" {
- writeOutput( "
- // Activate on content object
- simpleMDE_content.toTextArea();
- simpleMDE_content = null;
- // Active Excerpts
- try{
- simpleMDE_excerpt.toTextArea();
- simpleMDE_excerpt = null;
- } catch( error ){
- // ignore.
- }
- ");
- }
+writeOutput(
+"
+// Activate on content object
+simpleMDE_content = new SimpleMDE( {
+#extraConfig#
+element : document.getElementById( 'content' ),
+autosave : { enabled : false },
+promptURLs : true,
+tabSize : 4,
+forceSync : true,
+placeholder : 'Type here...',
+spellChecker : false,
+toolbar : #arguments.iData.toolbar#
+} );
+
+// Active Excerpts
+if( $withExcerpt ){
+// Activate on content object
+simpleMDE_excerpt = new SimpleMDE( {
+#extraConfig#
+element : document.getElementById( 'excerpt' ),
+autosave : { enabled : false },
+promptURLs : true,
+tabSize : 4,
+forceSync : true,
+placeholder : 'Type here...',
+spellChecker : false,
+toolbar : #arguments.iData.excerptToolbar#
+} );
+};
+
+// Global Configuration Variables
+simpleMDETargetEditor = '';
+simpleMDE_content.isDirty = false;
+
+// Listen for Editor Changes
+simpleMDE_content.codemirror.on( 'change', function(){
+simpleMDE_content.isDirty = true;
+} );
+"
+);
+}
// cfformat-ignore-end
return js;
@@ -286,71 +291,73 @@ component
*
* @editor The editor name to bind the toolbar to
*/
- private function buildToolbarJS( required editor ){
+ private function buildToolbarJS( required editor ) {
// cfformat-ignore-start
return "[
- {
- name : 'cbSave',
- action : function(){ quickSave(); },
- className : 'fa fa-save',
- title : 'ContentBox Quick Save'
- },
- {
- name : 'cbUndo',
- action : function(){ simpleMDE_#arguments.editor#.undo(); },
- className : 'fa fa-undo',
- title : 'Undo'
- },
- {
- name : 'cbRedo',
- action : function(){ simpleMDE_#arguments.editor#.redo(); },
- className : 'fa fa-repeat',
- title : 'Redo'
- },
- '|',
- 'bold', 'italic', 'strikethrough', 'heading', 'heading-smaller', 'heading-bigger', '|',
- 'code', 'quote', 'unordered-list', 'ordered-list', '|',
- 'link', 'image', 'table', 'horizontal-rule', '|',
- 'preview', 'side-by-side', 'fullscreen',
- {
- name : 'cbLivePreview',
- action : function(){ previewContent(); },
- className : 'fa fa-bolt',
- title : 'ContentBox Responsive Preview'
- },
- '|',
- {
- name : 'cbWidget',
- action : function(){ $insertCBWidget( '#arguments.editor#' ); },
- className : 'fa fa-magic',
- title : 'Insert a ContentBox Widget'
- },
- {
- name : 'cbContentStore',
- action : function(){ $insertCBContentStore( '#arguments.editor#' ); },
- className : 'fa fa-hdd',
- title : 'Insert ContentBox Content Store Item'
- },
- {
- name : 'cbEntryLink',
- action : function(){ $insertCBEntryLink( '#arguments.editor#' ); },
- className : 'fas fa-blog',
- title : 'Insert ContentBox Entry Link'
- },
- {
- name : 'cbPageLink',
- action : function(){ $insertCBPageLink( '#arguments.editor#' ); },
- className : 'fa fa-file-o',
- title : 'Insert ContentBox Page Link'
- },
- {
- name : 'cbMediaManager',
- action : function(){ $insertCBMedia( '#arguments.editor#' ); },
- className : 'fa fa-database',
- title : 'Insert ContentBox Media'
- }
- ]";
+{
+name : 'cbSave',
+action : function(){ quickSave(); },
+className : 'fa fa-save',
+title : 'ContentBox Quick Save'
+},
+{
+name : 'cbUndo',
+action : function(){ simpleMDE_#arguments.editor#.undo(); },
+className : 'fa fa-undo',
+title : 'Undo'
+},
+{
+name : 'cbRedo',
+action : function(){ simpleMDE_#arguments.editor#.redo(); },
+className : 'fa fa-repeat',
+title : 'Redo'
+},
+'|',
+'bold', 'italic', 'strikethrough', 'heading', 'heading-smaller', 'heading-bigger', '|',
+'code', 'quote', 'unordered-list', 'ordered-list', '|',
+'link', 'image', 'table', 'horizontal-rule', '|',
+'preview', 'side-by-side', 'fullscreen',
+{
+name : 'cbLivePreview',
+action : function(){ previewContent(); },
+className : 'fa fa-bolt',
+title : 'ContentBox Responsive Preview'
+},
+'|',
+{
+name : 'cbWidget',
+action : function(){ $insertCBWidget( '#arguments.editor#' ); },
+className : 'fa fa-magic',
+title : 'Insert a ContentBox Widget'
+},
+{
+name : 'cbContentStore',
+action : function(){ $insertCBContentStore( '#arguments.editor#' ); },
+className : 'fa fa-hdd',
+title : 'Insert ContentBox Content Store Item'
+},
+{
+name : 'cbEntryLink',
+action : function(){ $insertCBEntryLink( '#arguments.editor#' ); },
+className : 'fas fa-blog',
+title : 'Insert ContentBox Entry Link'
+},
+{
+name : 'cbPageLink',
+action : function(){ $insertCBPageLink( '#arguments.editor#' ); },
+className : 'fa fa-file-o',
+title : 'Insert ContentBox Page Link'
+},
+{
+name : 'cbMediaManager',
+action : function(){ $insertCBMedia( '#arguments.editor#' ); },
+className : 'fa fa-database',
+title : 'Insert ContentBox Media'
+}
+]";
+
+
// cfformat-ignore-end
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/ModuleConfig.cfc
index 921fd56e5d..b3b231c211 100755
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/ModuleConfig.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,46 +6,45 @@
* ContentBox Security module configuration
*/
component {
-
// Module Properties
- this.title = "ContentBox Security";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox Security Module";
- this.viewParentLookup = true;
+ this.title = "ContentBox Security";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox Security Module";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
- this.entryPoint = "cbadmin/security";
- this.dependencies = [ "contentbox-admin" ];
+ this.entryPoint = "cbadmin/security";
+ this.dependencies = [ "contentbox-admin"];
- function configure(){
+ function configure() {
// Layout Settings
- layoutSettings = { defaultLayout : "simple.cfm" };
+ layoutSettings = { defaultLayout: "simple.cfm" };
// i18n
- cbi18n = { resourceBundles : { "security" : "#moduleMapping#/includes/i18n/security" } };
+ cbi18n = { resourceBundles: { "security": "#moduleMapping#/includes/i18n/security" } };
// SES Routes
routes = [
- { pattern : "/", handler : "security", action : "login" },
- { pattern : "/twofactor/:action?", handler : "twofactor" },
+ { pattern: "/", handler: "security", action: "login" },
+ { pattern: "/twofactor/:action?", handler: "twofactor" },
{
- pattern : "/twofactorEnrollment/:action?",
- handler : "twofactorEnrollment"
+ pattern: "/twofactorEnrollment/:action?",
+ handler: "twofactorEnrollment"
},
{
- pattern : "/language/:lang",
- handler : "security",
- action : "changelang"
+ pattern: "/language/:lang",
+ handler: "security",
+ action : "changelang"
},
- { pattern : "/:action", handler : "security" },
- { pattern : "/:handler/:action?" }
+ { pattern: "/:action", handler: "security" },
+ { pattern: "/:handler/:action?" }
];
// Custom Declared Points
interceptorSettings = {
// CB Admin Custom Events
- customInterceptionPoints : [
+ customInterceptionPoints: [
// Login Layout HTML points
"cbadmin_beforeLoginHeadEnd",
"cbadmin_afterLoginBodyStart",
@@ -77,4 +76,4 @@ component {
};
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/baseHandler.cfc
index 40dc7a3335..296eede236 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/baseHandler.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/baseHandler.cfc
@@ -6,20 +6,23 @@
* ContentBox security handler
*/
component {
-
// DI
property name="securityService" inject="securityService@contentbox";
+
property name="authorService" inject="authorService@contentbox";
+
property name="cb" inject="cbhelper@contentbox";
+
property name="messagebox" inject="messagebox@cbMessagebox";
+
property name="twoFactorService" inject="twoFactorService@contentbox";
/**
* Pre handler
*/
- function preHandler( event, currentAction, rc, prc ){
- prc.langs = getModuleSettings( "contentbox" ).languages;
+ function preHandler( event, currentAction, rc, prc ) {
+ prc.langs = getModuleSettings( "contentbox" ).languages;
prc.xehLang = event.buildLink( "#prc.cbAdminEntryPoint#/language" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc
index 98f4b9c072..643e0dde93 100755
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/security.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,17 +6,15 @@
* ContentBox security handler
*/
component extends="baseHandler" {
-
// DI
property name="markdown" inject="Processor@cbmarkdown";
-
// Method Security
- this.allowedMethods = { doLogin : "POST", doLostPassword : "POST" };
+ this.allowedMethods = { doLogin: "POST", doLostPassword: "POST" };
/**
* Change language
*/
- function changeLang( event, rc, prc ){
+ function changeLang( event, rc, prc ) {
event.paramValue( "lang", "en_US" );
setFWLocale( rc.lang );
relocate( "#prc.cbAdminEntryPoint#/security" );
@@ -25,12 +23,12 @@ component extends="baseHandler" {
/**
* Login screen
*/
- function login( event, rc, prc ){
+ function login( event, rc, prc ) {
// exit handlers
- prc.xehDoLogin = "#prc.cbAdminEntryPoint#.security.doLogin";
+ prc.xehDoLogin = "#prc.cbAdminEntryPoint#.security.doLogin";
prc.xehLostPassword = "#prc.cbAdminEntryPoint#.security.lostPassword";
// remember me
- prc.rememberMe = variables.securityService.getRememberMe();
+ prc.rememberMe = variables.securityService.getRememberMe();
// secured URL from security interceptor
arguments.event.paramValue( "_securedURL", "" );
rc._securedURL = rc._securedURL;
@@ -43,7 +41,7 @@ component extends="baseHandler" {
/**
* Do a login
*/
- function doLogin( event, rc, prc ){
+ function doLogin( event, rc, prc ) {
// params
event
.paramValue( "rememberMe", 0 )
@@ -62,26 +60,29 @@ component extends="baseHandler" {
try {
// Authenticate credentials: Don't log them in because we could have a reset password bit or a mfa check.
prc.oAuthor = securityService.authenticate(
- username : rc.username,
- password : rc.password,
- logThemIn: false
- );
+ username = rc.username,
+ password = rc.password,
+ logThemIn = false
+ );
// Verify if user needs to reset their password?
if ( prc.oAuthor.getIsPasswordReset() ) {
var token = variables.securityService.generateResetToken( prc.oAuthor );
variables.messagebox.info( cb.r( "messages.password_reset_detected@security" ) );
- return relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#token#" );
+ return relocate(
+ event = "#prc.cbAdminEntryPoint#.security.verifyReset",
+ queryString = "token=#token#"
+ );
}
// If Global MFA is turned on and the user is not enrolled to a provider, then force it to enroll
- if ( variables.twoFactorService.isForceTwoFactorAuth() AND !prc.oAuthor.getIs2FactorAuth() ) {
+ if ( variables.twoFactorService.isForceTwoFactorAuth() && !prc.oAuthor.getIs2FactorAuth() ) {
return runEvent(
event = "contentbox-security:twoFactorEnrollment.forceEnrollment",
eventArguments = {
- authorID : prc.oAuthor.getAuthorID(),
- relocationURL : _securedURL,
- rememberMe : rc.rememberMe
+ authorID : prc.oAuthor.getAuthorID(),
+ relocationURL: _securedURL,
+ rememberMe : rc.rememberMe
}
);
}
@@ -90,14 +91,14 @@ component extends="baseHandler" {
if ( variables.twoFactorService.canChallenge( prc.oAuthor ) ) {
// Flash data needed for authorizations
flash.put(
- "authorData",
- {
- authorID : prc.oAuthor.getAuthorID(),
- rememberMe : rc.rememberMe,
- securedURL : rc._securedURL,
- isEnrollment : false
- }
- );
+ "authorData",
+ {
+ authorID : prc.oAuthor.getAuthorID(),
+ rememberMe : rc.rememberMe,
+ securedURL : rc._securedURL,
+ isEnrollment: false
+ }
+ );
// Send challenge
var twoFactorResults = variables.twoFactorService.sendChallenge( prc.oAuthor );
// Verify error, if so, log it and setup a messagebox
@@ -110,12 +111,15 @@ component extends="baseHandler" {
}
// Set keep me log in remember cookie, if set.
- variables.securityService.setRememberMe( username: rc.username, days: val( rc.rememberMe ) );
+ variables.securityService.setRememberMe( username = rc.username, days = val( rc.rememberMe ) );
// Set in session, validations are now complete
variables.securityService.login( prc.oAuthor );
// announce event
- announce( "cbadmin_onLogin", { author : prc.oAuthor, securedURL : rc._securedURL } );
+ announce(
+ "cbadmin_onLogin",
+ { author: prc.oAuthor, securedURL: rc._securedURL }
+ );
// check if securedURL came in?
if ( len( rc._securedURL ) ) {
@@ -123,14 +127,14 @@ component extends="baseHandler" {
} else {
relocate( "#prc.cbAdminEntryPoint#.dashboard" );
}
- } catch ( InvalidCredentials e ) {
+ } catch (InvalidCredentials e) {
// announce event
announce( "cbadmin_onBadLogin" );
// message and redirect
variables.messagebox.warn( cb.r( "messages.invalid_credentials@security" ) );
// Relocate back to login
relocate( "#prc.cbAdminEntryPoint#.security.login" );
- } catch ( any e ) {
+ } catch (any e) {
rethrow;
}
}
@@ -138,7 +142,7 @@ component extends="baseHandler" {
/**
* Logout a user
*/
- function doLogout( event, rc, prc ){
+ function doLogout( event, rc, prc ) {
// announce event
announce( "cbadmin_onLogout" );
// logout
@@ -156,8 +160,8 @@ component extends="baseHandler" {
/**
* Present lost password screen
*/
- function lostPassword( event, rc, prc ){
- prc.xehLogin = "#prc.cbAdminEntryPoint#.security.login";
+ function lostPassword( event, rc, prc ) {
+ prc.xehLogin = "#prc.cbAdminEntryPoint#.security.login";
prc.xehDoLostPassword = "#prc.cbAdminEntryPoint#.security.doLostPassword";
event.setView( "security/lostPassword" );
@@ -166,8 +170,8 @@ component extends="baseHandler" {
/**
* Do lost password reset
*/
- function doLostPassword( event, rc, prc ){
- var errors = [];
+ function doLostPassword( event, rc, prc ) {
+ var errors = [];
var oAuthor = "";
// Param email
@@ -180,29 +184,45 @@ component extends="baseHandler" {
}
// Validate email
- if ( NOT trim( rc.email ).length() ) {
- arrayAppend( errors, "#cb.r( "validation.need_email@security" )#
" );
+ if ( !trim( rc.email ).length() ) {
+ arrayAppend(
+ errors,
+ "#cb.r( "validation.need_email@security" )#
"
+ );
} else {
// Try To get the Author
- oAuthor = authorService.findWhere( { email : rc.email, isActive : 1 } );
- if ( isNull( oAuthor ) OR NOT oAuthor.isLoaded() ) {
+ oAuthor = authorService.findWhere( { email: rc.email, isActive: 1 } );
+ if ( isNull( oAuthor ) || !oAuthor.isLoaded() ) {
// Don't give away that the email did not exist.
- messagebox.info( cb.r( resource = "messages.lostpassword_check@security", values = "5" ) );
+ messagebox.info(
+ cb.r(
+ resource = "messages.lostpassword_check@security",
+ values = "5"
+ )
+ );
return relocate( "#prc.cbAdminEntryPoint#.security.lostPassword" );
}
}
// Check if Errors
- if ( NOT arrayLen( errors ) ) {
+ if ( !arrayLen( errors ) ) {
// Send Reminder
securityService.sendPasswordReminder( oAuthor );
// announce event
- announce( "cbadmin_onPasswordReminder", { author : oAuthor } );
+ announce( "cbadmin_onPasswordReminder", { author: oAuthor } );
// messagebox
- messagebox.info( cb.r( resource = "messages.reminder_sent@security", values = "30" ) );
+ messagebox.info(
+ cb.r(
+ resource = "messages.reminder_sent@security",
+ values = "30"
+ )
+ );
} else {
// announce event
- announce( "cbadmin_onInvalidPasswordReminder", { errors : errors, email : rc.email } );
+ announce(
+ "cbadmin_onInvalidPasswordReminder",
+ { errors: errors, email: rc.email }
+ );
// messagebox
messagebox.error( errors );
}
@@ -213,14 +233,14 @@ component extends="baseHandler" {
/**
* Verify the reset
*/
- function verifyReset( event, rc, prc ){
+ function verifyReset( event, rc, prc ) {
event.paramValue( "token", "" );
// Validate Token
var results = variables.securityService.validateResetToken( trim( rc.token ) );
if ( results.error ) {
// announce event
- announce( "cbadmin_onInvalidPasswordReset", { token : rc.token } );
+ announce( "cbadmin_onInvalidPasswordReset", { token: rc.token } );
// Exception
variables.messagebox.error( cb.r( "messages.invalid_token@security" ) );
return relocate( "#prc.cbAdminEntryPoint#.security.lostPassword" );
@@ -234,7 +254,7 @@ component extends="baseHandler" {
/**
* Reset a user password. Must have a valid user token setup already
*/
- function doPasswordChange( event, rc, prc ){
+ function doPasswordChange( event, rc, prc ) {
event
.paramValue( "token", "" )
.paramValue( "password", "" )
@@ -245,21 +265,30 @@ component extends="baseHandler" {
if ( !csrfVerify( rc._csrftoken ) ) {
messagebox.warning( cb.r( "messages.invalid_token@security" ) );
- return relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" );
+ return relocate(
+ event = "#prc.cbAdminEntryPoint#.security.verifyReset",
+ queryString = "token=#rc.token#"
+ );
}
// Validate passwords
if ( !len( rc.password ) || !len( rc.password_confirmation ) ) {
// Exception
messagebox.error( cb.r( "messages.invalid_password@security" ) );
- relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" );
+ relocate(
+ event = "#prc.cbAdminEntryPoint#.security.verifyReset",
+ queryString = "token=#rc.token#"
+ );
return;
}
// Validate confirmed password
- if ( compare( rc.password, rc.password_confirmation ) neq 0 ) {
+ if ( compare( rc.password, rc.password_confirmation ) NEQ 0 ) {
messagebox.error( cb.r( "messages.password_mismatch@security" ) );
- relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" );
+ relocate(
+ event = "#prc.cbAdminEntryPoint#.security.verifyReset",
+ queryString = "token=#rc.token#"
+ );
return;
}
@@ -267,7 +296,7 @@ component extends="baseHandler" {
var results = securityService.validateResetToken( trim( rc.token ) );
if ( results.error ) {
// announce event
- announce( "cbadmin_onInvalidPasswordReset", { token : rc.token } );
+ announce( "cbadmin_onInvalidPasswordReset", { token: rc.token } );
// Exception
messagebox.error( cb.r( "messages.invalid_token@security" ) );
relocate( "#prc.cbAdminEntryPoint#.security.lostPassword" );
@@ -277,32 +306,35 @@ component extends="baseHandler" {
// Validate you are not using the same password if persisted already
if ( authorService.isSameHash( rc.password, results.author.getPassword() ) ) {
// announce event
- announce( "cbadmin_onInvalidPasswordReset", { token : rc.token } );
+ announce( "cbadmin_onInvalidPasswordReset", { token: rc.token } );
// Exception
messagebox.error( cb.r( "messages.password_used@security" ) );
- relocate( event = "#prc.cbAdminEntryPoint#.security.verifyReset", queryString = "token=#rc.token#" );
+ relocate(
+ event = "#prc.cbAdminEntryPoint#.security.verifyReset",
+ queryString = "token=#rc.token#"
+ );
return;
}
// Token is valid, let's reset this sucker.
var resetResults = securityService.resetUserPassword(
- token = rc.token,
- author = results.author,
- password = rc.password
- );
+ token = rc.token,
+ author = results.author,
+ password = rc.password
+ );
if ( resetResults.error ) {
// announce event
- announce( "cbadmin_onInvalidPasswordReset", { token : rc.token } );
+ announce( "cbadmin_onInvalidPasswordReset", { token: rc.token } );
messagebox.error( resetResults.messages );
relocate( "#prc.cbAdminEntryPoint#.security.lostPassword" );
return;
}
// announce event and relcoate to login with new password
- announce( "cbadmin_onPasswordReset", { author : results.author } );
+ announce( "cbadmin_onPasswordReset", { author: results.author } );
messagebox.info( cb.r( "messages.password_reset@security" ) );
relocate( "#prc.cbAdminEntryPoint#.security.login" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc
index 404590fc4c..49ef969212 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactor.cfc
@@ -6,18 +6,17 @@
* ContentBox two factor authenticator handler
*/
component extends="baseHandler" {
-
// Method Security
this.allowedMethods = {
- "index" : "GET",
- "doValidation" : "POST",
- "resendCode" : "GET"
+ "index" : "GET",
+ "doValidation": "POST",
+ "resendCode" : "GET"
};
/**
* Pre handler
*/
- function preHandler( event, currentAction, rc, prc ){
+ function preHandler( event, currentAction, rc, prc ) {
super.preHandler( argumentCollection = arguments );
// Keep Flash data
flash.keep( "authorData" );
@@ -31,7 +30,7 @@ component extends="baseHandler" {
// Inflate author for requested events
prc.oAuthor = authorService.get( flash.get( "authorData" ).authorID );
// Verify author, just in case
- if ( isNull( prc.oAuthor ) OR !prc.oAuthor.isLoaded() ) {
+ if ( isNull( prc.oAuthor ) || !prc.oAuthor.isLoaded() ) {
// message and redirect
messagebox.warn( cb.r( "messages.notauthenticated@security" ) );
// Relocate
@@ -48,10 +47,10 @@ component extends="baseHandler" {
* - rememberMe : Do we remember the device, defaults to false
* - securedURL : Where to go next as relocation, defaults to ""
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
prc.xehValidate = "#prc.cbAdminEntryPoint#.security.twofactor.doValidation";
- prc.xehResend = "#prc.cbAdminEntryPoint#.security.twofactor.resendCode";
- prc.provider = variables.twoFactorService.getDefaultProviderObject();
+ prc.xehResend = "#prc.cbAdminEntryPoint#.security.twofactor.resendCode";
+ prc.provider = variables.twoFactorService.getDefaultProviderObject();
event.setView( "twofactor/index" );
}
@@ -59,7 +58,7 @@ component extends="baseHandler" {
/**
* Validate the two factor code against a provider
*/
- function doValidation( event, rc, prc ){
+ function doValidation( event, rc, prc ) {
event.paramValue( "twofactorCode", "" ).paramValue( "trustDevice", false );
// Get author data
@@ -70,7 +69,7 @@ component extends="baseHandler" {
// Check for errors
if ( results.error ) {
- announce( "cbadmin_onInvalidTwoFactor", { author : prc.oAuthor } );
+ announce( "cbadmin_onInvalidTwoFactor", { author: prc.oAuthor } );
// message and redirect
variables.messagebox.error( results.messages );
flash.keep( "authorData" );
@@ -78,18 +77,18 @@ component extends="baseHandler" {
} else {
var oTwoFactorProvider = variables.twoFactorService.getDefaultProviderObject();
// Are we trusting devices? If so, trust this device if passed
- if ( oTwoFactorProvider.allowTrustedDevice() AND rc.trustDevice ) {
+ if ( oTwoFactorProvider.allowTrustedDevice() && rc.trustDevice ) {
variables.twoFactorService.setTrustedDevice( prc.oAuthor.getAuthorID() );
}
// Call Provider finalize callback, in case something is needed for teardowns
oTwoFactorProvider.finalize( rc.twofactorcode, prc.oAuthor );
// Set keep me log in remember cookie, if set.
variables.securityService.setRememberMe(
- username: prc.oAuthor.getUsername(),
- days : val( authorData.rememberMe )
- );
+ username = prc.oAuthor.getUsername(),
+ days = val( authorData.rememberMe )
+ );
// announce valid two factor
- announce( "cbadmin_onValidTwoFactor", { author : prc.oAuthor } );
+ announce( "cbadmin_onValidTwoFactor", { author: prc.oAuthor } );
// Are we in enrollment or loging in mode.
if ( authorData.isEnrollment ) {
@@ -103,7 +102,10 @@ component extends="baseHandler" {
// Set in session, validations are now complete
variables.securityService.login( prc.oAuthor );
// announce event
- announce( "cbadmin_onLogin", { author : prc.oAuthor, securedURL : authorData.securedURL } );
+ announce(
+ "cbadmin_onLogin",
+ { author: prc.oAuthor, securedURL: authorData.securedURL }
+ );
}
// check if securedURL came in?
@@ -118,7 +120,7 @@ component extends="baseHandler" {
/**
* Resend a two-factor validation code
*/
- function resendCode( event, rc, prc ){
+ function resendCode( event, rc, prc ) {
// Send challenge
var twoFactorResults = variables.twoFactorService.sendChallenge( prc.oAuthor );
// Verify error, if so, log it and setup a messagebox
@@ -135,4 +137,4 @@ component extends="baseHandler" {
relocate( "#prc.cbAdminEntryPoint#.security.twofactor" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactorEnrollment.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactorEnrollment.cfc
index 10215fffac..b981583429 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactorEnrollment.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/handlers/twofactorEnrollment.cfc
@@ -6,7 +6,13 @@ component extends="baseHandler" {
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
super.preHandler( argumentCollection = arguments );
// Param In Arguments
@@ -16,7 +22,7 @@ component extends="baseHandler" {
.paramValue( "rememberMe", false );
// Detect In arguments from eventarguments incorporation
- var inArgs = [ "authorID", "relocationURL", "rememberMe" ];
+ var inArgs = [ "authorID", "relocationURL", "rememberMe"];
for ( var thisArg in inArgs ) {
if ( eventArguments.keyExists( thisArg ) ) {
rc[ thisArg ] = eventArguments[ thisArg ];
@@ -37,28 +43,24 @@ component extends="baseHandler" {
/**
* Force Enrollment Form
*/
- function forceEnrollment( event, rc, prc ){
+ function forceEnrollment( event, rc, prc ) {
// If not relocation URL set, default to editor
if ( !rc.relocationURL.len() ) {
rc.relocationURL = event.buildLink(
- "#prc.cbAdminEntryPoint#/authors/editor/authorID/#prc.oCurrentAuthor.getAuthorID()###twofactor"
- );
+ "#prc.cbAdminEntryPoint#/authors/editor/authorID/#prc.oCurrentAuthor.getAuthorID()###twofactor"
+ );
}
- prc.xehEnroll = "#prc.cbAdminEntryPoint#.security.twofactorEnrollment.process";
+ prc.xehEnroll = "#prc.cbAdminEntryPoint#.security.twofactorEnrollment.process";
prc.twoFactorProvider = twoFactorService.getDefaultProviderObject();
event.setView( "twofactor/forceEnrollment" );
}
-
/**
* Process an enrollment for a user.
*/
- any function process( event, rc, prc ){
+ any function process( event, rc, prc ) {
// Given a logged in user, make sure they are the same
- if (
- prc.oCurrentAuthor.isLoaded() &&
- prc.oCurrentAuthor.getAuthorID() != prc.oAuthor.getAuthorID()
- ) {
+ if ( prc.oCurrentAuthor.isLoaded() && prc.oCurrentAuthor.getAuthorID() != prc.oAuthor.getAuthorID() ) {
messagebox.warn( cb.r( "twofactor.illegalAuthorEnrollment@security" ) );
relocate( "#prc.cbAdminEntryPoint#.dashboard" );
return;
@@ -76,14 +78,14 @@ component extends="baseHandler" {
// Flash data needed for two factor checks
flash.put(
- "authorData",
- {
- authorID : prc.oAuthor.getAuthorID(),
- rememberMe : rc.rememberMe,
- securedURL : rc.relocationURL,
- isEnrollment : true
- }
- );
+ "authorData",
+ {
+ authorID : prc.oAuthor.getAuthorID(),
+ rememberMe : rc.rememberMe,
+ securedURL : rc.relocationURL,
+ isEnrollment: true
+ }
+ );
// Send challenge
var twoFactorResults = twoFactorService.sendChallenge( prc.oAuthor );
@@ -97,15 +99,16 @@ component extends="baseHandler" {
relocate( event = "#prc.cbAdminEntryPoint#.security.twofactor" );
}
-
/**
* Un-enroll an author from two factor authentication
*/
- function unenroll( event, rc, prc ){
+ function unenroll( event, rc, prc ) {
prc.oAuthor.setIs2FactorAuth( false );
variables.authorService.save( prc.oAuthor );
messagebox.info( cb.r( "twofactor.unenrollment@security" ) );
- relocate( "#prc.cbAdminEntryPoint#/authors/editor/authorID/#rc.authorID###twofactor" );
+ relocate(
+ "#prc.cbAdminEntryPoint#/authors/editor/authorID/#rc.authorID###twofactor"
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc
index af38fd664b..1a495de9f5 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/ModuleConfig.cfc
@@ -6,27 +6,26 @@
* ContentBox Admin Email Two Factor Authentication Module
*/
component {
-
// Module Properties
- this.title = "ContentBox Email Two Factor";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "Provides email two factor authentication";
- this.dependencies = [ "contentbox-admin" ];
- this.cfmapping = "contentbox-email-twofactor";
+ this.title = "ContentBox Email Two Factor";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "Provides email two factor authentication";
+ this.dependencies = [ "contentbox-admin"];
+ this.cfmapping = "contentbox-email-twofactor";
/**
* Configure
*/
- function configure(){
+ function configure() {
// SES Routes
- routes = [ { pattern : "/:handler/:action?" } ];
+ routes = [ { pattern: "/:handler/:action?" }];
// Custom Declared Points
interceptorSettings = {
// CB Admin Custom Events
- customInterceptionPoints : []
+ customInterceptionPoints: []
};
// interceptors
@@ -36,19 +35,21 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
// Register this 2 Auth provider with the TwoFactorService
var twoFactorService = wirebox.getInstance( "TwoFactorService@contentbox" );
- twoFactorService.registerProvider( wirebox.getInstance( "EmailTwoFactorProvider@contentbox-email-twofactor" ) );
+ twoFactorService.registerProvider(
+ wirebox.getInstance( "EmailTwoFactorProvider@contentbox-email-twofactor" )
+ );
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
// Like a Ninja, remove yourself
var twoFactorService = wirebox.getInstance( "TwoFactorService@contentbox" );
twoFactorService.unregisterProvider( "email" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/emails/verification.cfm b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/emails/verification.cfm
index 75b961cbf2..18cbba8bc2 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/emails/verification.cfm
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/emails/verification.cfm
@@ -1,6 +1,7 @@
-
- #ETH.text( "
+
+ #ETH.text(
+ "
Dear @name@,
@@ -19,5 +20,6 @@
Please note that this code is only valid for the next @tokenTimeout@ minutes
- " )#
+ "
+ )#
diff --git a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc
index ffce4b0353..802ebd2648 100644
--- a/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc
+++ b/modules/contentbox/modules/contentbox-admin/modules/contentbox-security/modules/contentbox-email-twofactor/models/EmailTwoFactorProvider.cfc
@@ -12,40 +12,39 @@ component
singleton
threadsafe
{
-
// DI
property name="mailService" inject="mailService@cbmailservices";
- property name="cache" inject="cachebox:template";
+ property name="cache" inject="cachebox:template";
// Static Variables
variables.ALLOW_TRUSTED_DEVICE = true;
- variables.TOKEN_TIMEOUT = 5;
+ variables.TOKEN_TIMEOUT = 5;
/**
* Constructor
*/
- function init(){
+ function init() {
return this;
}
/**
* Get the internal name of the provider
*/
- function getName(){
+ function getName() {
return "email";
}
/**
* Get the display name of the provider
*/
- function getDisplayName(){
+ function getDisplayName() {
return "Email";
- };
+ }
/**
* Returns html to display to the user for required two-factor fields
*/
- function getAuthorSetupForm( required author ){
+ function getAuthorSetupForm( required author ) {
return "
Email:
@@ -55,7 +54,7 @@ component
/**
* Get the display help for the provider. Used in the UI setup screens for the author
*/
- function getAuthorSetupHelp( required author ){
+ function getAuthorSetupHelp( required author ) {
return "Make sure you have a valid email address setup in your author details. We will use this email account
to send you verification tokens to increase your account's security.";
}
@@ -63,7 +62,7 @@ component
/**
* Get the display help for the provider. Used in the UI verification screen.
*/
- function getVerificationHelp(){
+ function getVerificationHelp() {
return "Please enter the verification code that was sent to your account email address.";
}
@@ -71,7 +70,7 @@ component
* Get the author options form. This will be sent for saving. You can listen to save operations by
* listening to the event 'cbadmin_onAuthorTwoFactorSaveOptions'
*/
- function getAuthorOptions(){
+ function getAuthorOptions() {
return "";
}
@@ -79,7 +78,7 @@ component
* If true, then ContentBox will set a tracking cookie for the authentication provider user browser.
* If the user, logs in and the device is within the trusted timespan, then no two-factor authentication validation will occur.
*/
- boolean function allowTrustedDevice(){
+ boolean function allowTrustedDevice() {
return variables.ALLOW_TRUSTED_DEVICE;
}
@@ -88,16 +87,21 @@ component
*
* @author The author to create the token for.
*/
- string function generateValidationToken( required author ){
+ string function generateValidationToken( required author ) {
// Store Security Token For X minutes
- var token = left( hash( arguments.author.getEmail() & arguments.author.getAuthorID() & now() ), 6 );
+ var token = left(
+ hash(
+ arguments.author.getEmail() & arguments.author.getAuthorID() & now()
+ ),
+ 6
+ );
// Cache the code for 5 minutes
variables.cache.set(
- "email-twofactor-token-#token#",
- arguments.author.getAuthorID(),
- TOKEN_TIMEOUT,
- TOKEN_TIMEOUT
- );
+ "email-twofactor-token-#token#",
+ arguments.author.getAuthorID(),
+ TOKEN_TIMEOUT,
+ TOKEN_TIMEOUT
+ );
return token;
}
@@ -109,63 +113,68 @@ component
*
* @return struct:{ error:boolean, messages=string }
*/
- struct function sendChallenge( required author ){
- var results = { "error" : false, "messages" : "" };
+ struct function sendChallenge( required author ) {
+ var results = { "error": false, "messages": "" };
var settings = getAllSettings();
- var site = getDefaultSite();
+ var site = getDefaultSite();
try {
var token = generateValidationToken( arguments.author );
// Build body tokens
var bodyTokens = {
- name : arguments.author.getFullName(),
- email : arguments.author.getEmail(),
- username : arguments.author.getUsername(),
- ip : variables.securityService.getRealIP(),
- tokenTimeout : TOKEN_TIMEOUT,
- token : token,
- siteName : site.getName()
+ name : arguments.author.getFullName(),
+ email : arguments.author.getEmail(),
+ username : arguments.author.getUsername(),
+ ip : variables.securityService.getRealIP(),
+ tokenTimeout: TOKEN_TIMEOUT,
+ token : token,
+ siteName : site.getName()
};
// Build email out
var mail = variables.mailservice.newMail(
- to : arguments.author.getEmail(),
- from : settings.cb_site_outgoingEmail,
- subject : "#site.getName()# Two Factor Validation",
- bodyTokens: bodyTokens,
- type : "html",
- server : settings.cb_site_mail_server,
- username : settings.cb_site_mail_username,
- password : settings.cb_site_mail_password,
- port : settings.cb_site_mail_smtp,
- useTLS : settings.cb_site_mail_tls,
- useSSL : settings.cb_site_mail_ssl
- );
+ to = arguments.author.getEmail(),
+ from = settings.cb_site_outgoingEmail,
+ subject = "#site.getName()# Two Factor Validation",
+ bodyTokens = bodyTokens,
+ type = "html",
+ server = settings.cb_site_mail_server,
+ username = settings.cb_site_mail_username,
+ password = settings.cb_site_mail_password,
+ port = settings.cb_site_mail_smtp,
+ useTLS = settings.cb_site_mail_tls,
+ useSSL = settings.cb_site_mail_ssl
+ );
mail.setBody(
- variables.renderer.layout(
- layout = "/contentbox/email_templates/layouts/email",
- view = "contentbox-email-twofactor/emails/verification"
- )
- );
+ variables.renderer.layout(
+ layout = "/contentbox/email_templates/layouts/email",
+ view = "contentbox-email-twofactor/emails/verification"
+ )
+ );
// send it out
- var mailResults = variables.mailService.send( mail ).getResults();
+ var mailResults = variables
+ .mailService
+ .send( mail )
+ .getResults();
// Check for errors
if ( mailResults.error ) {
- results.error = true;
+ results.error = true;
results.messages = arrayToList( mailResults.messages );
} else {
results.messages = "Validation code sent!";
}
-
- // Send it to the user
- } catch ( Any e ) {
- results.error = true;
+ }// Send it to the user
+ catch (Any e) {
+ results.error = true;
results.messages = "Error Sending Email Challenge: #e.message# #e.detail#";
// Log this.
- variables.log.error( "Error Sending Email Challenge: #e.message# #e.detail#", e );
+ variables.log.error(
+ "Error Sending Email Challenge: #e.message# #e.detail#",
+ e
+ );
}
return results;
@@ -179,15 +188,15 @@ component
*
* @return struct:{ error:boolean, messages:string }
*/
- struct function verifyChallenge( required string code, required author ){
- var results = { "error" : false, "messages" : "" };
+ struct function verifyChallenge( required string code, required author ) {
+ var results = { "error": false, "messages": "" };
var authorID = variables.cache.get( "email-twofactor-token-#arguments.code#" );
// Verify it exists and is valid
- if ( !isNull( authorID ) AND arguments.author.getAuthorID() eq authorID ) {
+ if ( !isNull( authorID ) && arguments.author.getAuthorID() EQ authorID ) {
results.messages = "Code validated!";
} else {
- results.error = true;
+ results.error = true;
results.messages = "Invalid code. Please try again!";
}
@@ -201,9 +210,9 @@ component
* @code The verification code
* @author The author to verify challenge
*/
- function finalize( required string code, required author ){
+ function finalize( required string code, required author ) {
// clear out the codes
variables.cache.clear( "email-twofactor-token-#arguments.code#" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-admin/views/contentTemplates/index.cfm b/modules/contentbox/modules/contentbox-admin/views/contentTemplates/index.cfm
index b2b36befdf..1aa43eadd2 100644
--- a/modules/contentbox/modules/contentbox-admin/views/contentTemplates/index.cfm
+++ b/modules/contentbox/modules/contentbox-admin/views/contentTemplates/index.cfm
@@ -563,7 +563,7 @@
- #renderView(
+ #view(
view = "_tags/dialog/import",
args = {
title = "Import Templates",
diff --git a/modules/contentbox/modules/contentbox-admin/views/dashboard/latestSnapshot.cfm b/modules/contentbox/modules/contentbox-admin/views/dashboard/latestSnapshot.cfm
index f5c29fe10d..51e53a6279 100644
--- a/modules/contentbox/modules/contentbox-admin/views/dashboard/latestSnapshot.cfm
+++ b/modules/contentbox/modules/contentbox-admin/views/dashboard/latestSnapshot.cfm
@@ -31,9 +31,9 @@
- #topContent.getTitle()#
+ #topContent.label#
- #topContent.getNumberOfHits()#
+ #topContent.hits#
diff --git a/modules/contentbox/modules/contentbox-api/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-api/ModuleConfig.cfc
index 3bf8b9d7fc..6ce8308e43 100755
--- a/modules/contentbox/modules/contentbox-api/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-api/ModuleConfig.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,28 +6,27 @@
* ContentBox API Module
*/
component {
-
// Module Properties
- this.title = "ContentBox API";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox API Module";
+ this.title = "ContentBox API";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox API Module";
this.modelNamespace = "contentbox-api";
- this.cfmapping = "contentbox-api";
- this.dependencies = [];
+ this.cfmapping = "contentbox-api";
+ this.dependencies = [];
/**
* Configure Module
*/
- function configure(){
+ function configure() {
// Module Settings
settings = {};
// Custom Declared Points
interceptorSettings = {
// CB Admin Custom Events
- customInterceptionPoints : []
+ customInterceptionPoints: []
};
// Custom Declared Interceptors
@@ -37,7 +36,8 @@ component {
/*
* On Module Load
*/
- function onLoad(){
+ function onLoad() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/ModuleConfig.cfc
index dce2333fcb..a061fb83c1 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/ModuleConfig.cfc
@@ -6,53 +6,52 @@
* ContentBox API Module: version 1.x
*/
component {
-
// Module Properties
- this.title = "ContentBox API v1.x";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox API v1.x Module";
+ this.title = "ContentBox API v1.x";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox API v1.x Module";
// Module Entry Point
- this.entryPoint = "/cbapi/v1";
+ this.entryPoint = "/cbapi/v1";
// Inherit entry point from parent, so this will be http://{host}:{port}/cbapi/v1
this.modelNamespace = "contentbox-api-v1";
- this.cfmapping = "contentbox-api-v1";
- this.dependencies = [];
+ this.cfmapping = "contentbox-api-v1";
+ this.dependencies = [];
/**
* Configure
*/
- function configure(){
+ function configure() {
// module settings - stored in modules.name.settings
settings = {
// Security Configuration for the API Module via cbecurity
- cbsecurity : {
- firewall : {
+ cbsecurity: {
+ firewall: {
// The global invalid authentication event or URI or URL to go if an invalid authentication occurs
- "invalidAuthenticationEvent" : "contentbox-api-v1:auth.onAuthenticationFailure",
+ "invalidAuthenticationEvent" : "contentbox-api-v1:auth.onAuthenticationFailure",
// Default Auhtentication Action: override or redirect when a user has not logged in
- "defaultAuthenticationAction" : "override",
+ "defaultAuthenticationAction": "override",
// The global invalid authorization event or URI or URL to go if an invalid authorization occurs
- "invalidAuthorizationEvent" : "contentbox-api-v1:auth.onAuthorizationFailure",
+ "invalidAuthorizationEvent" : "contentbox-api-v1:auth.onAuthorizationFailure",
// Default Authorization Action: override or redirect when a user does not have enough permissions to access something
- "defaultAuthorizationAction" : "override",
+ "defaultAuthorizationAction" : "override",
// Global Security Rules
- "rules" : [
+ "rules" : [
{
- "match" : "event",
- "secureList" : "contentbox\-api\-v1\:.*", // Secure all api endpoints
- "whitelist" : "(auth|echo)" // Except the auth and echo endpoints
+ "match" : "event",
+ "secureList": "contentbox\-api\-v1\:.*", // Secure all api endpoints
+ "whitelist" : "(auth|echo)" // Except the auth and echo endpoints
}
],
// The validator is an object that will validate rules and annotations and provide feedback on either authentication or authorization issues.
- "validator" : "JwtAuthValidator@cbSecurity"
+ "validator": "JwtAuthValidator@cbSecurity"
}
}
};
// Custom Declared Points
- interceptorSettings = { customInterceptionPoints : "" };
+ interceptorSettings = { customInterceptionPoints: "" };
// Custom Declared Interceptors
interceptors = [];
@@ -61,13 +60,15 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
+
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/config/Router.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/config/Router.cfc
index b6e27804c2..a613425ff0 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/config/Router.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/config/Router.cfc
@@ -1,6 +1,6 @@
component {
- function configure(){
+ function configure() {
// Api Echo
route( "/", "echo.index" );
@@ -21,7 +21,7 @@ component {
* Resource groups for /sites/:site
* --------------------------------------------------------------------------
*/
- var except = "new,edit";
+ var except = "new,edit";
var sitePrefix = "/sites/:site";
/**
@@ -29,7 +29,7 @@ component {
* Author Routing
* --------------------------------------------------------------------------
*/
- resources( resource: "authors", except: except );
+ resources( resource = "authors", except = except );
/**
* --------------------------------------------------------------------------
@@ -37,9 +37,9 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "categories",
- pattern = "#siteprefix#/categories",
- except : except
+ resource = "categories",
+ pattern = "#siteprefix#/categories",
+ except = except
);
/**
@@ -48,9 +48,9 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "contentTemplates",
- pattern = "/content-templates",
- except : except
+ resource = "contentTemplates",
+ pattern = "/content-templates",
+ except = except
);
/**
@@ -59,21 +59,21 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "comments",
- pattern = "#siteprefix#/entries/:contentIdOrSlug/comments",
- except : except,
- meta : { contentType : "entry" }
+ resource = "comments",
+ pattern = "#siteprefix#/entries/:contentIdOrSlug/comments",
+ except = except,
+ meta = { contentType: "entry" }
);
resources(
- resource: "versions",
- pattern = "#siteprefix#/entries/:contentIdOrSlug/versions",
- except : "new,edit,create,update",
- meta : { contentType : "entry" }
+ resource = "versions",
+ pattern = "#siteprefix#/entries/:contentIdOrSlug/versions",
+ except = "new,edit,create,update",
+ meta = { contentType: "entry" }
);
resources(
- resource: "entries",
- pattern = "#siteprefix#/entries",
- except : except
+ resource = "entries",
+ pattern = "#siteprefix#/entries",
+ except = except
);
/**
@@ -82,9 +82,9 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "relocations",
- pattern = "#siteprefix#/relocations",
- except : except
+ resource = "relocations",
+ pattern = "#siteprefix#/relocations",
+ except = except
);
/**
@@ -93,15 +93,15 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "versions",
- pattern = "#siteprefix#/contentStore/:contentIdOrSlug/versions",
- except : "new,edit,create,update",
- meta : { contentType : "contentStore" }
+ resource = "versions",
+ pattern = "#siteprefix#/contentStore/:contentIdOrSlug/versions",
+ except = "new,edit,create,update",
+ meta = { contentType: "contentStore" }
);
resources(
- resource: "contentStore",
- pattern = "#siteprefix#/contentStore",
- except : except
+ resource = "contentStore",
+ pattern = "#siteprefix#/contentStore",
+ except = except
);
/**
@@ -110,21 +110,21 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "versions",
- pattern = "#siteprefix#/pages/:contentIdOrSlug/versions",
- except : "new,edit,create,update",
- meta : { contentType : "page" }
+ resource = "versions",
+ pattern = "#siteprefix#/pages/:contentIdOrSlug/versions",
+ except = "new,edit,create,update",
+ meta = { contentType: "page" }
);
resources(
- resource: "comments",
- pattern = "#siteprefix#/pages/:contentIdOrSlug/comments",
- except : except,
- meta : { contentType : "page" }
+ resource = "comments",
+ pattern = "#siteprefix#/pages/:contentIdOrSlug/comments",
+ except = except,
+ meta = { contentType: "page" }
);
resources(
- resource: "pages",
- pattern = "#siteprefix#/pages",
- except : except
+ resource = "pages",
+ pattern = "#siteprefix#/pages",
+ except = except
);
/**
@@ -133,15 +133,15 @@ component {
* --------------------------------------------------------------------------
*/
resources(
- resource: "menus",
- pattern = "#siteprefix#/menus",
- except : except
+ resource = "menus",
+ pattern = "#siteprefix#/menus",
+ except = except
);
- resources( resource: "sites", except: except );
+ resources( resource = "sites", except = except );
// Catch All Resource
route( "/:anything" ).to( "Echo.onInvalidRoute" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc
index c227f92b4c..bca7b50a92 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/auth.cfc
@@ -2,7 +2,6 @@
* ContentBox API Authentication handler
*/
component extends="baseHandler" {
-
// DI
property name="securityService" inject="securityService@contentbox";
@@ -13,11 +12,11 @@ component extends="baseHandler" {
* @requestBody contentbox/apidocs/auth/login/requestBody.json
* @responses contentbox/apidocs/auth/login/responses.json
*/
- function login( event, rc, prc ){
- param rc.username = "";
- param rc.password = "";
- param rc.includes = "permissions,permissionGroups,role.permissions";
- param rc.excludes = "";
+ function login( event, rc, prc ) {
+ param rc.username = "";
+ param rc.password = "";
+ param rc.includes = "permissions,permissionGroups,role.permissions";
+ param rc.excludes = "";
param rc.ignoreDefaults = false;
// Let's try to get log them in
@@ -28,9 +27,12 @@ component extends="baseHandler" {
// Verify if user needs to reset their password?
if ( prc.oCurrentAuthor.getIsPasswordReset() ) {
var errorMessage = "Your user needs to reset their password before using the API Services";
- prc.response
+ prc
+ .response
.setErrorMessage( errorMessage, event.STATUS.NOT_ALLOWED )
- .addMessage( "Please visit #variables.cb.linkAdminLogin()# in order to reset your password." );
+ .addMessage(
+ "Please visit #variables.cb.linkAdminLogin()# in order to reset your password."
+ );
return;
}
@@ -38,16 +40,21 @@ component extends="baseHandler" {
variables.securityService.login( prc.oCurrentAuthor );
// Build out the response
- prc.response
- .setData( {
- "tokens" : prc.tokens,
- "author" : prc.oCurrentAuthor.getMemento(
- includes = rc.includes,
- excludes = rc.excludes,
- ignoreDefaults = rc.ignoreDefaults
- )
- } )
- .addMessage( "Bearer token created and it expires in #jwtAuth().getSettings().jwt.expiration# minutes" )
+ prc
+ .response
+ .setData(
+ {
+ "tokens": prc.tokens,
+ "author": prc.oCurrentAuthor.getMemento(
+ includes = rc.includes,
+ excludes = rc.excludes,
+ ignoreDefaults = rc.ignoreDefaults
+ )
+ }
+ )
+ .addMessage(
+ "Bearer token created and it expires in #jwtAuth().getSettings().jwt.expiration# minutes"
+ )
.addMessage(
"Refresh token created and it expires in #jwtAuth().getSettings().jwt.refreshExpiration# minutes"
);
@@ -59,19 +66,18 @@ component extends="baseHandler" {
* @tags Authentication
* @responses contentbox/apidocs/auth/logout/responses.json
*/
- function logout( event, rc, prc ){
+ function logout( event, rc, prc ) {
jwtAuth().logout();
prc.response.addMessage( "Bye bye!" );
}
-
/**
* Refresh your access token, you must pass in your JWT Refresh token
*
* @tags Authentication
* @responses contentbox/apidocs/auth/refreshToken/responses.json
*/
- function refreshToken( event, rc, prc ){
+ function refreshToken( event, rc, prc ) {
try {
// Do cool refreshments via header/rc discovery
prc.newTokens = jwtAuth().refreshToken();
@@ -79,13 +85,17 @@ component extends="baseHandler" {
event
.getResponse()
.setData( prc.newTokens )
- .addMessage( "Tokens refreshed! The passed in refresh token has been invalidated" );
- } catch ( RefreshTokensNotActive e ) {
- return event.getResponse().setErrorMessage( "Refresh Tokens Not Active", 404, "Disabled" );
- } catch ( TokenNotFoundException e ) {
- return event
- .getResponse()
- .setErrorMessage(
+ .addMessage(
+ "Tokens refreshed! The passed in refresh token has been invalidated"
+ );
+ } catch (RefreshTokensNotActive e) {
+ return event.getResponse().setErrorMessage(
+ "Refresh Tokens Not Active",
+ 404,
+ "Disabled"
+ );
+ } catch (TokenNotFoundException e) {
+ return event.getResponse().setErrorMessage(
"The refresh token was not passed via the header or the rc. Cannot refresh the unrefreshable!",
400,
"Missing refresh token"
@@ -93,27 +103,24 @@ component extends="baseHandler" {
}
}
-
/**
* If logged in, you will be able to see your user information.
*
* @tags Authentication
* @responses contentbox/apidocs/echo/whoami/responses.json
*/
- function whoami( event, rc, prc ) secured{
- param rc.includes = "permissions,permissionGroups,role.permissions";
- param rc.excludes = "";
+ function whoami( event, rc, prc ) secured {
+ param rc.includes = "permissions,permissionGroups,role.permissions";
+ param rc.excludes = "";
param rc.ignoreDefaults = false;
prc.response.setData(
- jwtAuth()
- .getUser()
- .getMemento(
- includes = rc.includes,
- excludes = rc.excludes,
- ignoreDefaults = rc.ignoreDefaults
- )
- );
+ jwtAuth().getUser().getMemento(
+ includes = rc.includes,
+ excludes = rc.excludes,
+ ignoreDefaults = rc.ignoreDefaults
+ )
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc
index 973f3ba034..dfec1b32cb 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/authors.cfc
@@ -3,16 +3,16 @@
* Only tokens with the `AUTHOR_ADMIN` can interact with this endpoint
*/
component extends="baseHandler" secured="AUTHOR_ADMIN" {
-
// DI
property name="ormService" inject="AuthorService@contentbox";
+
property name="roleService" inject="roleService@contentbox";
- property name="permissionService" inject="permissionService@contentbox";
+ property name="permissionService" inject="permissionService@contentbox";
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "lastName";
+ variables.sortOrder = "lastName";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Author";
+ variables.entity = "Author";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = true;
@@ -23,12 +23,12 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" {
* @responses contentbox/apidocs/authors/index/responses.json
* @x -contentbox-permissions AUTHOR_ADMIN
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Criterias and Filters
param rc.sortOrder = "lastName";
- param rc.search = "";
- param rc.isActive = true;
- param rc.page = 1;
+ param rc.search = "";
+ param rc.isActive = true;
+ param rc.page = 1;
// Make sure isActive is boolean
if ( !isBoolean( rc.isActive ) ) {
@@ -37,12 +37,12 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" {
// Build up a search criteria and let the base execute it
arguments.results = variables.ormService.search(
- searchTerm = rc.search,
- isActive = rc.isActive,
- offset = getPageOffset( rc.page ),
- max = getMaxRows(),
- sortOrder = rc.sortOrder
- );
+ searchTerm = rc.search,
+ isActive = rc.isActive,
+ offset = getPageOffset( rc.page ),
+ max = getMaxRows(),
+ sortOrder = rc.sortOrder
+ );
// Build to match interface
arguments.results.records = arguments.results.authors;
@@ -58,11 +58,11 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" {
* @responses contentbox/apidocs/authors/show/responses.json
* @x -contentbox-permissions AUTHOR_ADMIN
*/
- function show( event, rc, prc ){
- param rc.includes = "permissions,permissionGroups,role.permissions";
- param rc.excludes = "role.permissions.createdDate,role.permissions.modifiedDate";
+ function show( event, rc, prc ) {
+ param rc.includes = "permissions,permissionGroups,role.permissions";
+ param rc.excludes = "role.permissions.createdDate,role.permissions.modifiedDate";
param rc.ignoreDefaults = false;
- param rc.id = 0;
+ param rc.id = 0;
super.show( argumentCollection = arguments );
}
@@ -75,11 +75,11 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" {
* @responses contentbox/apidocs/authors/create/responses.json
* @x -contentbox-permissions AUTHOR_ADMIN
*/
- function create( event, rc, prc ){
+ function create( event, rc, prc ) {
// Default set variables for the author
rc.isPasswordRest = true;
- rc.password = hash( createUUID() & now() );
- rc.isActive = true;
+ rc.password = hash( createUUID() & now() );
+ rc.isActive = true;
// Super size me!
arguments.saveMethod = "createNewAuthor";
@@ -93,12 +93,12 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" {
* @responses contentbox/apidocs/authors/update/responses.json
* @x -contentbox-permissions AUTHOR_ADMIN
*/
- function update( event, rc, prc ){
+ function update( event, rc, prc ) {
// Memento output
param rc.includes = "permissions,permissionGroups,role.permissions";
// Can't update everything via the API.
- arguments.populate.exclude = "username,password,pages,entries,is2FactorAuth,isPasswordReset,lastLogin";
+ arguments.populate.exclude = "username,password,pages,entries,is2FactorAuth,isPasswordReset,lastLogin";
arguments.populate.nullEmptyInclude = "";
// Super size it!
@@ -112,8 +112,8 @@ component extends="baseHandler" secured="AUTHOR_ADMIN" {
* @responses contentbox/apidocs/authors/delete/responses.json
* @x -contentbox-permissions AUTHOR_ADMIN
*/
- function delete( event, rc, prc ){
+ function delete( event, rc, prc ) {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc
index 25026a36a5..82bf942d76 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseContentHandler.cfc
@@ -2,40 +2,50 @@
* Base handler for content based API handlers
*/
component extends="baseHandler" {
-
// DI
property name="authorService" inject="authorService@contentbox";
+
property name="contentService" inject="ContentService@contentbox";
+
property name="categoryService" inject="categoryService@contentbox";
+
property name="customFieldService" inject="customFieldService@contentbox";
- property name="HTMLHelper" inject="HTMLHelper@coldbox";
+ property name="HTMLHelper" inject="HTMLHelper@coldbox";
// The name of the method to use for save persistence on the ORM service
- variables.saveMethod = "save";
+ variables.saveMethod = "save";
// The name of the method to use for deleting entites on the ORM service
variables.deleteMethod = "delete";
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming site
- param rc.site = "";
+ param rc.site = "";
prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
}
/**
* Show a content item using an incoming slug or id
*/
- function show( event, rc, prc ){
- param rc.includes = arrayToList( [
- "activeContent",
- "childrenSnapshot:children",
- "customFieldsAsStruct:customFields",
- "linkedContentSnapshot:linkedContent",
- "relatedContentSnapshot:relatedContent",
- "renderedContent"
- ] );
+ function show( event, rc, prc ) {
+ param rc.includes = arrayToList(
+ [
+ "activeContent",
+ "childrenSnapshot:children",
+ "customFieldsAsStruct:customFields",
+ "linkedContentSnapshot:linkedContent",
+ "relatedContentSnapshot:relatedContent",
+ "renderedContent"
+ ]
+ );
super.show( argumentCollection = arguments );
}
@@ -60,26 +70,35 @@ component extends="baseHandler" {
struct validate = {},
string saveMethod = variables.saveMethod,
string contentType = ""
- ){
+ ) {
// params
param arguments.populate.composeRelationships = true;
- param rc.includes = arrayToList( [
- "activeContent",
- "customFieldsAsStruct:customFields",
- "linkedContentSnapshot:linkedContent",
- "relatedContentSnapshot:relatedContent",
- "renderedContent"
- ] );
- param rc.excludes = "";
+ param rc.includes = arrayToList(
+ [
+ "activeContent",
+ "customFieldsAsStruct:customFields",
+ "linkedContentSnapshot:linkedContent",
+ "relatedContentSnapshot:relatedContent",
+ "renderedContent"
+ ]
+ );
+ param rc.excludes = "";
param rc.ignoreDefaults = false;
// param content fields
- param rc.id = "";
- param rc.content = "";
- param rc.changelog = len( rc.id ) ? "Update from the ContentBox API" : "Creation from the ContentBox API";
+ param rc.id = "";
+ param rc.content = "";
+ param rc.changelog = len( rc.id ) ? "Update from the ContentBox API" : "Creation from the ContentBox API";
// Verify content exists ONLY for new objects
if ( !len( rc.id ) && !len( rc.content ) ) {
- arguments.event.getResponse().setErrorMessage( "Content is required", arguments.event.STATUS.BAD_REQUEST );
+ arguments
+ .event
+ .getResponse()
+ .setErrorMessage( "Content is required",
+ arguments
+ .event
+ .STATUS
+ .BAD_REQUEST );
return;
}
// Setup Parent if sent!
@@ -91,29 +110,46 @@ component extends="baseHandler" {
rc.slug = variables.HTMLHelper.slugify( listLast( rc.slug, "/" ) );
}
// Verify permission for publishing, else save as draft
- if ( !prc.oCurrentAuthor.hasPermission( "#arguments.contentType#_ADMIN,#arguments.contentType#_EDITOR" ) ) {
+ if (
+ !prc.oCurrentAuthor.hasPermission(
+ "#arguments.contentType#_ADMIN,#arguments.contentType#_EDITOR"
+ )
+ ) {
rc.isPublished = "false";
}
// Population arguments
- arguments.populate.memento = rc;
+ arguments.populate.memento = rc;
// Check if creation or editing
- arguments.populate.model = ( !len( rc.id ) ? variables.ormService.new() : getByIdOrSlugOrFail( rc.id, prc ) );
+ arguments.populate.model = ( !len( rc.id ) ? variables.ormService.new() : getByIdOrSlugOrFail( rc.id, prc ) );
arguments.populate.nullEmptyInclude = "parent";
- arguments.populate.exclude = "contentID,creator,categories,comments,customFields,contentVersions,children,commentSubscriptions";
+ arguments.populate.exclude = "contentID,creator,categories,comments,customFields,contentVersions,children,commentSubscriptions";
// Creator override: Only if you have the right perms
- arguments.populate.model.setCreator( prc.oCurrentAuthor );
+ arguments
+ .populate
+ .model
+ .setCreator( prc.oCurrentAuthor );
if (
- arguments.populate.model.isLoaded() && !isNull( rc.creator ) && len( rc.creator ) && prc
- .oCurrentAuthor()
- .hasPermission( "#arguments.contentType#_ADMIN" )
+ arguments
+ .populate
+ .model
+ .isLoaded() &&
+ !isNull( rc.creator ) &&
+ len( rc.creator ) &&
+ prc.oCurrentAuthor().hasPermission( "#arguments.contentType#_ADMIN" )
) {
- arguments.populate.model.setCreator( variables.authorService.retrieveUserById( rc.creator ) );
+ arguments
+ .populate
+ .model
+ .setCreator( variables.authorService.retrieveUserById( rc.creator ) );
}
// populate it
- var originalSlug = arguments.populate.model.getSlug();
+ var originalSlug = arguments
+ .populate
+ .model
+ .getSlug();
arguments.validate.target = this.populate( argumentCollection = arguments.populate );
// Start save transaction procedures
@@ -124,10 +160,10 @@ component extends="baseHandler" {
// Do we have any incoming content to create a version for?
if ( len( rc.content ) ) {
prc.oEntity.addNewContentVersion(
- content : rc.content,
- changelog: rc.changelog,
- author : prc.oCurrentAuthor
- );
+ content = rc.content,
+ changelog = rc.changelog,
+ author = prc.oCurrentAuthor
+ );
}
// Inflate Categories if they come as a list of slugs
@@ -136,10 +172,13 @@ component extends="baseHandler" {
rc.categories = listToArray( rc.categories );
}
prc.oEntity.setCategories(
- rc.categories.map( function( thisCategory ){
- return variables.categoryService.getOrCreateBySlug( arguments.thisCategory, rc.site );
- } )
- );
+ rc.categories.map(
+ function( thisCategory ) {
+ return variables.categoryService.getOrCreateBySlug( arguments.thisCategory,
+ rc.site );
+ }
+ )
+ );
}
// Inflate Custom Fields [ { key : "", value : "" } ] if a string, else this should be an array
@@ -148,45 +187,55 @@ component extends="baseHandler" {
rc.customFields = deserializeJSON( rc.customFields );
}
prc.oEntity.setCustomFields(
- rc.customFields.map( function( thisField ){
- return variables.customFieldService.new( {
- key : toString( arguments.thisField.key ),
- value : toString( arguments.thisField.value ),
- relatedContent : prc.oEntity
- } );
- } )
- );
+ rc.customFields.map(
+ function( thisField ) {
+ return variables.customFieldService.new(
+ {
+ key : toString( arguments.thisField.key ),
+ value : toString( arguments.thisField.value ),
+ relatedContent: prc.oEntity
+ }
+ );
+ }
+ )
+ );
}
// announce it
announce(
- "#variables.settings.resources.eventPrefix#pre#variables.entity##len( rc.id ) ? "Update" : "Save"#",
- { entity : prc.oEntity, originalSlug : originalSlug }
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#pre#variables.entity##len( rc.id ) ? "Update" : "Save"#",
+ { entity: prc.oEntity, originalSlug: originalSlug }
);
// Save it
invoke(
variables.ormService,
arguments.saveMethod,
- [ prc.oEntity, originalSlug ]
+ [ prc.oEntity, originalSlug]
);
// announce it
announce(
- "#variables.settings.resources.eventPrefix#post#variables.entity##len( rc.id ) ? "Update" : "Save"#",
- { entity : prc.oEntity, originalSlug : originalSlug }
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#post#variables.entity##len( rc.id ) ? "Update" : "Save"#",
+ { entity: prc.oEntity, originalSlug: originalSlug }
);
}
// end transaction
// Marshall it out
prc.response.setData(
- prc.oEntity.getMemento(
- includes = rc.includes,
- excludes = rc.excludes,
- ignoreDefaults = rc.ignoreDefaults
- )
- );
+ prc.oEntity.getMemento(
+ includes = rc.includes,
+ excludes = rc.excludes,
+ ignoreDefaults = rc.ignoreDefaults
+ )
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc
index 63e66853f5..b9412133e4 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/baseHandler.cfc
@@ -18,14 +18,14 @@
*
* component extends="BaseOrmResource"{
*
- * // Inject the correct virtual entity service to use
- * property name="ormService" inject="RoleService"
- * property name="ormService" inject="PermissionService"
+ * // Inject the correct virtual entity service to use
+ * property name="ormService" inject="RoleService"
+ * property name="ormService" inject="PermissionService"
*
- * // The default sorting order string: permission, name, data desc, etc.
- * variables.sortOrder = "";
- * // The name of the entity this resource handler controls. Singular name please.
- * variables.entity = "Permission";
+ * // The default sorting order string: permission, name, data desc, etc.
+ * variables.sortOrder = "";
+ * // The name of the entity this resource handler controls. Singular name please.
+ * variables.entity = "Permission";
* }
*
*
@@ -35,12 +35,12 @@
* @see https://coldbox-orm.ortusbooks.com/orm-events/automatic-rest-crud
*/
component extends="cborm.models.resources.BaseHandler" {
-
// DI
property name="settings" inject="coldbox:moduleSettings:cborm";
+
property name="siteService" inject="siteService@contentbox";
- property name="cb" inject="CBHelper@contentbox";
+ property name="cb" inject="CBHelper@contentbox";
// Use native getOrFail() or getByIdOrSlugOrFail()
variables.useGetOrFail = true;
@@ -51,8 +51,14 @@ component extends="cborm.models.resources.BaseHandler" {
* @criteria If you pass a criteria object, then we will use that instead of creating a new one
* @results If you pass in a results struct, it must contain the following: { count:numeric, records: array of objects }
*/
- function index( event, rc, prc, criteria, struct results ){
- param rc.page = 1;
+ function index(
+ event,
+ rc,
+ prc,
+ criteria,
+ struct results
+ ) {
+ param rc.page = 1;
param rc.isDeleted = false;
// Add to incoming criteria our base default criterias
@@ -67,14 +73,20 @@ component extends="cborm.models.resources.BaseHandler" {
/**
* Display a resource by incoming ID or slug
*/
- function show( event, rc, prc ){
- param rc.includes = "";
- param rc.excludes = "";
+ function show( event, rc, prc ) {
+ param rc.includes = "";
+ param rc.excludes = "";
param rc.ignoreDefaults = false;
- param rc.id = 0;
+ param rc.id = 0;
// announce it
- announce( "#variables.settings.resources.eventPrefix#pre#variables.entity#Show", {} );
+ announce(
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#pre#variables.entity#Show",
+ {}
+ );
// Get by id or slug
prc.oEntity = (
@@ -82,16 +94,22 @@ component extends="cborm.models.resources.BaseHandler" {
);
// announce it
- announce( "#variables.settings.resources.eventPrefix#post#variables.entity#Show", { entity : prc.oEntity } );
+ announce(
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#post#variables.entity#Show",
+ { entity: prc.oEntity }
+ );
// Marshall it
prc.response.setData(
- prc.oEntity.getMemento(
- includes = rc.includes,
- excludes = rc.excludes,
- ignoreDefaults = rc.ignoreDefaults
- )
- );
+ prc.oEntity.getMemento(
+ includes = rc.includes,
+ excludes = rc.excludes,
+ ignoreDefaults = rc.ignoreDefaults
+ )
+ );
}
/**
@@ -104,7 +122,7 @@ component extends="cborm.models.resources.BaseHandler" {
struct populate = {},
struct validate = {},
string saveMethod = variables.saveMethod
- ){
+ ) {
super.create( argumentCollection = arguments );
}
@@ -118,16 +136,16 @@ component extends="cborm.models.resources.BaseHandler" {
struct populate = {},
struct validate = {},
string saveMethod = variables.saveMethod
- ){
- param rc.includes = "";
- param rc.excludes = "";
- param rc.ignoreDefaults = false;
- param rc.id = 0;
+ ) {
+ param rc.includes = "";
+ param rc.excludes = "";
+ param rc.ignoreDefaults = false;
+ param rc.id = 0;
param arguments.populate.composeRelationships = true;
// Population arguments
arguments.populate.memento = rc;
- arguments.populate.model = (
+ arguments.populate.model = (
variables.useGetOrFail ? variables.ormService.getOrFail( rc.id ) : getByIdOrSlugOrFail( rc.id, prc )
);
@@ -138,26 +156,38 @@ component extends="cborm.models.resources.BaseHandler" {
prc.oEntity = validateOrFail( argumentCollection = arguments.validate );
// announce it
- announce( "#variables.settings.resources.eventPrefix#pre#variables.entity#Update", { entity : prc.oEntity } );
+ announce(
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#pre#variables.entity#Update",
+ { entity: prc.oEntity }
+ );
// Save it
invoke(
variables.ormService,
arguments.saveMethod,
- [ prc.oEntity ]
+ [ prc.oEntity]
);
// announce it
- announce( "#variables.settings.resources.eventPrefix#post#variables.entity#Update", { entity : prc.oEntity } );
+ announce(
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#post#variables.entity#Update",
+ { entity: prc.oEntity }
+ );
// Marshall it out
prc.response.setData(
- prc.oEntity.getMemento(
- includes = rc.includes,
- excludes = rc.excludes,
- ignoreDefaults = rc.ignoreDefaults
- )
- );
+ prc.oEntity.getMemento(
+ includes = rc.includes,
+ excludes = rc.excludes,
+ ignoreDefaults = rc.ignoreDefaults
+ )
+ );
}
/**
@@ -168,7 +198,7 @@ component extends="cborm.models.resources.BaseHandler" {
rc,
prc,
string deleteMethod = variables.deleteMethod
- ){
+ ) {
param rc.id = 0;
prc.oEntity = (
@@ -176,17 +206,29 @@ component extends="cborm.models.resources.BaseHandler" {
);
// announce it
- announce( "#variables.settings.resources.eventPrefix#pre#variables.entity#Delete", { entity : prc.oEntity } );
+ announce(
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#pre#variables.entity#Delete",
+ { entity: prc.oEntity }
+ );
// Delete it
invoke(
variables.ormService,
arguments.deleteMethod,
- [ prc.oEntity ]
+ [ prc.oEntity]
);
// announce it
- announce( "#variables.settings.resources.eventPrefix#post#variables.entity#Delete", { id : rc.id } );
+ announce(
+ "#variables
+ .settings
+ .resources
+ .eventPrefix#post#variables.entity#Delete",
+ { id: rc.id }
+ );
// Marshall it out
prc.response.addMessage( "#variables.entity# deleted!" );
@@ -202,18 +244,23 @@ component extends="cborm.models.resources.BaseHandler" {
*
* @throws EntityNotFound
*/
- private function getByIdOrSlugOrFail( required id, required prc ){
- var c = variables.ormService.newCriteria();
+ private function getByIdOrSlugOrFail( required id, required prc ) {
+ var c = variables.ormService.newCriteria();
var oEntity = c
.$or(
- // note: id is a shortcut in Hibernate for the Primary Key
c.restrictions.isEq( "id", arguments.id ),
c.restrictions.isEq( "slug", arguments.id )
)
+ .when(
+ !isNull( prc.oCurrentSite ),
+ function( c ) {
+ c.isEq( "site", prc.oCurrentSite );
+ }
+ )
+ // note: id is a shortcut in Hibernate for the Primary Key
+
// If the site exists, seed it
- .when( !isNull( prc.oCurrentSite ), function( c ){
- c.isEq( "site", prc.oCurrentSite );
- } )
+
.get();
if ( isNull( oEntity ) ) {
@@ -234,14 +281,13 @@ component extends="cborm.models.resources.BaseHandler" {
*
* @throws EntityNotFound
*/
- private function getSiteByIdOrSlugOrFail( required id ){
- var c = variables.siteService.newCriteria();
- var oSite = c
- .$or(
- // note: id is a shortcut in Hibernate for the Primary Key
+ private function getSiteByIdOrSlugOrFail( required id ) {
+ var c = variables.siteService.newCriteria();
+ var oSite = c.$or(
c.restrictions.isEq( "id", arguments.id ),
c.restrictions.isEq( "slug", arguments.id )
- )
+ )// note: id is a shortcut in Hibernate for the Primary Key
+
.get();
if ( isNull( oSite ) ) {
@@ -255,4 +301,4 @@ component extends="cborm.models.resources.BaseHandler" {
return oSite;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc
index 841886ccad..ed696b71cc 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/categories.cfc
@@ -3,23 +3,27 @@
* An incoming site identifier is required
*/
component extends="baseHandler" {
-
// DI
property name="ormService" inject="CategoryService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "slug";
+ variables.sortOrder = "slug";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Category";
+ variables.entity = "Category";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming site
- param rc.site = "";
+ param rc.site = "";
prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
}
@@ -29,7 +33,7 @@ component extends="baseHandler" {
* @tags Categories
* @responses contentbox/apidocs/categories/index/responses.json
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Criterias and Filters
param rc.sortOrder = "slug";
@@ -46,7 +50,7 @@ component extends="baseHandler" {
* @tags Categories
* @responses contentbox/apidocs/categories/show/responses.json
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
param rc.includes = "NumberOfPublishedPages,numberOfPublishedContentStore,numberOfPublishedEntries";
param rc.excludes = "";
@@ -61,7 +65,7 @@ component extends="baseHandler" {
* @responses contentbox/apidocs/categories/create/responses.json
* @x -contentbox-permissions CATEGORIES_ADMIN
*/
- function create( event, rc, prc ) secured="CATEGORIES_ADMIN"{
+ function create( event, rc, prc ) secured="CATEGORIES_ADMIN" {
super.create( argumentCollection = arguments );
}
@@ -72,7 +76,7 @@ component extends="baseHandler" {
* @responses contentbox/apidocs/categories/update/responses.json
* @x -contentbox-permissions CATEGORIES_ADMIN
*/
- function update( event, rc, prc ) secured="CATEGORIES_ADMIN"{
+ function update( event, rc, prc ) secured="CATEGORIES_ADMIN" {
super.update( argumentCollection = arguments );
}
@@ -83,8 +87,8 @@ component extends="baseHandler" {
* @responses contentbox/apidocs/categories/delete/responses.json
* @x -contentbox-permissions CATEGORIES_ADMIN
*/
- function delete( event, rc, prc ) secured="CATEGORIES_ADMIN"{
+ function delete( event, rc, prc ) secured="CATEGORIES_ADMIN" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc
index cbabe1b43b..2bfc31974b 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/comments.cfc
@@ -5,28 +5,33 @@
* An incoming contentID or slug is required
*/
component extends="baseHandler" {
-
// DI
property name="ormService" inject="CommentService@contentbox";
- property name="contentService" inject="contentService@contentbox";
+ property name="contentService" inject="contentService@contentbox";
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "createdDate DESC";
+ variables.sortOrder = "createdDate DESC";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Comment";
+ variables.entity = "Comment";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = true;
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming params
- param rc.site = "";
+ param rc.site = "";
param rc.contentIdOrSlug = "";
- prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
- prc.contentType = event.getCurrentRouteMeta().contentType;
+ prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
+ prc.contentType = event.getCurrentRouteMeta().contentType;
prc.oRelatedContent = variables.contentService.getByIdOrSlugOrFail( rc.contentIdOrSlug );
}
@@ -36,10 +41,10 @@ component extends="baseHandler" {
* @tags Comments
* @responses contentbox/apidocs/comments/index/responses.json
*/
- function index( event, rc, prc ){
- param rc.page = 1;
+ function index( event, rc, prc ) {
+ param rc.page = 1;
// Criterias and Filters
- param rc.sortOrder = variables.sortOrder;
+ param rc.sortOrder = variables.sortOrder;
// Approved Bit
param rc.isApproved = "";
@@ -48,13 +53,16 @@ component extends="baseHandler" {
rc.isApproved = "";
}
// Build up a search criteria and let the base execute it
- arguments.criteria = newCriteria()
- // Pin the related content
- .isEq( "relatedContent.contentID", prc.oRelatedContent.getContentID() )
+ arguments.criteria = newCriteria().isEq( "relatedContent.contentID",
+ prc.oRelatedContent.getContentID() )// Pin the related content
+
// isApproved filter
- .when( len( rc.isApproved ), function( c ){
- arguments.c.isEq( "isApproved", javacast( "Boolean", rc.isApproved ) );
- } );
+ .when(
+ len( rc.isApproved ),
+ function( c ) {
+ arguments.c.isEq( "isApproved", javacast( "Boolean", rc.isApproved ) );
+ }
+ );
// Delegate it!
super.index( argumentCollection = arguments );
@@ -66,7 +74,7 @@ component extends="baseHandler" {
* @tags Comments
* @responses contentbox/apidocs/comments/show/responses.json
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
param rc.includes = "relatedContentSnapshot:relatedContent";
param rc.excludes = "";
@@ -80,7 +88,7 @@ component extends="baseHandler" {
* @requestBody contentbox/apidocs/comments/create/requestBody.json
* @responses contentbox/apidocs/comments/create/responses.json
*/
- function create( event, rc, prc ){
+ function create( event, rc, prc ) {
super.create( argumentCollection = arguments );
}
@@ -91,7 +99,7 @@ component extends="baseHandler" {
* @responses contentbox/apidocs/comments/update/responses.json
* @x -contentbox-permissions COMMENTS_ADMIN
*/
- function update( event, rc, prc ) secured="COMMENTS_ADMIN"{
+ function update( event, rc, prc ) secured="COMMENTS_ADMIN" {
super.update( argumentCollection = arguments );
}
@@ -102,8 +110,8 @@ component extends="baseHandler" {
* @responses contentbox/apidocs/comments/delete/responses.json
* @x -contentbox-permissions COMMENTS_ADMIN
*/
- function delete( event, rc, prc ) secured="COMMENTS_ADMIN"{
+ function delete( event, rc, prc ) secured="COMMENTS_ADMIN" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc
index 1b547fbdb0..8c67235f66 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentStore.cfc
@@ -4,14 +4,12 @@
* An incoming site identifier is required
*/
component extends="baseContentHandler" {
-
// DI
property name="ormService" inject="ContentStoreService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "publishedDate DESC";
+ variables.sortOrder = "publishedDate DESC";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "ContentStore";
+ variables.entity = "ContentStore";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
@@ -22,46 +20,52 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/contentStore/index/responses.json
* @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR
*/
- function index( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{
+ function index( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR" {
// Paging + Mementifier
- param rc.page = 1;
- param rc.excludes = "HTMLTitle,HTMLKeywords,HTMLDescription";
+ param rc.page = 1;
+ param rc.excludes = "HTMLTitle,HTMLKeywords,HTMLDescription";
// Criterias and Filters
- param rc.sortOrder = "publishedDate DESC";
+ param rc.sortOrder = "publishedDate DESC";
// Search terms
- param rc.search = "";
+ param rc.search = "";
// One or a list of categories to filter on
- param rc.category = "";
+ param rc.category = "";
// Author ID to filter on
- param rc.author = "";
+ param rc.author = "";
// The parent to filter on, default is root pages
- param rc.parent = "";
+ param rc.parent = "";
// 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 `/`
param rc.slugPrefix = "";
// If passed, we can do a slug wildcard search
param rc.slugSearch = "";
// If passed, it's a slug operation
- param rc.slug = "";
+ param rc.slug = "";
// If we have a `slug` then we treat it as a /:slug route, due to hierarchical paths
- if ( rc.slug.trim().length() > 0 ) {
+ if (
+ rc
+ .slug
+ .trim()
+ .length() >
+ 0
+ ) {
rc.id = rc.slug;
return show( argumentCollection = arguments );
}
// Build up a search criteria and let the base execute it
arguments.results = variables.ormService.findPublishedContent(
- searchTerm = rc.search,
- category = rc.category,
- offset = getPageOffset( rc.page ),
- max = getMaxRows(),
- sortOrder = rc.sortOrder,
- siteId = prc.oCurrentSite.getSiteID(),
- authorID = rc.author,
- parent = rc.parent,
- slugPrefix = rc.slugPrefix,
- slugSearch = rc.slugSearch
- );
+ searchTerm = rc.search,
+ category = rc.category,
+ offset = getPageOffset( rc.page ),
+ max = getMaxRows(),
+ sortOrder = rc.sortOrder,
+ siteId = prc.oCurrentSite.getSiteID(),
+ authorID = rc.author,
+ parent = rc.parent,
+ slugPrefix = rc.slugPrefix,
+ slugSearch = rc.slugSearch
+ );
// Build to match interface
arguments.results.records = arguments.results.content;
@@ -77,15 +81,17 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/contentStore/show/responses.json
* @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR
*/
- function show( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{
- param rc.includes = arrayToList( [
- "activeContent",
- "childrenSnapshot:children",
- "customFieldsAsStruct:customFields",
- "linkedContentSnapshot:linkedContent",
- "relatedContentSnapshot:relatedContent",
- "renderedContent"
- ] );
+ function show( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR" {
+ param rc.includes = arrayToList(
+ [
+ "activeContent",
+ "childrenSnapshot:children",
+ "customFieldsAsStruct:customFields",
+ "linkedContentSnapshot:linkedContent",
+ "relatedContentSnapshot:relatedContent",
+ "renderedContent"
+ ]
+ );
param rc.excludes = "";
super.show( argumentCollection = arguments );
@@ -99,7 +105,7 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/contentStore/create/responses.json
* @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR
*/
- function create( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{
+ function create( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR" {
// Supersize it
arguments.contentType = "CONTENTSTORE";
super.save( argumentCollection = arguments );
@@ -112,7 +118,7 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/contentStore/update/responses.json
* @x -contentbox-permissions CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR
*/
- function update( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"{
+ function update( event, rc, prc ) secured="CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR" {
arguments.contentType = "CONTENTSTORE";
super.save( argumentCollection = arguments );
}
@@ -124,8 +130,8 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/contentStore/delete/responses.json
* @x -contentbox-permissions CONTENTSTORE_ADMIN
*/
- function delete( event, rc, prc ) secured="CONTENTSTORE_ADMIN"{
+ function delete( event, rc, prc ) secured="CONTENTSTORE_ADMIN" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentTemplates.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentTemplates.cfc
index 0487513b15..a10d09bca8 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentTemplates.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/contentTemplates.cfc
@@ -3,26 +3,30 @@
* An incoming site identifier is required
*/
component extends="baseHandler" {
-
// DI
property name="ormService" inject="ContentTemplateService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "name";
+ variables.sortOrder = "name";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "ContentTemplate";
+ variables.entity = "ContentTemplate";
// Use getOrFail() or getByIdOrNameOrFail() for show/delete/update actions
variables.useGetOrFail = true;
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming site
param rc.includes = "";
param rc.excludes = "";
- prc.oCurrentSite = rc.keyExists( "site" ) ? getSiteByIdOrSlugOrFail( rc.site ) : cb.site();
- param rc.site = prc.oCurrentSite.getSiteId();
+ prc.oCurrentSite = rc.keyExists( "site" ) ? getSiteByIdOrSlugOrFail( rc.site ) : cb.site();
+ param rc.site = prc.oCurrentSite.getSiteId();
}
/**
@@ -30,18 +34,31 @@ component extends="baseHandler" {
*
* @tags Templates
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Criterias and Filters
param rc.sortOrder = "name";
// Build up a search criteria and let the base execute it
- arguments.criteria = variables.ormService.newCriteria().isEq( "site", prc.oCurrentSite );
- arguments.criteria
- .when( rc.keyExists( "search" ) && len( rc.search ), function( c ){
- c.or( c.restrictions.like( "name", "%#search#%" ), c.restrictions.like( "description", "%#search#%" ) );
- } )
- .when( find( "creator", rc.sortOrder ), function( c ){
- c.createAlias( "creator", "creator" )
- } );
+ arguments.criteria = variables
+ .ormService
+ .newCriteria()
+ .isEq( "site", prc.oCurrentSite );
+ arguments
+ .criteria
+ .when(
+ rc.keyExists( "search" ) && len( rc.search ),
+ function( c ) {
+ c.or(
+ c.restrictions.like( "name", "%#search#%" ),
+ c.restrictions.like( "description", "%#search#%" )
+ );
+ }
+ )
+ .when(
+ find( "creator", rc.sortOrder ),
+ function( c ) {
+ c.createAlias( "creator", "creator" );
+ }
+ );
// Delegate it!
super.index( argumentCollection = arguments );
@@ -52,7 +69,7 @@ component extends="baseHandler" {
*
* @tags Templates
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
super.show( argumentCollection = arguments );
}
@@ -62,7 +79,7 @@ component extends="baseHandler" {
* @tags Templates
* @x -contentbox-permissions PAGES_ADMIN
*/
- function create( event, rc, prc ) secured="PAGES_ADMIN"{
+ function create( event, rc, prc ) secured="PAGES_ADMIN" {
param rc.creator = prc.oCurrentAuthor;
structDelete( rc, "templateID" );
super.create( argumentCollection = arguments );
@@ -74,7 +91,7 @@ component extends="baseHandler" {
* @tags Templates
* @x -contentbox-permissions PAGES_ADMIN
*/
- function update( event, rc, prc ) secured="PAGES_ADMIN"{
+ function update( event, rc, prc ) secured="PAGES_ADMIN" {
structDelete( rc, "creator" );
structDelete( rc, "site" );
super.update( argumentCollection = arguments );
@@ -86,8 +103,8 @@ component extends="baseHandler" {
* @tags Templates
* @x -contentbox-permissions PAGES_ADMIN
*/
- function delete( event, rc, prc ) secured="PAGES_ADMIN"{
+ function delete( event, rc, prc ) secured="PAGES_ADMIN" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/echo.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/echo.cfc
index 3d8913149b..27c3207c37 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/echo.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/echo.cfc
@@ -6,8 +6,8 @@ component extends="baseHandler" {
/**
* A nice welcome to the API services
*/
- any function index( event, rc, prc ){
+ any function index( event, rc, prc ) {
prc.response.setData( "Welcome to the ContentBox API v1.x Services" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc
index 36cc224b49..1bb976260b 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/entries.cfc
@@ -4,14 +4,12 @@
* An incoming site identifier is required
*/
component extends="baseContentHandler" {
-
// DI
property name="ormService" inject="EntryService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "publishedDate DESC";
+ variables.sortOrder = "publishedDate DESC";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Entry";
+ variables.entity = "Entry";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
@@ -22,28 +20,28 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/entries/index/responses.json
* @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR
*/
- function index( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{
- param rc.page = 1;
- param rc.excludes = "HTMLTitle,HTMLKeywords,HTMLDescription";
+ function index( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR" {
+ param rc.page = 1;
+ param rc.excludes = "HTMLTitle,HTMLKeywords,HTMLDescription";
// Criterias and Filters
param rc.sortOrder = "publishedDate DESC";
// Search terms
- param rc.search = "";
+ param rc.search = "";
// One or a list of categories to filter on
- param rc.category = "";
+ param rc.category = "";
// Author ID to filter on
- param rc.author = "";
+ param rc.author = "";
// Build up a search criteria and let the base execute it
arguments.results = variables.ormService.findPublishedContent(
- searchTerm = rc.search,
- category = rc.category,
- offset = getPageOffset( rc.page ),
- max = getMaxRows(),
- sortOrder = rc.sortOrder,
- siteId = prc.oCurrentSite.getSiteID(),
- authorID = rc.author
- );
+ searchTerm = rc.search,
+ category = rc.category,
+ offset = getPageOffset( rc.page ),
+ max = getMaxRows(),
+ sortOrder = rc.sortOrder,
+ siteId = prc.oCurrentSite.getSiteID(),
+ authorID = rc.author
+ );
// Build to match interface
arguments.results.records = arguments.results.content;
@@ -59,15 +57,17 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/entries/show/responses.json
* @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR
*/
- function show( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{
- param rc.includes = arrayToList( [
- "activeContent",
- "childrenSnapshot:children",
- "customFieldsAsStruct:customFields",
- "linkedContentSnapshot:linkedContent",
- "relatedContentSnapshot:relatedContent",
- "renderedContent"
- ] );
+ function show( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR" {
+ param rc.includes = arrayToList(
+ [
+ "activeContent",
+ "childrenSnapshot:children",
+ "customFieldsAsStruct:customFields",
+ "linkedContentSnapshot:linkedContent",
+ "relatedContentSnapshot:relatedContent",
+ "renderedContent"
+ ]
+ );
param rc.excludes = "";
super.show( argumentCollection = arguments );
@@ -81,7 +81,7 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/entries/create/responses.json
* @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR
*/
- function create( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{
+ function create( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR" {
// Supersize it
arguments.contentType = "ENTRIES";
super.save( argumentCollection = arguments );
@@ -94,7 +94,7 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/entries/update/responses.json
* @x -contentbox-permissions ENTRIES_ADMIN,ENTRIES_EDITOR
*/
- function update( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR"{
+ function update( event, rc, prc ) secured="ENTRIES_ADMIN,ENTRIES_EDITOR" {
// Supersize it
arguments.contentType = "ENTRIES";
super.save( argumentCollection = arguments );
@@ -107,8 +107,8 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/entries/delete/responses.json
* @x -contentbox-permissions ENTRIES_ADMIN
*/
- function delete( event, rc, prc ) secured="ENTRIES_ADMIN"{
+ function delete( event, rc, prc ) secured="ENTRIES_ADMIN" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc
index 4a5ff48e94..7fe20ce1d4 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/menus.cfc
@@ -4,23 +4,27 @@
* An incoming site identifier is required
*/
component extends="baseHandler" secured="MENUS_ADMIN" {
-
// DI
property name="ormService" inject="MenuService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "slug";
+ variables.sortOrder = "slug";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Menu";
+ variables.entity = "Menu";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming site
- param rc.site = "";
+ param rc.site = "";
prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
}
@@ -31,7 +35,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" {
* @responses contentbox/apidocs/menus/index/responses.json
* @x -contentbox-permissions MENUS_ADMIN
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Criterias and Filters
param rc.sortOrder = "slug";
@@ -49,7 +53,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" {
* @responses contentbox/apidocs/menus/show/responses.json
* @x -contentbox-permissions MENUS_ADMIN
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
param rc.includes = "rootMenuItems:menuItems";
param rc.excludes = "";
@@ -64,7 +68,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" {
* @responses contentbox/apidocs/menus/create/responses.json
* @x -contentbox-permissions MENUS_ADMIN
*/
- function create( event, rc, prc ){
+ function create( event, rc, prc ) {
super.create( argumentCollection = arguments );
}
@@ -75,7 +79,7 @@ component extends="baseHandler" secured="MENUS_ADMIN" {
* @responses contentbox/apidocs/menus/update/responses.json
* @x -contentbox-permissions MENUS_ADMIN
*/
- function update( event, rc, prc ){
+ function update( event, rc, prc ) {
super.update( argumentCollection = arguments );
}
@@ -86,8 +90,8 @@ component extends="baseHandler" secured="MENUS_ADMIN" {
* @responses contentbox/apidocs/menus/delete/responses.json
* @x -contentbox-permissions MENUS_ADMIN
*/
- function delete( event, rc, prc ){
+ function delete( event, rc, prc ) {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc
index 87857cfaef..4eb5991141 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/pages.cfc
@@ -4,14 +4,12 @@
* An incoming site identifier is required
*/
component extends="baseContentHandler" {
-
// DI
property name="ormService" inject="PageService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "publishedDate DESC";
+ variables.sortOrder = "publishedDate DESC";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Page";
+ variables.entity = "Page";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
@@ -22,28 +20,34 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/pages/index/responses.json
* @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR
*/
- function index( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{
- param rc.page = 1;
- param rc.excludes = "HTMLTitle,HTMLKeywords,HTMLDescription";
+ function index( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR" {
+ param rc.page = 1;
+ param rc.excludes = "HTMLTitle,HTMLKeywords,HTMLDescription";
// Criterias and Filters
- param rc.sortOrder = "publishedDate DESC";
+ param rc.sortOrder = "publishedDate DESC";
// Search terms
- param rc.search = "";
+ param rc.search = "";
// One or a list of categories to filter on
- param rc.category = "";
+ param rc.category = "";
// Author ID to filter on
- param rc.author = "";
+ param rc.author = "";
// The parent to filter on, default is root pages
- param rc.parent = "";
+ param rc.parent = "";
// Show in menu boolean bit
param rc.showInMenu = "";
// 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 `/`
param rc.slugPrefix = "";
// If passed, it's a slug operation
- param rc.slug = "";
+ param rc.slug = "";
// If we have a `slug` then we treat it as a /:slug route, due to hierarchical paths
- if ( rc.slug.trim().length() > 0 ) {
+ if (
+ rc
+ .slug
+ .trim()
+ .length() >
+ 0
+ ) {
rc.id = rc.slug;
return show( argumentCollection = arguments );
}
@@ -55,17 +59,17 @@ component extends="baseContentHandler" {
// Build up a search criteria and let the base execute it
arguments.results = variables.ormService.findPublishedContent(
- searchTerm = rc.search,
- category = rc.category,
- offset = getPageOffset( rc.page ),
- max = getMaxRows(),
- sortOrder = rc.sortOrder,
- siteId = prc.oCurrentSite.getSiteID(),
- authorID = rc.author,
- parent = rc.parent,
- slugPrefix = rc.slugPrefix,
- showInMenu = ( isBoolean( rc.showInMenu ) ? rc.showInMenu : javacast( "null", "" ) )
- );
+ searchTerm = rc.search,
+ category = rc.category,
+ offset = getPageOffset( rc.page ),
+ max = getMaxRows(),
+ sortOrder = rc.sortOrder,
+ siteId = prc.oCurrentSite.getSiteID(),
+ authorID = rc.author,
+ parent = rc.parent,
+ slugPrefix = rc.slugPrefix,
+ showInMenu = ( isBoolean( rc.showInMenu ) ? rc.showInMenu : javacast( "null", "" ) )
+ );
// Build to match interface
arguments.results.records = arguments.results.content;
@@ -81,15 +85,17 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/pages/show/responses.json
* @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR
*/
- function show( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{
- param rc.includes = arrayToList( [
- "activeContent",
- "childrenSnapshot:children",
- "customFieldsAsStruct:customFields",
- "linkedContentSnapshot:linkedContent",
- "relatedContentSnapshot:relatedContent",
- "renderedContent"
- ] );
+ function show( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR" {
+ param rc.includes = arrayToList(
+ [
+ "activeContent",
+ "childrenSnapshot:children",
+ "customFieldsAsStruct:customFields",
+ "linkedContentSnapshot:linkedContent",
+ "relatedContentSnapshot:relatedContent",
+ "renderedContent"
+ ]
+ );
param rc.excludes = "";
super.show( argumentCollection = arguments );
@@ -103,7 +109,7 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/pages/create/responses.json
* @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR
*/
- function create( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{
+ function create( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR" {
// Supersize it
arguments.contentType = "PAGES";
super.save( argumentCollection = arguments );
@@ -116,7 +122,7 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/pages/update/responses.json
* @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR
*/
- function update( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR"{
+ function update( event, rc, prc ) secured="PAGES_ADMIN,PAGES_EDITOR" {
// Supersize it
arguments.contentType = "PAGES";
super.save( argumentCollection = arguments );
@@ -129,8 +135,8 @@ component extends="baseContentHandler" {
* @responses contentbox/apidocs/pages/delete/responses.json
* @x -contentbox-permissions PAGES_ADMIN
*/
- function delete( event, rc, prc ) secured="PAGES_ADMIN"{
+ function delete( event, rc, prc ) secured="PAGES_ADMIN" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/relocations.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/relocations.cfc
index 5e98e63a93..5982878d42 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/relocations.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/relocations.cfc
@@ -3,23 +3,27 @@
* An incoming site identifier is required
*/
component extends="baseHandler" secured="PAGES_ADMIN,PAGES_EDITOR" {
-
// DI
property name="ormService" inject="RelocationService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "slug";
+ variables.sortOrder = "slug";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Relocation";
+ variables.entity = "Relocation";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming site
- param rc.site = "";
+ param rc.site = "";
prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
}
@@ -29,22 +33,29 @@ component extends="baseHandler" secured="PAGES_ADMIN,PAGES_EDITOR" {
* @tags relocations
* @responses contentbox/apidocs/relocations/index/responses.json
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Criterias and Filters
param rc.sortOrder = "slug";
- param rc.search = "";
+ param rc.search = "";
// Build up a search criteria and let the base execute it
arguments.criteria = newCriteria().isEq( "site", prc.oCurrentSite );
// Search Criteria
- arguments.criteria
- .when( len( rc.search ), function( c ){
- c.like( "slug", "%#search#%" );
- } )
+ arguments
+ .criteria
+ .when(
+ len( rc.search ),
+ function( c ) {
+ c.like( "slug", "%#search#%" );
+ }
+ )
// Content ID filter
- .when( !isNull( rc.contentID ), function( c ){
- c.isEq( "relatedContent.contentID", rc.contentID );
- } );
+ .when(
+ !isNull( rc.contentID ),
+ function( c ) {
+ c.isEq( "relatedContent.contentID", rc.contentID );
+ }
+ );
// Delegate it!
super.index( argumentCollection = arguments );
@@ -56,7 +67,7 @@ component extends="baseHandler" secured="PAGES_ADMIN,PAGES_EDITOR" {
* @tags relocations
* @responses contentbox/apidocs/relocations/show/responses.json
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
param rc.includes = "";
param rc.excludes = "";
@@ -71,7 +82,7 @@ component extends="baseHandler" secured="PAGES_ADMIN,PAGES_EDITOR" {
* @responses contentbox/apidocs/relocations/create/responses.json
* @x -contentbox-permissions relocations_ADMIN
*/
- function create( event, rc, prc ){
+ function create( event, rc, prc ) {
super.create( argumentCollection = arguments );
}
@@ -82,7 +93,7 @@ component extends="baseHandler" secured="PAGES_ADMIN,PAGES_EDITOR" {
* @responses contentbox/apidocs/relocations/update/responses.json
* @x -contentbox-permissions relocations_ADMIN
*/
- function update( event, rc, prc ){
+ function update( event, rc, prc ) {
super.update( argumentCollection = arguments );
}
@@ -93,8 +104,8 @@ component extends="baseHandler" secured="PAGES_ADMIN,PAGES_EDITOR" {
* @responses contentbox/apidocs/relocations/delete/responses.json
* @x -contentbox-permissions relocations_ADMIN
*/
- function delete( event, rc, prc ){
+ function delete( event, rc, prc ) {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc
index 6dcbd7d5c3..86299b2fa0 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/settings.cfc
@@ -2,15 +2,9 @@
* RESTFul API for Settings
*/
component extends="baseHandler" {
-
// DI
property name="settingService" inject="SettingService@contentbox";
-
- variables.RESERVED_SETTINGS = [
- "cb_enc_key",
- "cb_salt",
- "cb_site_mail_password"
- ];
+ variables.RESERVED_SETTINGS = [ "cb_enc_key", "cb_salt", "cb_site_mail_password"];
/**
* Display all system settings
@@ -19,16 +13,17 @@ component extends="baseHandler" {
* @responses contentbox/apidocs/settings/index/responses.json
* @x -contentbox-permissions SYSTEM_RAW_SETTINGS
*/
- function index( event, rc, prc ) secured="SYSTEM_RAW_SETTINGS"{
- event
- .getResponse()
- .setData(
- variables.settingService
+ function index( event, rc, prc ) secured="SYSTEM_RAW_SETTINGS" {
+ event.getResponse().setData(
+ variables
+ .settingService
.getAllSettings()
- .filter( function( key, value ){
- return !arrayContainsNoCase( variables.RESERVED_SETTINGS, arguments.key );
- } )
+ .filter(
+ function( key, value ) {
+ return !arrayContainsNoCase( variables.RESERVED_SETTINGS, arguments.key );
+ }
+ )
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc
index 836aa239a3..0ce372b5af 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/siteSettings.cfc
@@ -2,10 +2,8 @@
* RESTFul API for visualizing site settings
*/
component extends="baseHandler" secured="SITES_ADMIN" {
-
// DI
property name="settingService" inject="SettingService@contentbox";
-
variables.RESERVED_SETTINGS = [];
/**
@@ -15,25 +13,29 @@ component extends="baseHandler" secured="SITES_ADMIN" {
* @responses contentbox/apidocs/sites/settings/responses.json
* @x -contentbox-permissions SITES_ADMIN
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
var siteSettings = variables.settingService.getSettingsContainer().sites;
if ( !siteSettings.keyExists( rc.slug ) ) {
- arguments.event
+ arguments
+ .event
.getResponse()
.setError( true )
- .setStatusCode( arguments.event.STATUS.NOT_FOUND )
+ .setStatusCode( arguments
+ .event
+ .STATUS
+ .NOT_FOUND )
.addMessage( "The site requested doesn't exist" );
return;
}
- event
- .getResponse()
- .setData(
- siteSettings[ rc.slug ].filter( function( key, value ){
- return !arrayContainsNoCase( variables.RESERVED_SETTINGS, arguments.key );
- } )
+ event.getResponse().setData(
+ siteSettings[ rc.slug ].filter(
+ function( key, value ) {
+ return !arrayContainsNoCase( variables.RESERVED_SETTINGS, arguments.key );
+ }
+ )
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc
index a7cd577ae7..479fd6d0f6 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/sites.cfc
@@ -2,14 +2,12 @@
* RESTFul CRUD for Sites
*/
component extends="baseHandler" secured="SITES_ADMIN" {
-
// DI
property name="ormService" inject="SiteService@contentbox";
-
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "slug";
+ variables.sortOrder = "slug";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "Site";
+ variables.entity = "Site";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = false;
@@ -20,11 +18,11 @@ component extends="baseHandler" secured="SITES_ADMIN" {
* @responses contentbox/apidocs/sites/index/responses.json
* @x -contentbox-permissions SITES_ADMIN
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Criterias and Filters
param rc.sortOrder = "slug";
- param rc.search = "";
- param rc.isActive = true;
+ param rc.search = "";
+ param rc.isActive = true;
// Make sure isActive is boolean
if ( !isBoolean( rc.isActive ) ) {
@@ -32,16 +30,15 @@ component extends="baseHandler" secured="SITES_ADMIN" {
}
// Build up a search criteria and let the base execute it
- arguments.criteria = newCriteria()
- // Active filter
- .isEq( "isActive", javacast( "boolean", rc.isActive ) )
- // Search filter
- .when( len( rc.search ), function( c ){
- c.$or(
- c.restrictions.like( "name", "%#rc.search#%" ),
- c.restrictions.like( "description", "%#rc.search#%" )
- );
- } );
+ arguments.criteria = newCriteria().isEq( "isActive", javacast( "boolean", rc.isActive ) ).when(
+ len( rc.search ),
+ function( c ) {
+ c.$or(
+ c.restrictions.like( "name", "%#rc.search#%" ),
+ c.restrictions.like( "description", "%#rc.search#%" )
+ );
+ }
+ );
// Delegate it!
super.index( argumentCollection = arguments );
@@ -54,7 +51,7 @@ component extends="baseHandler" secured="SITES_ADMIN" {
* @responses contentbox/apidocs/sites/show/responses.json
* @x -contentbox-permissions SITES_ADMIN
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
super.show( argumentCollection = arguments );
}
@@ -66,7 +63,7 @@ component extends="baseHandler" secured="SITES_ADMIN" {
* @responses contentbox/apidocs/sites/create/responses.json
* @x -contentbox-permissions SITES_ADMIN
*/
- function create( event, rc, prc ){
+ function create( event, rc, prc ) {
// Supersize it
super.create( argumentCollection = arguments );
}
@@ -78,7 +75,7 @@ component extends="baseHandler" secured="SITES_ADMIN" {
* @responses contentbox/apidocs/sites/update/responses.json
* @x -contentbox-permissions SITES_ADMIN
*/
- function update( event, rc, prc ){
+ function update( event, rc, prc ) {
// You cannot update site slugs
arguments.populate.exclude = "slug";
super.update( argumentCollection = arguments );
@@ -91,8 +88,8 @@ component extends="baseHandler" secured="SITES_ADMIN" {
* @responses contentbox/apidocs/sites/delete/responses.json
* @x -contentbox-permissions SITES_ADMIN
*/
- function delete( event, rc, prc ){
+ function delete( event, rc, prc ) {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc
index 1f9cd06862..ac8e130d3f 100644
--- a/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc
+++ b/modules/contentbox/modules/contentbox-api/modules/contentbox-api-v1/handlers/versions.cfc
@@ -8,28 +8,33 @@ component
extends="baseHandler"
secured="PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR"
{
-
// DI
property name="ormService" inject="contentVersionService@contentbox";
- property name="contentService" inject="contentService@contentbox";
+ property name="contentService" inject="contentService@contentbox";
// The default sorting order string: permission, name, data desc, etc.
- variables.sortOrder = "version DESC";
+ variables.sortOrder = "version DESC";
// The name of the entity this resource handler controls. Singular name please.
- variables.entity = "ContentVersion";
+ variables.entity = "ContentVersion";
// Use getOrFail() or getByIdOrSlugOrFail() for show/delete/update actions
variables.useGetOrFail = true;
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Verify incoming params
- param rc.site = "";
+ param rc.site = "";
param rc.contentIdOrSlug = "";
- prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
- prc.contentType = event.getCurrentRouteMeta().contentType;
+ prc.oCurrentSite = rc.site = getSiteByIdOrSlugOrFail( rc.site );
+ prc.contentType = event.getCurrentRouteMeta().contentType;
prc.oRelatedContent = variables.contentService.getByIdOrSlugOrFail( rc.contentIdOrSlug, prc );
}
@@ -40,28 +45,31 @@ component
* @responses contentbox/apidocs/versions/index/responses.json
* @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR
*/
- function index( event, rc, prc ){
- param rc.page = 1;
+ function index( event, rc, prc ) {
+ param rc.page = 1;
// Criterias and Filters
- param rc.sortOrder = variables.sortOrder;
+ param rc.sortOrder = variables.sortOrder;
// Approved Bit
param rc.isApproved = "";
// Memento Params
- param rc.includes = "";
- param rc.excludes = "content";
+ param rc.includes = "";
+ param rc.excludes = "content";
// Boolean check is approved
if ( len( rc.isApproved ) && !isBoolean( rc.isApproved ) ) {
rc.isApproved = "";
}
// Build up a search criteria and let the base execute it
- arguments.criteria = newCriteria()
- // Pin the related content
- .isEq( "relatedContent.contentID", prc.oRelatedContent.getContentID() )
+ arguments.criteria = newCriteria().isEq( "relatedContent.contentID",
+ prc.oRelatedContent.getContentID() )// Pin the related content
+
// isApproved filter
- .when( len( rc.isApproved ), function( c ){
- arguments.c.isEq( "isApproved", javacast( "Boolean", rc.isApproved ) );
- } );
+ .when(
+ len( rc.isApproved ),
+ function( c ) {
+ arguments.c.isEq( "isApproved", javacast( "Boolean", rc.isApproved ) );
+ }
+ );
// Delegate it!
super.index( argumentCollection = arguments );
@@ -74,7 +82,7 @@ component
* @responses contentbox/apidocs/versions/show/responses.json
* @x -contentbox-permissions PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR,CONTENTSTORE_ADMIN,CONTENTSTORE_EDITOR
*/
- function show( event, rc, prc ){
+ function show( event, rc, prc ) {
param rc.includes = "relatedContentSnapshot:relatedContent";
param rc.excludes = "";
@@ -88,8 +96,8 @@ component
* @responses contentbox/apidocs/versions/delete/responses.json
* @x -contentbox-permissions VERSIONS_DELETE
*/
- function delete( event, rc, prc ) secured="VERSIONS_DELETE"{
+ function delete( event, rc, prc ) secured="VERSIONS_DELETE" {
super.delete( argumentCollection = arguments );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-deps/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-deps/ModuleConfig.cfc
index 2df4fd4292..9a02c8e190 100644
--- a/modules/contentbox/modules/contentbox-deps/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-deps/ModuleConfig.cfc
@@ -7,17 +7,16 @@
* dependencies required in ContentBox, via the `this.dependencies` property.
*/
component {
-
// Module Properties
- this.title = "contentbox-deps";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox Dependencies Module";
+ this.title = "contentbox-deps";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox Dependencies Module";
// No models to map
this.automapModels = false;
// The order of the dependencies to load before ContentBox loads.
- this.dependencies = [
+ this.dependencies = [
"cborm",
"cbjavaloader",
"cbmailservices",
@@ -33,13 +32,15 @@ component {
/**
* Configure Module
*/
- function configure(){
+ function configure() {
+
}
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc
index 841f0efb08..bd4996285f 100755
--- a/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-ui/ModuleConfig.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,16 +6,15 @@
* ContentBox UI module configuration
*/
component {
-
// Module Properties
- this.title = "contentbox-ui";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.version = "@version.number@+@build.number@";
- this.description = "ContentBox UI Module";
- this.viewParentLookup = true;
+ this.title = "contentbox-ui";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.version = "@version.number@+@build.number@";
+ this.description = "ContentBox UI Module";
+ this.viewParentLookup = true;
this.layoutParentLookup = true;
- this.dependencies = [];
+ this.dependencies = [];
// YOUR SES URL ENTRY POINT FOR CONTENTBOX, IF EMPTY IT WILL TAKE OVER THE ENTIRE APPLICATION
// IF YOU WANT TO SECTION OFF CONTENTBOX THEN FILL OUT AN SES ENTRY POINT LIKE /site OR /content
@@ -25,255 +24,257 @@ component {
/**
* Configure the module
*/
- function configure(){
+ function configure() {
// PARENT APPLICATION ROUTING IF IN TAKE OVER MODE. YOU CAN CUSTOMIZE THIS IF YOU LIKE.
// THIS MEANS THAT IF YOU WANT TO EXECUTE PARENT EVENTS YOU NEED TO PREFIX THEM WITH '/parent'
- parentSESPrefix = "/parent";
+ variables.parentSESPrefix = "/parent";
// CB UI SES Routing
- routes = [
+ variables.routes = [
/************************************** COMMAND ROUTES *********************************************/
// search filter
{
- pattern : "/__search/:q?/:page-numeric?",
- handler : "page",
- action : "search"
+ pattern: "/__search/:q?/:page-numeric?",
+ handler: "page",
+ action : "search"
},
// layout preview
{
- pattern : "/__preview",
- handler : "content",
- action : "previewSite"
+ pattern: "/__preview",
+ handler: "content",
+ action : "previewSite"
},
// entry preview
{
- pattern : "/__entry_preview",
- handler : "blog",
- action : "preview"
+ pattern: "/__entry_preview",
+ handler: "blog",
+ action : "preview"
},
// page preview
{
- pattern : "/__page_preview",
- handler : "page",
- action : "preview"
+ pattern: "/__page_preview",
+ handler: "page",
+ action : "preview"
},
// media delivery
{
- pattern : "/__media",
- handler : "media",
- action : "index"
+ pattern: "/__media",
+ handler: "media",
+ action : "index"
},
// subscribe link
{
- pattern : "/__subscribe",
- handler : "subscription",
- action : "subscribe"
+ pattern: "/__subscribe",
+ handler: "subscription",
+ action : "subscribe"
},
// manage subscriptions
{
- pattern : "/__subscriptions/:subscribertoken",
- handler : "subscription",
- action : "subscriptions"
+ pattern: "/__subscriptions/:subscribertoken",
+ handler: "subscription",
+ action : "subscriptions"
},
// remove subscriptions
{
- pattern : "/__removesubscriptions/",
- handler : "subscription",
- action : "removeSubscriptions"
+ pattern: "/__removesubscriptions/",
+ handler: "subscription",
+ action : "removeSubscriptions"
},
// unsubscribe link for single subscription
{
- pattern : "/__unsubscribe/:subscriptionToken",
- handler : "subscription",
- action : "unsubscribe"
+ pattern: "/__unsubscribe/:subscriptionToken",
+ handler: "subscription",
+ action : "unsubscribe"
},
// change language
{
- pattern : "/__changeLang/:lang{5}",
- handler : "content",
- action : "changeLang"
+ pattern: "/__changeLang/:lang{5}",
+ handler: "content",
+ action : "changeLang"
},
/************************************** RSS ROUTES *********************************************/
// Global Page RSS feeds with filtering
{
- pattern : "/__rss/pages/category/:category?",
- handler : "rss",
- action : "pages"
+ pattern: "/__rss/pages/category/:category?",
+ handler: "rss",
+ action : "pages"
},
{
- pattern : "/__rss/pages/comments/:slug?",
- handler : "rss",
- action : "pages",
- commentRSS : true
+ pattern : "/__rss/pages/comments/:slug?",
+ handler : "rss",
+ action : "pages",
+ commentRSS: true
},
{
- pattern : "/__rss/pages/",
- handler : "rss",
- action : "pages"
+ pattern: "/__rss/pages/",
+ handler: "rss",
+ action : "pages"
},
// Site Global RSS feeds Filtered by Categories
{
- pattern : "/__rss/category/:category",
- handler : "rss",
- action : "index"
+ pattern: "/__rss/category/:category",
+ handler: "rss",
+ action : "index"
},
// Global Site RSS Comments Feed With an extra content slug
{
- pattern : "/__rss/comments",
- handler : "rss",
- action : "index",
- commentRSS : true
+ pattern : "/__rss/comments",
+ handler : "rss",
+ action : "index",
+ commentRSS: true
},
// Global Site RSS Content Feed
- { pattern : "/__rss", handler : "rss", action : "index" },
+ { pattern: "/__rss", handler: "rss", action: "index" },
/************************************** CATCH ALL PAGE ROUTE *********************************************/
// page permalink, discovery of nested pages is done here, the aboved slugs are reserved.
{
- pattern : "/__pageCommentPost",
- handler : "page",
- action : "commentPost"
+ pattern: "/__pageCommentPost",
+ handler: "page",
+ action : "commentPost"
},
// Catch All Page Routing
{
- pattern : "/:pageUri",
- handler : "page",
- action : "index"
+ pattern: "/:pageUri",
+ handler: "page",
+ action : "index"
},
// Home Pattern
- { pattern : "/", handler : "blog", action : "index" }
+ { pattern: "/", handler: "blog", action: "index" }
];
/************************************** BLOG ROUTES NAMESPACE *********************************************/
- blogRoutes = [
+ variables.blogRoutes = [
// Blog Archives
{
- pattern : "/archives/:year-numeric{4}?/:month-numeric{1,2}?/:day-numeric{1,2}?",
- handler : "blog",
- action : "archives",
- namespace : "blog"
+ pattern : "/archives/:year-numeric{4}?/:month-numeric{1,2}?/:day-numeric{1,2}?",
+ handler : "blog",
+ action : "archives",
+ namespace: "blog"
},
// Blog RSS feeds
{
- pattern : "/rss/category/:category",
- handler : "blog",
- action : "rss",
- namespace : "blog"
- },
- {
- pattern : "/rss/comments/:entrySlug?",
- handler : "blog",
- action : "rss",
- commentRSS : true,
- namespace : "blog"
+ pattern : "/rss/category/:category",
+ handler : "blog",
+ action : "rss",
+ namespace: "blog"
},
{
- pattern : "/rss/",
+ pattern : "/rss/comments/:entrySlug?",
handler : "blog",
action : "rss",
+ commentRSS: true,
namespace : "blog"
},
+ {
+ pattern : "/rss/",
+ handler : "blog",
+ action : "rss",
+ namespace: "blog"
+ },
// category filter
{
- pattern : "/category/:category/:page-numeric?",
- handler : "blog",
- action : "index",
- namespace : "blog"
+ pattern : "/category/:category/:page-numeric?",
+ handler : "blog",
+ action : "index",
+ namespace: "blog"
},
// search filter
{
- pattern : "/search/:q?/:page-numeric?",
- handler : "blog",
- action : "index",
- namespace : "blog"
+ pattern : "/search/:q?/:page-numeric?",
+ handler : "blog",
+ action : "index",
+ namespace: "blog"
},
// Blog comment post
{
- pattern : "/:entrySlug/commentPost",
- handler : "blog",
- action : "commentPost",
- namespace : "blog"
+ pattern : "/:entrySlug/commentPost",
+ handler : "blog",
+ action : "commentPost",
+ namespace: "blog"
},
// blog permalink
{
- pattern : "/:entrySlug",
- handler : "blog",
- action : "entry",
- namespace : "blog"
+ pattern : "/:entrySlug",
+ handler : "blog",
+ action : "entry",
+ namespace: "blog"
},
// Blog reserved route
{
- pattern : "/",
- handler : "blog",
- action : "index",
- namespace : "blog"
+ pattern : "/",
+ handler : "blog",
+ action : "index",
+ namespace: "blog"
}
];
// CB UI Event driven programming extensions
interceptorSettings = {
// ContentBox UI Custom Events, you can add your own if you like to!
- customInterceptionPoints : arrayToList( [
- // Layout HTML points: A layout must announce them via cb.event( "cbui_footer",{renderer=this} ) make sure you pass in the renderer
- "cbui_beforeHeadEnd",
- "cbui_afterBodyStart",
- "cbui_beforeBodyEnd",
- "cbui_footer",
- "cbui_beforeContent",
- "cbui_afterContent",
- "cbui_beforeSideBar",
- "cbui_afterSideBar",
- // Code Interception points
- "cbui_onPageNotFound",
- "cbui_onEntryNotFound",
- "cbui_onError",
- "cbui_preRequest",
- "cbui_postRequest",
- "cbui_onContentSearch",
- // Fixed Handler Points
- "cbui_onIndex",
- "cbui_onArchives",
- "cbui_onEntry",
- "cbui_onPage",
- "cbui_preCommentPost",
- "cbui_onCommentPost",
- "cbui_onCommentModerationRules",
- // Fixed HTML Points
- "cbui_preEntryDisplay",
- "cbui_postEntryDisplay",
- "cbui_preIndexDisplay",
- "cbui_postIndexDisplay",
- "cbui_preCommentForm",
- "cbui_postCommentForm",
- "cbui_prePageDisplay",
- "cbui_postPageDisplay",
- "cbui_preArchivesDisplay",
- "cbui_postArchivesDisplay",
- // Media Services
- "cbui_onInvalidMedia",
- "cbui_onMediaRequest"
- ] )
+ customInterceptionPoints: arrayToList(
+ [
+ // Layout HTML points: A layout must announce them via cb.event( "cbui_footer",{renderer=this} ) make sure you pass in the renderer
+ "cbui_beforeHeadEnd",
+ "cbui_afterBodyStart",
+ "cbui_beforeBodyEnd",
+ "cbui_footer",
+ "cbui_beforeContent",
+ "cbui_afterContent",
+ "cbui_beforeSideBar",
+ "cbui_afterSideBar",
+ // Code Interception points
+ "cbui_onPageNotFound",
+ "cbui_onEntryNotFound",
+ "cbui_onError",
+ "cbui_preRequest",
+ "cbui_postRequest",
+ "cbui_onContentSearch",
+ // Fixed Handler Points
+ "cbui_onIndex",
+ "cbui_onArchives",
+ "cbui_onEntry",
+ "cbui_onPage",
+ "cbui_preCommentPost",
+ "cbui_onCommentPost",
+ "cbui_onCommentModerationRules",
+ // Fixed HTML Points
+ "cbui_preEntryDisplay",
+ "cbui_postEntryDisplay",
+ "cbui_preIndexDisplay",
+ "cbui_postIndexDisplay",
+ "cbui_preCommentForm",
+ "cbui_postCommentForm",
+ "cbui_prePageDisplay",
+ "cbui_postPageDisplay",
+ "cbui_preArchivesDisplay",
+ "cbui_postArchivesDisplay",
+ // Media Services
+ "cbui_onInvalidMedia",
+ "cbui_onMediaRequest"
+ ]
+ )
};
// CB UI Interceptors
interceptors = [
// CB UI Request Interceptor
{
- class : "#moduleMapping#.interceptors.CBRequest",
- name : "CBRequest",
- properties : { entryPoint : this.entryPoint }
+ class : "#moduleMapping#.interceptors.CBRequest",
+ name : "CBRequest",
+ properties: { entryPoint: this.entryPoint }
},
// Simple Security For pages and blog entries
{
- class : "#moduleMapping#.interceptors.SimpleSecurity",
- name : "SimpleSecurity"
+ class: "#moduleMapping#.interceptors.SimpleSecurity",
+ name : "SimpleSecurity"
},
// Global HTML interceptor for rendering HTML Points
{
- class : "#moduleMapping#.interceptors.GlobalHTML",
- name : "GlobalHTML"
+ class: "#moduleMapping#.interceptors.GlobalHTML",
+ name : "GlobalHTML"
}
];
}
@@ -281,7 +282,7 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
// Startup the ContentBox theme service and activate the site themes
wirebox.getInstance( "themeService@contentbox" ).startupSiteThemes();
@@ -292,28 +293,31 @@ component {
if ( !len( this.entryPoint ) ) {
// get parent routes so we can re-mix them later
var routingService = controller.getRoutingService();
- var parentRoutes = routingService.getRoutes();
- var newRoutes = [];
+ var parentRoutes = routingService.getRoutes();
+ var newRoutes = [];
// Keep non-convention routing
routingService.setRoutes(
- parentRoutes.filter( function( item ){
- return ( item.pattern NEQ ":handler/" AND item.pattern NEQ ":handler/:action/" );
- } )
- );
+ parentRoutes.filter(
+ function( item ) {
+ return ( item.pattern NEQ ":handler/" && item.pattern NEQ ":handler/:action/" );
+ }
+ )
+ );
// Add parent execution routing
routingService.addRoute( pattern = "#variables.parentSESPrefix#/:handler/:action?" );
// Register UI routes now in take over mode.
- variables.routes.each( function( item ){
- // Check if handler defined
- if ( structKeyExists( item, "handler" ) ) {
- item.handler = "contentbox-ui:#item.handler#";
- }
- // add it as main application route.
- routingService.addRoute( argumentCollection = item );
- } );
+ variables.routes.each(
+ function( item ) {
+ if ( structKeyExists( item, "handler" ) ) {
+ item.handler = "contentbox-ui:#item.handler#";
+ }
+
+ routingService.addRoute( argumentCollection = item );
+ }
+ );
// Point Default event to UI
controller.setSetting( "DefaultEvent", "contentbox-ui:blog" );
@@ -323,39 +327,39 @@ component {
/**
* Register blog namespace and its routes
*/
- private function registerBlogNamespace(){
+ private function registerBlogNamespace() {
// Get ses handle
var routingService = controller.getRoutingService();
// Get setting service
var settingService = wirebox.getInstance( "settingService@contentbox" );
// Get blog entry point from DB
- var blogEntryPoint = settingService.findWhere( { name : "cb_site_blog_entrypoint" } );
+ var blogEntryPoint = settingService.findWhere( { name: "cb_site_blog_entrypoint" } );
// Register Custom Blog Namespace
if ( !isNull( blogEntryPoint ) ) {
routingService.addNamespace(
- pattern = "#this.entryPoint#/#blogEntryPoint.getValue()#",
- namespace = "blog",
- append = false
- );
- }
- // Register Default Blog Namespace
- else {
+ pattern = "#this.entryPoint#/#blogEntryPoint.getValue()#",
+ namespace = "blog",
+ append = false
+ );
+ } else {
+ // Register Default Blog Namespace
routingService.addNamespace(
- pattern = "#this.entryPoint#/blog",
- namespace = "blog",
- append = false
- );
+ pattern = "#this.entryPoint#/blog",
+ namespace = "blog",
+ append = false
+ );
}
// Register namespace routes
- variables.blogRoutes.each( function( item ){
- // Check if handler defined
- if ( structKeyExists( item, "handler" ) ) {
- item.handler = "contentbox-ui:#item.handler#";
- }
- routingService.addRoute( argumentCollection = item );
- } );
+ variables.blogRoutes.each(
+ function( item ) {
+ if ( structKeyExists( item, "handler" ) ) {
+ item.handler = "contentbox-ui:#item.handler#";
+ }
+ routingService.addRoute( argumentCollection = item );
+ }
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc b/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc
index f63ec76793..3b5d77f762 100644
--- a/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc
+++ b/modules/contentbox/modules/contentbox-ui/handlers/blog.cfc
@@ -6,19 +6,25 @@
* Handler For ContentBox blog pages
*/
component extends="content" {
-
// DI
property name="entryService" inject="id:entryService@contentbox";
+
property name="relocationService" inject="RelocationService@contentbox";
- property name="paginator" inject="Paging@contentbox";
+ property name="paginator" inject="Paging@contentbox";
// Pre Handler Exceptions
this.preHandler_except = "preview";
/**
* Pre Handler
*/
- function preHandler( event, rc, prc, action, eventArguments ){
+ function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Check if disabled?
if ( !prc.oCurrentSite.getIsBlogEnabled() ) {
event.overrideEvent( "contentbox-ui:blog.disabled" );
@@ -30,57 +36,60 @@ component extends="content" {
/**
* Action if blog is disabled
*/
- function disabled( event, rc, prc ){
+ function disabled( event, rc, prc ) {
// missing page, the blog as it does not exist
- prc.missingPage = event.getCurrentRoutedURL();
+ prc.missingPage = event.getCurrentRoutedURL();
prc.missingRoutedURL = event.getCurrentRoutedURL();
// set 404 headers
event.setHTTPHeader( "404", "Page not found" );
// set skin not found
- event
- .setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/notfound", module = prc.cbThemeRecord.module );
+ event.setLayout( name = "#prc.cbTheme#/layouts/pages",
+ module = prc.cbThemeRecord.module ).setView( view = "#prc.cbTheme#/views/notfound",
+ module = prc.cbThemeRecord.module );
}
/**
* Preview a blog entry
*/
- function preview( event, rc, prc ){
+ function preview( event, rc, prc ) {
// Run parent preview
super.preview( argumentCollection = arguments );
// Concrete Overrides Below
// Construct the preview entry according to passed arguments
- prc.entry = variables.entryService.new( {
- title : rc.title,
- slug : rc.slug,
- publishedDate : now(),
- allowComments : false,
- cache : false,
- markup : rc.markup,
- site : variables.siteService.getOrFail( rc.siteID )
- } );
+ prc.entry = variables.entryService.new(
+ {
+ title : rc.title,
+ slug : rc.slug,
+ publishedDate: now(),
+ allowComments: false,
+ cache : false,
+ markup : rc.markup,
+ site : variables.siteService.getOrFail( rc.siteID )
+ }
+ );
// Comments need to be empty
prc.comments = [];
// Create preview version
prc.entry.addNewContentVersion(
- content = urlDecode( rc.content ),
- author = prc.oCurrentAuthor,
- isPreview = true
- );
+ content = urlDecode( rc.content ),
+ author = prc.oCurrentAuthor,
+ isPreview = true
+ );
// set skin view
- event
- .setLayout( name = "#prc.cbTheme#/layouts/#rc.layout#", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/entry", module = prc.cbThemeRecord.module );
+ event.setLayout(
+ name = "#prc.cbTheme#/layouts/#rc.layout#",
+ module = prc.cbThemeRecord.module
+ ).setView( view = "#prc.cbTheme#/views/entry", module = prc.cbThemeRecord.module );
}
/**
* The blog home page
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// incoming params
event
.paramValue( "page", 1 )
@@ -94,54 +103,59 @@ component extends="content" {
}
// prepare paging object
- prc.oPaging = variables.paginator;
- prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows: prc.cbSettings.cb_paging_maxentries );
- prc.blogLink = variables.CBHelper.linkBlog();
- prc.pagingLink = prc.blogLink & "?page=@page@";
+ prc.oPaging = variables.paginator;
+ prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows = prc.cbSettings.cb_paging_maxentries );
+ prc.blogLink = variables.CBHelper.linkBlog();
+ prc.pagingLink = prc.blogLink & "?page=@page@";
// Search Paging Link Override?
if ( len( rc.q ) ) {
- rc.q = encodeForHTML( rc.q );
+ rc.q = encodeForHTML( rc.q );
prc.pagingLink = prc.blogLink & "/search/#rc.q#/@page@?";
}
// Category Filter Link Override
if ( len( rc.category ) ) {
- rc.category = encodeForHTML( rc.category );
+ rc.category = encodeForHTML( rc.category );
prc.pagingLink = prc.blogLink & "/category/#rc.category#/@page@?";
}
// get published entries
var entryResults = variables.entryService.findPublishedContent(
- offset : prc.pagingBoundaries.startRow - 1,
- max : prc.cbSettings.cb_paging_maxentries,
- category : rc.category,
- searchTerm: rc.q,
- siteID : prc.oCurrentSite.getsiteID()
- );
- prc.entries = entryResults.content;
+ offset = prc.pagingBoundaries.startRow - 1,
+ max = prc.cbSettings.cb_paging_maxentries,
+ category = rc.category,
+ searchTerm = rc.q,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
+ prc.entries = entryResults.content;
prc.entriesCount = entryResults.count;
// announce event
- announce( "cbui_onIndex", { entries : prc.entries, entriesCount : prc.entriesCount } );
+ announce(
+ "cbui_onIndex",
+ { entries: prc.entries, entriesCount: prc.entriesCount }
+ );
// Export Formats?
switch ( rc.format ) {
case "json": {
event.renderData(
- type = rc.format,
- data = prc.entries.map( function( thisEntry ){
- return arguments.thisEntry.getMemento( profile = "response" )
- } ),
- xmlRootName = "entries"
- );
+ type = rc.format,
+ data = prc.entries.map(
+ function( thisEntry ) {
+ return arguments.thisEntry.getMemento( profile = "response" );
+ }
+ ),
+ xmlRootName = "entries"
+ );
break;
}
default: {
// set skin view
- event
- .setLayout( name = "#prc.cbTheme#/layouts/blog", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/index", module = prc.cbThemeRecord.module );
+ event.setLayout( name = "#prc.cbTheme#/layouts/blog",
+ module = prc.cbThemeRecord.module ).setView( view = "#prc.cbTheme#/views/index",
+ module = prc.cbThemeRecord.module );
}
}
}
@@ -149,7 +163,7 @@ component extends="content" {
/**
* The archives
*/
- function archives( event, rc, prc ){
+ function archives( event, rc, prc ) {
// incoming params
event
.paramValue( "page", 1 )
@@ -164,42 +178,47 @@ component extends="content" {
}
// prepare paging object
- prc.oPaging = variables.paginator;
+ prc.oPaging = variables.paginator;
prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows = prc.cbSettings.cb_paging_maxentries );
- prc.pagingLink = event.getCurrentRoutedURL() & "?page=@page@";
+ prc.pagingLink = event.getCurrentRoutedURL() & "?page=@page@";
// get published entries
var entryResults = variables.entryService.findPublishedEntriesByDate(
- year = rc.year,
- month = rc.month,
- day = rc.day,
- offset = prc.pagingBoundaries.startRow - 1,
- max = prc.cbSettings.cb_paging_maxentries,
- siteID = prc.oCurrentSite.getsiteID()
- );
- prc.entries = entryResults.entries;
+ year = rc.year,
+ month = rc.month,
+ day = rc.day,
+ offset = prc.pagingBoundaries.startRow - 1,
+ max = prc.cbSettings.cb_paging_maxentries,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
+ prc.entries = entryResults.entries;
prc.entriesCount = entryResults.count;
// announce event
- announce( "cbui_onArchives", { entries : prc.entries, entriesCount : prc.entriesCount } );
+ announce(
+ "cbui_onArchives",
+ { entries: prc.entries, entriesCount: prc.entriesCount }
+ );
// Export Formats?
switch ( rc.format ) {
case "json": {
event.renderData(
- type = rc.format,
- data = prc.entries.map( function( thisEntry ){
- return arguments.thisEntry.getMemento( profile: "response" )
- } ),
- xmlRootName = "entries"
- );
+ type = rc.format,
+ data = prc.entries.map(
+ function( thisEntry ) {
+ return arguments.thisEntry.getMemento( profile = "response" );
+ }
+ ),
+ xmlRootName = "entries"
+ );
break;
}
default: {
// set skin view
- event
- .setLayout( name = "#prc.cbTheme#/layouts/blog", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/archives", module = prc.cbThemeRecord.module );
+ event.setLayout( name = "#prc.cbTheme#/layouts/blog",
+ module = prc.cbThemeRecord.module ).setView( view = "#prc.cbTheme#/views/archives",
+ module = prc.cbThemeRecord.module );
}
}
}
@@ -207,10 +226,10 @@ component extends="content" {
/**
* Around entry page advice that provides caching and multi-output format
*/
- function aroundEntry( event, rc, prc, eventArguments ){
+ function aroundEntry( event, rc, prc, eventArguments ) {
// setup wrap arguments
arguments.contentCaching = prc.cbSettings.cb_entry_caching;
- arguments.action = variables.entry;
+ arguments.action = variables.entry;
return wrapContentAdvice( argumentCollection = arguments );
}
@@ -218,20 +237,20 @@ component extends="content" {
/**
* An entry page
*/
- function entry( event, rc, prc ){
+ function entry( event, rc, prc ) {
// incoming params
event.paramValue( "entrySlug", "" );
// get the author
var showUnpublished = false;
- if ( prc.oCurrentAuthor.isLoaded() AND prc.oCurrentAuthor.isLoggedIn() ) {
+ if ( prc.oCurrentAuthor.isLoaded() && prc.oCurrentAuthor.isLoggedIn() ) {
var showUnpublished = true;
}
prc.entry = variables.entryService.findBySlug(
- slug : rc.entrySlug,
- showUnpublished: showUnpublished,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ slug = rc.entrySlug,
+ showUnpublished = showUnpublished,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// Check if loaded, else not found
if ( prc.entry.isLoaded() ) {
@@ -239,45 +258,55 @@ component extends="content" {
variables.entryService.updateHits( prc.entry );
// Retrieve Comments
// TODO: paging
- var commentResults = variables.commentService.findAllApproved(
- contentID: prc.entry.getContentID(),
- sortOrder: "asc"
- );
- prc.comments = commentResults.comments;
+ var commentResults = variables.commentService.findAllApproved( contentID = prc.entry.getContentID(),
+ sortOrder = "asc" );
+ prc.comments = commentResults.comments;
prc.commentsCount = commentResults.count;
// announce event
- announce( "cbui_onEntry", { entry : prc.entry, entrySlug : rc.entrySlug } );
+ announce(
+ "cbui_onEntry",
+ { entry: prc.entry, entrySlug: rc.entrySlug }
+ );
// set skin view
- event
- .setLayout( name = "#prc.cbTheme#/layouts/blog", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/entry", module = prc.cbThemeRecord.module );
+ event.setLayout( name = "#prc.cbTheme#/layouts/blog",
+ module = prc.cbThemeRecord.module ).setView( view = "#prc.cbTheme#/views/entry",
+ module = prc.cbThemeRecord.module );
} else {
- var relocation = variables.relocationService.getRelocationBySlug( rc.entrySlug, "Entry", prc.oCurrentSite );
+ var relocation = variables.relocationService.getRelocationBySlug(
+ rc.entrySlug,
+ "Entry",
+ prc.oCurrentSite
+ );
if ( !isNull( relocation ) ) {
relocate(
- URL = variables.CBHelper.linkBlog() & "/" & (
- !isNull( relocation.getRelatedContent() ) ? relocation.getRelatedContent().getSlug() : relocation.getTarget()
+ URL = variables.CBHelper.linkBlog() & "/" & (
+ !isNull( relocation.getRelatedContent() )
+ ? relocation.getRelatedContent().getSlug()
+ : relocation.getTarget()
),
statusCode = 301
);
}
// announce event
- announce( "cbui_onEntryNotFound", { entry : prc.entry, entrySlug : rc.entrySlug } );
+ announce(
+ "cbui_onEntryNotFound",
+ { entry: prc.entry, entrySlug: rc.entrySlug }
+ );
// missing page
prc.missingPage = rc.entrySlug;
// set 404 headers
event.setHTTPHeader( "404", "Entry not found" );
// set skin not found
- event
- .setLayout( name = "#prc.cbTheme#/layouts/blog", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/notfound", module = prc.cbThemeRecord.module );
+ event.setLayout( name = "#prc.cbTheme#/layouts/blog",
+ module = prc.cbThemeRecord.module ).setView( view = "#prc.cbTheme#/views/notfound",
+ module = prc.cbThemeRecord.module );
}
}
/**
* Display the RSS feeds for the blog
*/
- function rss( event, rc, prc ){
+ function rss( event, rc, prc ) {
// params
event
.paramValue( "category", "" )
@@ -286,36 +315,41 @@ component extends="content" {
// Build out the blog RSS feeds
var feed = variables.RSSService.getRSS(
- comments : rc.commentRSS,
- category : rc.category,
- slug : rc.entrySlug,
- contentType: "Entry",
- siteID : prc.oCurrentSite.getsiteID()
- );
+ comments = rc.commentRSS,
+ category = rc.category,
+ slug = rc.entrySlug,
+ contentType = "Entry",
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// Render out the feed xml
rc.format = "rss";
event.renderData(
- type = "plain",
- data = feed,
- contentType = "text/xml"
- );
+ type = "plain",
+ data = feed,
+ contentType = "text/xml"
+ );
}
/**
* Comment Form Post
*/
- function commentPost( event, rc, prc ){
+ function commentPost( event, rc, prc ) {
// incoming params
event.paramValue( "entrySlug", "" );
// Try to retrieve entry by slug
- var thisEntry = variables.entryService.findBySlug( slug: rc.entrySlug, siteID: prc.oCurrentSite.getsiteID() );
+ var thisEntry = variables.entryService.findBySlug( slug = rc.entrySlug, siteID = prc.oCurrentSite.getsiteID() );
// If null, kick them out
if ( isNull( thisEntry ) ) {
relocate( prc.cbEntryPoint );
}
// validate incoming comment post
- validateCommentPost( event, rc, prc, thisEntry );
+ validateCommentPost(
+ event,
+ rc,
+ prc,
+ thisEntry
+ );
// Valid commenting, so go and save
saveComment(
thisContent = thisEntry,
@@ -324,4 +358,4 @@ component extends="content" {
);
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/handlers/content.cfc b/modules/contentbox/modules/contentbox-ui/handlers/content.cfc
index b7d0666f23..e0a7d17f7e 100644
--- a/modules/contentbox/modules/contentbox-ui/handlers/content.cfc
+++ b/modules/contentbox/modules/contentbox-ui/handlers/content.cfc
@@ -6,27 +6,41 @@
* Manage Content display
*/
component {
-
// DI
property name="authorService" inject="id:authorService@contentbox";
+
property name="categoryService" inject="id:categoryService@contentbox";
+
property name="contentService" inject="id:contentService@contentbox";
+
property name="commentService" inject="id:commentService@contentbox";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
+
property name="rssService" inject="id:rssService@contentbox";
+
property name="themeService" inject="id:themeService@contentbox";
+
property name="messagebox" inject="id:messagebox@cbMessageBox";
+
property name="dataMarshaller" inject="DataMarshaller@coldbox";
+
property name="markdown" inject="Processor@cbmarkdown";
- property name="siteService" inject="siteService@contentbox";
+ property name="siteService" inject="siteService@contentbox";
// Pre Handler Exceptions
this.preHandler_except = "previewSite";
/**
* Pre Handler
*/
- function preHandler( event, rc, prc, action, eventArguments ){
+ function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// Maintenance Mode?
if ( prc.cbSettings.cb_site_maintenance ) {
if ( prc.oCurrentAuthor.isLoggedIn() && prc.oCurrentAuthor.hasPermission( "MAINTENANCE_MODE_VIEWER" ) ) {
@@ -40,9 +54,8 @@ component {
// Home page determination either blog or a page
// Blog routes are in the blog namespace
if (
- event.getCurrentRoute() eq "/" AND
- prc.oCurrentSite.getHomepage() neq "cbBlog" AND
- event.getCurrentRoutedNamespace() neq "blog"
+ event.getCurrentRoute() EQ "/" && prc.oCurrentSite.getHomepage() NEQ "cbBlog" &&
+ event.getCurrentRoutedNamespace() NEQ "blog"
) {
event.overrideEvent( "contentbox-ui:page.index" );
prc.pageOverride = prc.oCurrentSite.getHomepage();
@@ -57,7 +70,7 @@ component {
/**
* Change the fwLocale
*/
- function changeLang( event, rc, prc ){
+ function changeLang( event, rc, prc ) {
event.paramValue( "lang", "en_US" );
setFWLocale( rc.lang );
relocate( url = "/" );
@@ -66,7 +79,7 @@ component {
/**
* Preview the site
*/
- function previewSite( event, rc, prc ){
+ function previewSite( event, rc, prc ) {
// Param incoming data
event.paramValue( "l", "" ).paramValue( "h", "" );
@@ -75,12 +88,11 @@ component {
// valid Author?
if (
- prc.oCurrentAuthor.isLoaded() AND
- prc.oCurrentAuthor.isLoggedIn() AND
- compareNoCase( hash( prc.oCurrentAuthor.getAuthorID() ), rc.h ) EQ 0
+ prc.oCurrentAuthor.isLoaded() && prc.oCurrentAuthor.isLoggedIn() &&
+ compareNoCase( hash( prc.oCurrentAuthor.getAuthorID() ), rc.h ) EQ 0
) {
// Place theme on scope
- prc.cbTheme = rc.l;
+ prc.cbTheme = rc.l;
// Place theme root location
prc.cbThemeRoot = prc.cbRoot & "/themes/" & rc.l;
// Home page determination either blog or a page
@@ -89,8 +101,11 @@ component {
event.overrideEvent( "contentbox-ui:page.index" );
prc.pageOverride = prc.oCurrentSite.getHomepage();
// run it
- var eArgs = { noCache : true };
- runEvent( event = "contentbox-ui:page.index", eventArguments = eArgs );
+ var eArgs = { noCache: true };
+ runEvent(
+ event = "contentbox-ui:page.index",
+ eventArguments = eArgs
+ );
// Override the layout
event.setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module );
} else {
@@ -100,7 +115,7 @@ component {
runEvent( "contentbox-ui:blog.index" );
}
} else {
- // Invalid Credentials
+ // Invalid Credentials
relocate( URL = CBHelper.linkBlog() );
}
}
@@ -108,18 +123,21 @@ component {
/**
* Go Into maintenance mode.
*/
- function maintenance( event, rc, prc ){
+ function maintenance( event, rc, prc ) {
// If no maintenance view exists, just output data
if ( !themeService.themeMaintenanceViewExists() ) {
- event.renderData( data = variables.markdown.toHTML( prc.cbSettings.cb_site_maintenance_message ) );
+ event.renderData(
+ data = variables.markdown.toHTML( prc.cbSettings.cb_site_maintenance_message )
+ );
} else {
// output maintenance view
- event
- .setLayout(
+ event.setLayout(
name = "#prc.cbTheme#/layouts/#themeService.getThemeMaintenanceLayout()#",
module = prc.cbThemeRecord.module
- )
- .setView( view = "#prc.cbTheme#/views/maintenance", module = prc.cbThemeRecord.module );
+ ).setView(
+ view = "#prc.cbTheme#/views/maintenance",
+ module = prc.cbThemeRecord.module
+ );
}
}
@@ -133,25 +151,25 @@ component {
faultAction,
exception,
eventArguments
- ){
+ ) {
// store exceptions
prc.faultAction = arguments.faultAction;
- prc.exception = arguments.exception;
+ prc.exception = arguments.exception;
// announce event
announce(
"cbui_onError",
{
- faultAction : arguments.faultAction,
- exception : arguments.exception,
- eventArguments : arguments.eventArguments
+ faultAction : arguments.faultAction,
+ exception : arguments.exception,
+ eventArguments: arguments.eventArguments
}
);
// Set view to render
- event
- .setLayout( name = "#prc.cbTheme#/layouts/pages", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/error", module = prc.cbThemeRecord.module );
+ event.setLayout( name = "#prc.cbTheme#/layouts/pages",
+ module = prc.cbThemeRecord.module ).setView( view = "#prc.cbTheme#/views/error",
+ module = prc.cbThemeRecord.module );
}
/************************************** PRIVATE *********************************************/
@@ -173,7 +191,7 @@ component {
required eventArguments,
required action,
required boolean contentCaching
- ){
+ ) {
// param incoming multi UI formats
event.paramValue( "format", "html" );
// If UI export is disabled, default to contentbox
@@ -183,24 +201,25 @@ component {
// Caching Enabled? Then test if data is in cache.
var cacheEnabled = (
- arguments.contentCaching AND
- !structKeyExists( eventArguments, "noCache" ) AND
- !event.valueExists( "cbCache" ) AND
- !flash.exists( "commentErrors" )
+ arguments.contentCaching && !structKeyExists( eventArguments, "noCache" ) &&
+ !event.valueExists( "cbCache" ) &&
+ !flash.exists( "commentErrors" )
);
if ( cacheEnabled ) {
// Get appropriate cache provider from settings
- var cache = cacheBox.getCache( prc.cbSettings.cb_content_cacheName );
+ var cache = cacheBox.getCache( prc.cbSettings.cb_content_cacheName );
var cacheKey = "";
// Do we have an override page setup by the settings?
- if ( structKeyExists( prc, "pageOverride" ) and len( prc.pageOverride ) ) {
+ if ( structKeyExists( prc, "pageOverride" ) && len( prc.pageOverride ) ) {
cacheKey = "cb-content-wrapper-#cgi.HTTP_HOST#-#prc.pageOverride#/";
} else {
cacheKey = "cb-content-wrapper-#cgi.HTTP_HOST#-#left( event.getCurrentRoutedURL(), 500 )#";
}
// Incorporate internal hash + rc distinct hash + formats
- cacheKey &= hash( ".#getFWLocale()#.#rc.format#.#event.isSSL()#" & prc.cbox_incomingContextHash );
+ cacheKey &= hash(
+ ".#getFWLocale()#.#rc.format#.#event.isSSL()##prc.cbox_incomingContextHash#"
+ );
// get content data from cache
prc.contentCacheData = cache.get( cacheKey );
@@ -208,18 +227,17 @@ component {
if ( !isNull( prc.contentCacheData ) ) {
// Set cache headers if allowed
if ( prc.cbSettings.cb_content_cachingHeader ) {
- event
- .setHTTPHeader( statusCode = "203" )
- .setHTTPHeader( name = "x-contentbox-cached-content", value = "true" );
+ event.setHTTPHeader( statusCode = "203" ).setHTTPHeader( name = "x-contentbox-cached-content",
+ value = "true" );
}
// Store hits
variables.contentService.updateHits( prc.contentCacheData.contentID );
// return cache content to be displayed
event.renderData(
- data = prc.contentCacheData.content,
- contentType = prc.contentCacheData.contentType,
- isBinary = prc.contentCacheData.isBinary
- );
+ data = prc.contentCacheData.content,
+ contentType = prc.contentCacheData.contentType,
+ isBinary = prc.contentCacheData.isBinary
+ );
// Breakout, cached output is done my young padawan learner!
return;
}
@@ -227,15 +245,15 @@ component {
// Prepare data packet for rendering and caching and more
var data = {
- contentID : "",
- contentType : "text/html",
- isBinary : false
+ contentID : "",
+ contentType: "text/html",
+ isBinary : false
};
// Prepare args for action execution
var args = {
- event : arguments.event,
- rc : arguments.rc,
- prc : arguments.prc
+ event: arguments.event,
+ rc : arguments.rc,
+ prc : arguments.prc
};
structAppend( args, arguments.eventArguments );
// execute the wrapped action
@@ -252,10 +270,10 @@ component {
// generate content only if content is not set, else means handler generated content.
if ( isNull( data.content ) ) {
data.content = layout(
- layout = "#prc.cbTheme#/layouts/#themeService.getThemePrintLayout(
- format = rc.format,
- layout = listLast( event.getCurrentLayout(), "/" )
- )#",
+ layout = "#prc.cbTheme#/layouts/#themeService.getThemePrintLayout(
+ format = rc.format,
+ layout = listLast( event.getCurrentLayout(), "/" )
+ )#",
module = prc.cbThemeRecord.module,
viewModule = prc.cbThemeRecord.module
);
@@ -265,51 +283,55 @@ component {
switch ( rc.format ) {
case "doc": {
data.contentType = "application/msword";
- data.isBinary = false;
+ data.isBinary = false;
break;
}
case "json": {
- data.content = dataMarshaller.marshallData(
- data = oContent.getMemento( profile: "response" ),
- type = "json"
- );
+ data.content = dataMarshaller.marshallData( data = oContent.getMemento( profile = "response" ),
+ type = "json" );
data.contentType = "application/json";
- data.isBinary = false;
+ data.isBinary = false;
break;
}
default: {
data.contentType = "text/html";
- data.isBinary = false;
+ data.isBinary = false;
}
}
// Tell renderdata to render it
event.renderData(
- data = data.content,
- contentType = data.contentType,
- isBinary = data.isBinary
- );
+ data = data.content,
+ contentType = data.contentType,
+ isBinary = data.isBinary
+ );
// verify if caching is possible by testing the content parameters
- if ( cacheEnabled AND oContent.isLoaded() AND oContent.getCache() AND oContent.isContentPublished() ) {
+ if ( cacheEnabled && oContent.isLoaded() && oContent.getCache() && oContent.isContentPublished() ) {
// store content ID as we have it by now
data.contentID = oContent.getContentID();
// Cache data
cache.set(
- cachekey,
- data,
- ( oContent.getCacheTimeout() eq 0 ? prc.cbSettings.cb_content_cachingTimeout : oContent.getCacheTimeout() ),
- (
- oContent.getCacheLastAccessTimeout() eq 0 ? prc.cbSettings.cb_content_cachingTimeoutIdle : oContent.getCacheLastAccessTimeout()
- )
- );
+ cachekey,
+ data,
+ (
+ oContent.getCacheTimeout() EQ 0
+ ? prc.cbSettings.cb_content_cachingTimeout
+ : oContent.getCacheTimeout()
+ ),
+ (
+ oContent.getCacheLastAccessTimeout() EQ 0
+ ? prc.cbSettings.cb_content_cachingTimeoutIdle
+ : oContent.getCacheLastAccessTimeout()
+ )
+ );
}
}
/**
* Preview content page super event. Only called internally
*/
- private function preview( event, rc, prc ){
+ private function preview( event, rc, prc ) {
// Param incoming data
event
.paramValue( "content", "" )
@@ -322,9 +344,8 @@ component {
// valid Author?
if (
- !prc.oCurrentAuthor.isLoaded() OR
- !prc.oCurrentAuthor.isLoggedIn() OR
- compareNoCase( hash( prc.oCurrentAuthor.getAuthorID() ), rc.h ) NEQ 0
+ !prc.oCurrentAuthor.isLoaded() || !prc.oCurrentAuthor.isLoggedIn() ||
+ compareNoCase( hash( prc.oCurrentAuthor.getAuthorID() ), rc.h ) NEQ 0
) {
// Not an author, kick them out.
relocate( URL = "/" );
@@ -346,7 +367,7 @@ component {
required rc,
required prc,
required thisContent
- ){
+ ) {
// param values
event
.paramValue( "author", "" )
@@ -356,26 +377,33 @@ component {
.paramValue( "subscribe", false );
// Check if comments enabled? else kick them out, who knows how they got here
- if ( NOT CBHelper.isCommentsEnabled( arguments.thisContent ) ) {
+ if ( !CBHelper.isCommentsEnabled( arguments.thisContent ) ) {
messagebox.warn( "Comments are disabled! So you can't post any!" );
relocate( URL = CBHelper.linkContent( arguments.thisContent ) );
}
// Trim values & XSS Cleanup of fields
- rc.author = left( encodeForHTML( trim( rc.author ) ), 100 );
- rc.authorEmail = left( canonicalize( trim( rc.authorEmail ), true, true ), 255 );
- rc.authorURL = left( encodeForHTML( trim( rc.authorURL ) ), 255 );
- rc.content = encodeForHTML( trim( rc.content ) );
+ rc.author = left( encodeForHTML( trim( rc.author ) ), 100 );
+ rc.authorEmail = left(
+ canonicalize(
+ trim( rc.authorEmail ),
+ true,
+ true
+ ),
+ 255
+ );
+ rc.authorURL = left( encodeForHTML( trim( rc.authorURL ) ), 255 );
+ rc.content = encodeForHTML( trim( rc.content ) );
// Validate incoming data
var commentErrors = [];
if ( !len( rc.author ) ) {
arrayAppend( commentErrors, "Your name is missing!" );
}
- if ( !len( rc.authorEmail ) OR NOT isValid( "email", rc.authorEmail ) ) {
+ if ( !len( rc.authorEmail ) || !isValid( "email", rc.authorEmail ) ) {
arrayAppend( commentErrors, "Your email is missing or is invalid!" );
}
- if ( len( rc.authorURL ) AND NOT isValid( "URL", rc.authorURL ) ) {
+ if ( len( rc.authorURL ) && !isValid( "URL", rc.authorURL ) ) {
arrayAppend( commentErrors, "Your website URL is invalid!" );
}
if ( !len( rc.content ) ) {
@@ -386,9 +414,9 @@ component {
announce(
"cbui_preCommentPost",
{
- commentErrors : commentErrors,
- content : arguments.thisContent,
- contentType : arguments.thisContent.getContentType()
+ commentErrors: commentErrors,
+ content : arguments.thisContent,
+ contentType : arguments.thisContent.getContentType()
}
);
@@ -396,10 +424,10 @@ component {
if ( arrayLen( commentErrors ) ) {
// Flash errors
flash.put(
- name = "commentErrors",
- value = commentErrors,
- inflateTOPRC = true
- );
+ name = "commentErrors",
+ value = commentErrors,
+ inflateTOPRC = true
+ );
// Message
messagebox.warn( arrayToList( commentErrors, " " ) );
// Redirect
@@ -422,9 +450,9 @@ component {
required thisContent,
required subscribe = false,
required prc
- ){
+ ) {
// Get new comment to persist
- var comment = populate( model: commentService.new(), exclude: "commentID" );
+ var comment = populate( model = commentService.new(), exclude = "commentID" );
// relate it to content
comment.setRelatedContent( arguments.thisContent );
// save it
@@ -434,11 +462,11 @@ component {
announce(
"cbui_onCommentPost",
{
- comment : comment,
- content : arguments.thisContent,
- moderationResults : results,
- contentType : arguments.thisContent.getContentType(),
- subscribe : arguments.subscribe
+ comment : comment,
+ content : arguments.thisContent,
+ moderationResults: results,
+ contentType : arguments.thisContent.getContentType(),
+ subscribe : arguments.subscribe
}
);
@@ -446,10 +474,10 @@ component {
if ( results.moderated ) {
// Message that comment was moderated
flash.put(
- name = "commentErrors",
- value = results.messages,
- inflateTOPRC = true
- );
+ name = "commentErrors",
+ value = results.messages,
+ inflateTOPRC = true
+ );
// Message
messagebox.warn( arrayToList( results.messages, " " ) );
// relocate back to comments
@@ -460,4 +488,4 @@ component {
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/handlers/media.cfc b/modules/contentbox/modules/contentbox-ui/handlers/media.cfc
index 0320aae4ed..6f28a2e1c2 100644
--- a/modules/contentbox/modules/contentbox-ui/handlers/media.cfc
+++ b/modules/contentbox/modules/contentbox-ui/handlers/media.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,15 +6,15 @@
* Handles media services
*/
component singleton {
-
// DI
property name="mediaService" inject="id:mediaService@contentbox";
+
property name="settingService" inject="id:settingService@contentbox";
/**
* Deliver Media
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Set to render so there is no attempt to find a view
event.noRender();
// Param cache purge
@@ -46,27 +46,41 @@ component singleton {
// Get the media provider
var mediaProvider = mediaService.getDefaultProvider();
// Check if media path detected
- if ( !len( prc.mediaPath ) OR !mediaProvider.mediaExists( prc.mediaPath ) ) {
+ if ( !len( prc.mediaPath ) || !mediaProvider.mediaExists( prc.mediaPath ) ) {
// return invalid media
- return invalidMedia( event, rc, prc );
+ return invalidMedia(
+ event,
+ rc,
+ prc
+ );
}
// Announce media delivery
- var iData = { mediaPath : prc.mediaPath, mediaProvider : mediaProvider };
+ var iData = { mediaPath: prc.mediaPath, mediaProvider: mediaProvider };
announce( "cbui_onMediaRequest", iData );
// Media Caching Headers
- if ( !rc.cbcache and settingService.getSetting( "cb_media_provider_caching" ) ) {
+ if ( !rc.cbcache && settingService.getSetting( "cb_media_provider_caching" ) ) {
// Set expiration for one year in advanced
event
- .setHTTPHeader( name = "expires", value = "#getHTTPTimeString( dateAdd( "yyyy", 1, now() ) )#" )
+ .setHTTPHeader(
+ name = "expires",
+ value = "#getHTTPTimeString( dateAdd(
+ "yyyy",
+ 1,
+ now()
+ ) )#"
+ )
.setHTTPHeader( name = "pragma", value = "cache" )
.setHTTPHeader( name = "cache-control", value = "public, max-age=2592000" );
} else {
event
.setHTTPHeader( name = "expires", value = "#getHTTPTimeString( now() )#" )
.setHTTPHeader( name = "pragma", value = "no-cache" )
- .setHTTPHeader( name = "cache-control", value = "no-cache, no-store, must-revalidate" );
+ .setHTTPHeader(
+ name = "cache-control",
+ value = "no-cache, no-store, must-revalidate"
+ );
}
// Deliver it baby!
@@ -76,12 +90,15 @@ component singleton {
/************************************** PRIVATE *********************************************/
// Invalid Media
- private function invalidMedia( event, rc, prc ){
+ private function invalidMedia( event, rc, prc ) {
// Announce invalid media
- var iData = { mediaPath : prc.mediaPath };
+ var iData = { mediaPath: prc.mediaPath };
announce( "cbui_onInvalidMediaRequest", iData );
// Render invalid media
- event.renderData( data = "404: Requested path not found ", statusCode = "404" );
+ event.renderData(
+ data = "404: Requested path not found ",
+ statusCode = "404"
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc
index c419b17e59..37076b2842 100644
--- a/modules/contentbox/modules/contentbox-ui/handlers/page.cfc
+++ b/modules/contentbox/modules/contentbox-ui/handlers/page.cfc
@@ -6,29 +6,38 @@
* Manages page displays
*/
component extends="content" {
-
// DI
property name="pageService" inject="pageService@contentbox";
+
property name="relocationService" inject="RelocationService@contentbox";
+
property name="searchService" inject="SearchService@contentbox";
+
property name="securityService" inject="securityService@contentbox";
+
property name="mobileDetector" inject="mobileDetector@contentbox";
- property name="themeService" inject="themeService@contentbox";
+ property name="themeService" inject="themeService@contentbox";
// Pre Handler Exceptions
this.preHandler_except = "preview";
/**
* Pre handler for pages
*/
- function preHandler( event, action, eventArguments, rc, prc ){
+ function preHandler(
+ event,
+ action,
+ eventArguments,
+ rc,
+ prc
+ ) {
super.preHandler( argumentCollection = arguments );
}
/**
* Preview a page
*/
- function preview( event, rc, prc ){
+ function preview( event, rc, prc ) {
// Run parent preview
super.preview( argumentCollection = arguments );
@@ -36,26 +45,28 @@ component extends="content" {
var typeService = getContentTypeService( rc.contentType );
// Construct the preview entry according to passed arguments
- prc.page = typeService.new( {
- title : rc.title,
- slug : rc.slug,
- publishedDate : now(),
- allowComments : false,
- cache : false,
- markup : rc.markup,
- layout : rc.layout,
- site : variables.siteService.getOrFail( rc.siteID )
- } );
+ prc.page = typeService.new(
+ {
+ title : rc.title,
+ slug : rc.slug,
+ publishedDate: now(),
+ allowComments: false,
+ cache : false,
+ markup : rc.markup,
+ layout : rc.layout,
+ site : variables.siteService.getOrFail( rc.siteID )
+ }
+ );
// Comments need to be empty
prc.comments = [];
// Create preview version
prc.page.addNewContentVersion(
- content = urlDecode( rc.content ),
- author = prc.oCurrentAuthor,
- isPreview = true
- );
+ content = urlDecode( rc.content ),
+ author = prc.oCurrentAuthor,
+ isPreview = true
+ );
// Do we have a parent?
if ( len( rc.parentContent ) && isNumeric( rc.parentContent ) ) {
@@ -65,19 +76,16 @@ component extends="content" {
}
}
-
// set skin view
switch ( rc.layout ) {
case "-no-layout-": {
return prc.page.renderContent();
}
default: {
- event
- .setLayout(
+ event.setLayout(
name = "#prc.cbTheme#/layouts/#prc.page.getLayoutWithInheritance()#",
module = prc.cbThemeRecord.module
- )
- .setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module );
+ ).setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module );
}
}
}
@@ -86,10 +94,10 @@ component extends="content" {
* Around page advice that provides caching and multi-output format
*
*/
- function aroundIndex( event, rc, prc, eventArguments ){
+ function aroundIndex( event, rc, prc, eventArguments ) {
// setup wrap arguments
arguments.contentCaching = prc.cbSettings.cb_content_caching;
- arguments.action = variables.index;
+ arguments.action = variables.index;
return wrapContentAdvice( argumentCollection = arguments );
}
@@ -98,24 +106,34 @@ component extends="content" {
* Present pages in the UI
*
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Routing placeholder
event.paramValue( "pageUri", "" );
// Detect full page uri or override it via a prehandler check
- rc.pageUri = isNull( prc.pageOverride ) ? reReplaceNoCase( event.getCurrentRoutedURL(), "\/$", "" ) : prc.pageOverride;
+ rc.pageUri = isNull( prc.pageOverride )
+ ? reReplaceNoCase(
+ event.getCurrentRoutedURL(),
+ "\/$",
+ ""
+ )
+ : prc.pageOverride;
// Cleanup the module entry point if any
if ( len( prc.cbEntryPoint ) ) {
- rc.pageUri = replaceNoCase( rc.pageUri, prc.cbEntryPoint & "/", "" );
+ rc.pageUri = replaceNoCase(
+ rc.pageUri,
+ prc.cbEntryPoint & "/",
+ ""
+ );
}
// Try to get the page using the incoming URI
prc.page = variables.pageService.findBySlug(
- slug : rc.pageUri,
- showUnpublished: ( prc.oCurrentAuthor.isLoaded() AND prc.oCurrentAuthor.isLoggedIn() ) ? true : false,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ slug = rc.pageUri,
+ showUnpublished = ( prc.oCurrentAuthor.isLoaded() && prc.oCurrentAuthor.isLoggedIn() ) ? true : false,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// Check if loaded and also the ancestry is ok as per hiearchical URls
if ( prc.page.isLoaded() ) {
@@ -124,40 +142,42 @@ component extends="content" {
// Retrieve Comments
// TODO: paging
if ( prc.page.getAllowComments() ) {
- var commentResults = variables.commentService.findAllApproved(
- contentID = prc.page.getContentID(),
- sortOrder = "asc"
- );
- prc.comments = commentResults.comments;
+ var commentResults = variables.commentService.findAllApproved( contentID = prc.page.getContentID(),
+ sortOrder = "asc" );
+ prc.comments = commentResults.comments;
prc.commentsCount = commentResults.count;
} else {
- prc.comments = [];
+ prc.comments = [];
prc.commentsCount = 0;
}
// Detect Mobile Device
prc.isMobileDevice = variables.mobileDetector.isMobile();
// announce event
- announce( "cbui_onPage", { page : prc.page, isMobile : prc.isMobileDevice } );
+ announce(
+ "cbui_onPage",
+ { page: prc.page, isMobile: prc.isMobileDevice }
+ );
// Get the layout
var thisLayout = prc.page.getLayoutWithInheritance();
// No layout, just render it out
- if ( thisLayout eq "-no-layout-" ) {
+ if ( thisLayout EQ "-no-layout-" ) {
return prc.page.renderContent();
}
// set layout + view combo
- event
- .setLayout( name = "#prc.cbTheme#/layouts/#thisLayout#", module = prc.cbThemeRecord.module )
- .setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module );
+ event.setLayout(
+ name = "#prc.cbTheme#/layouts/#thisLayout#",
+ module = prc.cbThemeRecord.module
+ ).setView( view = "#prc.cbTheme#/views/page", module = prc.cbThemeRecord.module );
return;
} else {
- var relocation = variables.relocationService.getRelocationBySlug(
- slug = rc.pageUri,
- site = prc.oCurrentSite
- );
+ var relocation = variables.relocationService.getRelocationBySlug( slug = rc.pageUri,
+ site = prc.oCurrentSite );
if ( !isNull( relocation ) ) {
relocate(
- URI = "/" & (
- !isNull( relocation.getRelatedContent() ) ? relocation.getRelatedContent().getSlug() : relocation.getTarget()
+ URI = "/" & (
+ !isNull( relocation.getRelatedContent() )
+ ? relocation.getRelatedContent().getSlug()
+ : relocation.getTarget()
),
statusCode = 301
);
@@ -166,20 +186,19 @@ component extends="content" {
// end if page was loaded
// missing page
- prc.missingPage = rc.pageUri;
+ prc.missingPage = rc.pageUri;
prc.missingRoutedURL = event.getCurrentRoutedURL();
- var interceptData =
- {
- page : prc.page,
- missingPage : prc.missingPage,
- routedURL : prc.missingRoutedURL,
- layout : "#prc.cbTheme#/layouts/pages",
- layoutModule : prc.cbThemeRecord.module,
- view : "#prc.cbTheme#/views/notfound",
- viewModule : prc.cbThemeRecord.module,
- statusCode : "404",
- statusMessage : "Page not found"
+ var interceptData = {
+ page : prc.page,
+ missingPage : prc.missingPage,
+ routedURL : prc.missingRoutedURL,
+ layout : "#prc.cbTheme#/layouts/pages",
+ layoutModule : prc.cbThemeRecord.module,
+ view : "#prc.cbTheme#/views/notfound",
+ viewModule : prc.cbThemeRecord.module,
+ statusCode : "404",
+ statusMessage: "Page not found"
};
// announce event
@@ -197,7 +216,7 @@ component extends="content" {
*
* @return HTML
*/
- function search( event, rc, prc ){
+ function search( event, rc, prc ) {
// incoming params
event.paramValue( "page", 1 ).paramValue( "q", "" );
@@ -205,48 +224,45 @@ component extends="content" {
rc.q = htmlEditFormat( trim( rc.q ) );
// prepare paging object
- prc.oPaging = getInstance( "paging@contentbox" );
- prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows: prc.cbSettings.cb_search_maxResults );
- prc.pagingLink = variables.CBHelper.linkContentSearch() & "/#urlEncodedFormat( rc.q )#/@page@";
+ prc.oPaging = getInstance( "paging@contentbox" );
+ prc.pagingBoundaries = prc.oPaging.getBoundaries( pagingMaxRows = prc.cbSettings.cb_search_maxResults );
+ prc.pagingLink = variables.CBHelper.linkContentSearch() & "/#urlEncodedFormat( rc.q )#/@page@";
// get search results
if ( len( rc.q ) ) {
var searchAdapter = variables.searchService.getSearchAdapter();
prc.searchResults = searchAdapter.search(
- offset : prc.pagingBoundaries.startRow - 1,
- max : prc.cbSettings.cb_search_maxResults,
- searchTerm: rc.q,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ offset = prc.pagingBoundaries.startRow - 1,
+ max = prc.cbSettings.cb_search_maxResults,
+ searchTerm = rc.q,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
prc.searchResultsContent = searchAdapter.renderSearchWithResults( prc.searchResults );
} else {
- prc.searchResults = getInstance( "SearchResults@contentbox" );
+ prc.searchResults = getInstance( "SearchResults@contentbox" );
prc.searchResultsContent = "Please enter a search term to search on.
";
}
// set skin search
- event
- .setLayout(
+ event.setLayout(
name = "#prc.cbTheme#/layouts/#themeService.getThemeSearchLayout()#",
module = prc.cbThemeRecord.module
- )
- .setView( view = "#prc.cbTheme#/views/search", module = prc.cbThemeRecord.module );
+ ).setView( view = "#prc.cbTheme#/views/search", module = prc.cbThemeRecord.module );
// announce event
announce(
"cbui_onContentSearch",
{
- searchResults : prc.searchResults,
- searchResultsContent : prc.searchResultsContent
+ searchResults : prc.searchResults,
+ searchResultsContent: prc.searchResultsContent
}
);
}
-
/**
* RSS Feeds
*/
- function rss( event, rc, prc ){
+ function rss( event, rc, prc ) {
// params
event.paramValue( "category", "" );
event.paramValue( "entrySlug", "" );
@@ -254,23 +270,23 @@ component extends="content" {
// Build out the RSS feeds
var feed = RSSService.getRSS(
- comments = rc.commentRSS,
- category = rc.category,
- entrySlug = rc.entrySlug
- );
+ comments = rc.commentRSS,
+ category = rc.category,
+ entrySlug = rc.entrySlug
+ );
// Render out the feed xml
event.renderData(
- type = "plain",
- data = feed,
- contentType = "text/xml"
- );
+ type = "plain",
+ data = feed,
+ contentType = "text/xml"
+ );
}
/**
* Comment Form Post
*/
- function commentPost( event, rc, prc ){
+ function commentPost( event, rc, prc ) {
// incoming params
event.paramValue( "contentID", "" );
// Try to retrieve page by contentID
@@ -280,7 +296,12 @@ component extends="content" {
relocate( prc.cbEntryPoint );
}
// validate incoming comment post
- validateCommentPost( event, rc, prc, page );
+ validateCommentPost(
+ event,
+ rc,
+ prc,
+ page
+ );
// Valid commenting, so go and save
saveComment(
thisContent = page,
@@ -296,8 +317,8 @@ component extends="content" {
*
* @contentType The type of service needed
*/
- private function getContentTypeService( contentType = "page" ){
+ private function getContentTypeService( contentType = "page" ) {
return ( arguments.contentType == "page" ? variables.pageService : variables.contentService );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/handlers/rss.cfc b/modules/contentbox/modules/contentbox-ui/handlers/rss.cfc
index 45d088e82b..fb9ab64066 100644
--- a/modules/contentbox/modules/contentbox-ui/handlers/rss.cfc
+++ b/modules/contentbox/modules/contentbox-ui/handlers/rss.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,7 +10,7 @@ component extends="content" {
/**
* Display the RSS feeds for the ContentBox
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// params
event.paramValue( "category", "" );
event.paramValue( "contentSlug", "" );
@@ -18,25 +18,25 @@ component extends="content" {
// Build out the site RSS feeds
var feed = variables.RSSService.getRSS(
- comments: rc.commentRSS,
- category: rc.category,
- slug : rc.contentSlug,
- siteID : prc.oCurrentSite.getsiteID()
- );
+ comments = rc.commentRSS,
+ category = rc.category,
+ slug = rc.contentSlug,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// Render out the feed xml
rc.format = "rss";
event.renderData(
- type = "plain",
- data = feed,
- contentType = "text/xml"
- );
+ type = "plain",
+ data = feed,
+ contentType = "text/xml"
+ );
}
/**
* Display the RSS feeds for the pages
*/
- function pages( event, rc, prc ){
+ function pages( event, rc, prc ) {
// params
event.paramValue( "category", "" );
event.paramValue( "commentRSS", false );
@@ -44,20 +44,20 @@ component extends="content" {
// Build out the site RSS feeds
var feed = variables.RSSService.getRSS(
- category : rc.category,
- slug : rc.slug,
- comments : rc.commentRSS,
- contentType: "Page",
- siteID : prc.oCurrentSite.getsiteID()
- );
+ category = rc.category,
+ slug = rc.slug,
+ comments = rc.commentRSS,
+ contentType = "Page",
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// Render out the feed xml
rc.format = "rss";
event.renderData(
- type = "plain",
- data = feed,
- contentType = "text/xml"
- );
+ type = "plain",
+ data = feed,
+ contentType = "text/xml"
+ );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc b/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc
index e59695b147..7ef7803fa9 100644
--- a/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc
+++ b/modules/contentbox/modules/contentbox-ui/handlers/subscription.cfc
@@ -6,23 +6,25 @@
* Handles subscriptions
*/
component {
-
// DI
property name="subscriberService" inject="subscriberService@contentbox";
+
property name="subscriptionService" inject="id:subscriptionService@contentbox";
+
property name="messagebox" inject="messagebox@cbmessagebox";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
/**
* Remove subscriptions
*/
- function removeSubscriptions( event, rc, prc ){
+ function removeSubscriptions( event, rc, prc ) {
event.paramValue( "keysToRemove", "" ).paramValue( "subscriberToken", "" );
// check to make sure that at least one subscription AND subscriber token are found
if ( len( rc.keysToRemove ) && len( rc.subscriberToken ) ) {
// try to find subscriber by token
- var oSubscriber = subscriberService.findWhere( criteria = { "subscriberToken" : rc.subscriberToken } );
+ var oSubscriber = subscriberService.findWhere( criteria = { "subscriberToken": rc.subscriberToken } );
if ( !isNull( oSubscriber ) ) {
var targets = listToArray( rc.keysToRemove );
// loop over remove targets
@@ -35,7 +37,9 @@ component {
messagebox.error( "Sorry, the subscriber token sent is not valid!" );
}
} else {
- messagebox.warn( "Sorry, we couldn't complete your request. Please try again." );
+ messagebox.warn(
+ "Sorry, we couldn't complete your request. Please try again."
+ );
}
relocate( URL = CBHelper.linkHome() );
@@ -44,29 +48,32 @@ component {
/**
* Display Subscriptions
*/
- function subscriptions( event, rc, prc ){
+ function subscriptions( event, rc, prc ) {
event.paramValue( "subscriberToken", "" );
if ( len( rc.subscriberToken ) ) {
// get subscriber
- prc.oSubscriber = subscriberService.findWhere( criteria = { "subscriberToken" : rc.subscriberToken } );
+ prc.oSubscriber = subscriberService.findWhere( criteria = { "subscriberToken": rc.subscriberToken } );
if ( !isNull( prc.oSubscriber ) ) {
prc.subscriptions = prc.oSubscriber.getSubscriptionsByContentType();
} else {
- prc.oSubscriber = subscriberService.new();
+ prc.oSubscriber = subscriberService.new();
prc.subscriptions = {};
- messagebox.error( "The subscriber token you sent does not exist in our system!" );
+ messagebox.error(
+ "The subscriber token you sent does not exist in our system!"
+ );
}
}
- event
- .setLayout( name = "#prc.cbTheme#/layouts/pages", module = "contentbox" )
- .setView( view = "subscription/subscriptions" );
+ event.setLayout(
+ name = "#prc.cbTheme#/layouts/pages",
+ module = "contentbox"
+ ).setView( view = "subscription/subscriptions" );
}
/**
* Unsubscribe from comment notifications
*/
- function unsubscribe( event, rc, prc ){
- var criteria = { subscriptionToken : rc.subscriptionToken };
+ function unsubscribe( event, rc, prc ) {
+ var criteria = { subscriptionToken: rc.subscriptionToken };
var oSubscription = subscriptionService.findWhere( criteria = criteria );
// if we find a match...
@@ -77,7 +84,7 @@ component {
messagebox.warn( "You have been succssfully unsubscribed!" );
// see if subscriber has others; if so, we can provide a handy link to managing their other subs
prc.subscriberToken = subscriber.getSubscriberToken();
- prc.subscriptions = subscriber.getSubscriptionsByContentType();
+ prc.subscriptions = subscriber.getSubscriptionsByContentType();
} else {
messagebox.warn( "Sorry, your request could not be completed." );
}
@@ -85,4 +92,4 @@ component {
relocate( "__subscriptions/#prc.subscriberToken#" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/interceptors/CBRequest.cfc b/modules/contentbox/modules/contentbox-ui/interceptors/CBRequest.cfc
index 3d080b7703..7dda3b0c5f 100755
--- a/modules/contentbox/modules/contentbox-ui/interceptors/CBRequest.cfc
+++ b/modules/contentbox/modules/contentbox-ui/interceptors/CBRequest.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,20 +6,21 @@
* Manages ContentBox UI Module Requests
*/
component extends="coldbox.system.Interceptor" {
-
// DI
property name="settingService" inject="settingService@contentbox";
+
property name="contentService" inject="contentService@contentbox";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
/**
* Configure CB Request
*/
- function configure(){
+ function configure() {
// Make sure we attach ourselves to the singleton renderer in ColdBox 6
var renderer = variables.controller.getRenderer();
- renderer.cb = variables.CBHelper;
+ renderer.cb = variables.CBHelper;
renderer.$cbinject = variables.$cbinject;
renderer.$cbinject();
}
@@ -27,7 +28,13 @@ component extends="coldbox.system.Interceptor" {
/**
* Fired on contentbox requests
*/
- function preProcess( event, data, buffer, rc, prc ) eventPattern="^contentbox\-ui"{
+ function preProcess(
+ event,
+ data,
+ buffer,
+ rc,
+ prc
+ ) eventPattern="^contentbox\-ui" {
// Verify ContentBox installer has been ran?
if ( !settingService.isCBReady() ) {
// Check if installer module exists, else throw exception
@@ -36,9 +43,9 @@ component extends="coldbox.system.Interceptor" {
relocate( "cbInstaller" );
} else {
throw(
- message: "Oops! ContentBox is not installed and the Installer module cannot be found",
- detail : "To install the installer module use CommandBox via 'install contentbox-installer'",
- type : "ContentBoxInstallerMissing"
+ message = "Oops! ContentBox is not installed and the Installer module cannot be found",
+ detail = "To install the installer module use CommandBox via 'install contentbox-installer'",
+ type = "ContentBoxInstallerMissing"
);
}
}
@@ -50,31 +57,26 @@ component extends="coldbox.system.Interceptor" {
/**
* Fired on post rendering
*/
- function postRender( event, data, buffer, rc, prc ) eventPattern="^contentbox-ui\:(page|blog)"{
+ function postRender(
+ event,
+ data,
+ buffer,
+ rc,
+ prc
+ ) eventPattern="^contentbox-ui\:(page|blog)" {
// Rules to turn off the admin bar
if (
- // Disabled SiteBar Setting
- !prc.oCurrentSite.getAdminBar()
- ||
- // Disabled SiteBar per request
- structKeyExists( prc, "cbAdminBar" ) and !prc.cbAdminBar
- ||
- // Ajax Request
- event.isAjax()
- ||
- // Output Format not HTML
- ( structKeyExists( rc, "format" ) && rc.format != "html" )
- ||
- // Preview actions disabled
- event.getCurrentAction() == "preview"
- ||
- // Logged In
- !prc.oCurrentAuthor.isLoggedIn()
- ||
- // Permissions
- !prc.oCurrentAuthor.hasPermission(
- "CONTENTBOX_ADMIN,PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR"
- )
+ !prc.oCurrentSite.getAdminBar() || structKeyExists( prc, "cbAdminBar" ) && !prc.cbAdminBar ||
+ event// Ajax Request
+ .isAjax() ||
+ ( structKeyExists( rc, "format" ) && rc.format != "html" ) ||
+ event.getCurrentAction() == "preview" ||
+ // Logged In
+ !prc.oCurrentAuthor.isLoggedIn() ||
+ // Permissions
+ !prc.oCurrentAuthor.hasPermission(
+ "CONTENTBOX_ADMIN,PAGES_ADMIN,PAGES_EDITOR,ENTRIES_ADMIN,ENTRIES_EDITOR"
+ )
) {
return;
}
@@ -82,7 +84,7 @@ component extends="coldbox.system.Interceptor" {
// Verify if we are in cache mode.
if ( structKeyExists( prc, "contentCacheData" ) ) {
// skip out if not in text/html mode
- if ( prc.contentCacheData.contentType neq "text/html" ) {
+ if ( prc.contentCacheData.contentType NEQ "text/html" ) {
return;
}
// Inflate content for admin bar
@@ -109,22 +111,24 @@ component extends="coldbox.system.Interceptor" {
// Render the admin bar out
buffer.append(
- view(
- view = "adminbar/index",
- module = "contentbox-ui",
- args = {
- oContent : oContent ?: javacast( "null", "" ),
- linkEdit : linkEdit,
- linkLogout : "#prc.cbAdminEntryPoint#/security/doLogout",
- oCurrentAuthor : prc.oCurrentAuthor
- }
- )
- );
+ view(
+ view = "adminbar/index",
+ module = "contentbox-ui",
+ args = {
+ oContent : oContent ?: javacast( "null", "" ),
+ linkEdit : linkEdit,
+ linkLogout : "#prc.cbAdminEntryPoint#/security/doLogout",
+ oCurrentAuthor: prc.oCurrentAuthor
+ }
+ )
+ );
// Append adminbar styles to the html head
try {
- cfhtmlhead( text = view( view = "adminbar/adminbarCSS", module = "contentbox-ui" ) );
- } catch ( any e ) {
+ cfhtmlhead(
+ text = view( view = "adminbar/adminbarCSS", module = "contentbox-ui" )
+ );
+ } catch (any e) {
log.error( "Error sending adminbar styles via cfhtmlhead", e );
}
}
@@ -132,7 +136,13 @@ component extends="coldbox.system.Interceptor" {
/**
* Fired on contentbox requests
*/
- function postProcess( event, data, buffer, rc, prc ) eventPattern="^contentbox-ui"{
+ function postProcess(
+ event,
+ data,
+ buffer,
+ rc,
+ prc
+ ) eventPattern="^contentbox-ui" {
// announce event
announce( "cbui_postRequest" );
}
@@ -140,8 +150,8 @@ component extends="coldbox.system.Interceptor" {
/**
* private inject
*/
- function $cbinject(){
+ function $cbinject() {
variables.cb = this.cb;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/interceptors/GlobalHTML.cfc b/modules/contentbox/modules/contentbox-ui/interceptors/GlobalHTML.cfc
index a2a6d2af00..b30ed2cac5 100755
--- a/modules/contentbox/modules/contentbox-ui/interceptors/GlobalHTML.cfc
+++ b/modules/contentbox/modules/contentbox-ui/interceptors/GlobalHTML.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -7,83 +7,84 @@
*/
component extends="coldbox.system.Interceptor" {
- function configure(){
+ function configure() {
+
}
- function cbui_beforeHeadEnd( event, data, buffer ){
+ function cbui_beforeHeadEnd( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_beforeHeadEnd );
}
- function cbui_afterBodyStart( event, data, buffer ){
+ function cbui_afterBodyStart( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_afterBodyStart );
}
- function cbui_beforeBodyEnd( event, data, buffer ){
+ function cbui_beforeBodyEnd( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_beforeBodyEnd );
}
- function cbui_beforeContent( event, data, buffer ){
+ function cbui_beforeContent( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_beforeContent );
}
- function cbui_afterContent( event, data, buffer ){
+ function cbui_afterContent( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_afterContent );
}
- function cbui_beforeSideBar( event, data, buffer ){
+ function cbui_beforeSideBar( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_beforeSideBar );
}
- function cbui_afterSideBar( event, data, buffer ){
+ function cbui_afterSideBar( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_afterSideBar );
}
- function cbui_footer( event, data, buffer ){
+ function cbui_footer( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_afterFooter );
}
- function cbui_preEntryDisplay( event, data, buffer ){
+ function cbui_preEntryDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_preEntryDisplay );
}
- function cbui_postEntryDisplay( event, data, buffer ){
+ function cbui_postEntryDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_postEntryDisplay );
}
- function cbui_preIndexDisplay( event, data, buffer ){
+ function cbui_preIndexDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_preIndexDisplay );
}
- function cbui_postIndexDisplay( event, data, buffer ){
+ function cbui_postIndexDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_postIndexDisplay );
}
- function cbui_preArchivesDisplay( event, data, buffer ){
+ function cbui_preArchivesDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_preArchivesDisplay );
}
- function cbui_postArchivesDisplay( event, data, buffer ){
+ function cbui_postArchivesDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_postArchivesDisplay );
}
- function cbui_preCommentForm( event, data, buffer ){
+ function cbui_preCommentForm( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_preCommentForm );
}
- function cbui_postCommentForm( event, data, buffer ){
+ function cbui_postCommentForm( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_postCommentForm );
}
- function cbui_prePageDisplay( event, data, buffer ){
+ function cbui_prePageDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_prePageDisplay );
}
- function cbui_postPageDisplay( event, data, buffer ){
+ function cbui_postPageDisplay( event, data, buffer ) {
arguments.buffer.append( getSiteSettings( arguments.event ).cb_html_postPageDisplay );
}
- private function getSiteSettings( event ){
+ private function getSiteSettings( event ) {
return arguments.event.getPrivateValue( "cbSiteSettings" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc b/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc
index 1112c05232..50f5cf5a38 100755
--- a/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc
+++ b/modules/contentbox/modules/contentbox-ui/interceptors/SimpleSecurity.cfc
@@ -6,13 +6,19 @@
* Intercepts pages and entries that need password security
*/
component {
-
property name="securityService" inject="id:securityService@contentbox";
- void function configure(){
+ void function configure() {
+
}
- void function postEvent( event, data, rc, prc, buffer ) eventPattern="^contentbox\-ui"{
+ void function postEvent(
+ event,
+ data,
+ rc,
+ prc,
+ buffer
+ ) eventPattern="^contentbox\-ui" {
// page or entry content determination
var content = "";
if ( structKeyExists( prc, "page" ) ) {
@@ -29,26 +35,26 @@ component {
}
// Verify Incoming Headers to see if we are authorizing already or we can view the page already
- if ( !securityService.isContentViewable( content ) OR len( event.getHTTPHeader( "Authorization", "" ) ) ) {
+ if ( !securityService.isContentViewable( content ) || len( event.getHTTPHeader( "Authorization", "" ) ) ) {
// Verify incoming authorization for content
if ( securityService.authorizeContent( content, event.getHTTPBasicCredentials().password ) ) {
// we are secured woot woot!
return;
- };
+ }
// Not secure!
event.setHTTPHeader( statusCode = "401", value = "Unauthorized" );
event.setHTTPHeader(
- name = "WWW-Authenticate",
- value = "basic realm=""ContentBox content protection, enter the content password"""
- );
+ name = "WWW-Authenticate",
+ value = "basic realm=""ContentBox content protection, enter the content password"""
+ );
// secured content data hijack
event.renderData(
- data = "Unathorized Access Content Requires Authentication
",
- statusCode = "401"
- );
+ data = "Unathorized Access Content Requires Authentication
",
+ statusCode = "401"
+ );
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc b/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc
index c24cd61f4b..0e9310e2a6 100755
--- a/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc
+++ b/modules/contentbox/modules/contentbox-ui/models/PageBreadcrumbVisitor.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,14 +6,13 @@
* Visit page hierarchies and create breadcrumbs
*/
component singleton {
-
// DI
property name="CBHelper" inject="CBHelper@contentbox";
/**
* Constructor
*/
- PageBreadcrumbVisitor function init(){
+ PageBreadcrumbVisitor function init() {
return this;
}
@@ -23,7 +22,7 @@ component singleton {
* @page The page object
* @separator The separator to use, defaults to '>'
*/
- function visit( required page, string separator = ">" ){
+ function visit( required page, string separator = ">" ) {
var bc = "";
// recursive lookup
if ( arguments.page.hasParent() ) {
@@ -32,11 +31,13 @@ component singleton {
// check if page slug is home, to ignore it
if ( arguments.page.getSlug() NEQ CBHelper.getHomePage() ) {
- bc &= "#( len( bc ) ? arguments.separator : "" )# #arguments.page.getTitle()#
+ bc &= "#(
+ len( bc ) ? arguments.separator : ""
+ )# #arguments.page.getTitle()#
";
}
return bc;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/ModuleConfig.cfc b/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/ModuleConfig.cfc
index ac3d70aed5..7cc7f7093f 100644
--- a/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/ModuleConfig.cfc
+++ b/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/ModuleConfig.cfc
@@ -5,33 +5,32 @@
* ---
*/
component {
-
// Module Properties
- this.title = "ContentBox Sitemap Generator";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.description = "Generates XML, TXT, JSON and HTML Sitemaps for your website";
+ this.title = "ContentBox Sitemap Generator";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.description = "Generates XML, TXT, JSON and HTML Sitemaps for your website";
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
- this.viewParentLookup = true;
+ this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point: /sitemap.(json,html,txt)
- this.entryPoint = "sitemap";
+ this.entryPoint = "sitemap";
- function configure(){
+ function configure() {
// module settings - stored in modules.name.settings
settings = {};
// SES Routes
routes = [
// Module Entry Point
- { pattern : "/", handler : "main", action : "index" },
+ { pattern: "/", handler: "main", action: "index" },
// Convention Route
- { pattern : "/:handler/:action?" }
+ { pattern: "/:handler/:action?" }
];
// Custom Declared Points
- interceptorSettings = { customInterceptionPoints : "" };
+ interceptorSettings = { customInterceptionPoints: "" };
// Custom Declared Interceptors
interceptors = [];
@@ -40,13 +39,15 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
+
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc b/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc
index 207dffa310..ff27a48f7e 100644
--- a/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc
+++ b/modules/contentbox/modules/contentbox-ui/modules/contentbox-sitemap/handlers/main.cfc
@@ -6,20 +6,29 @@
* Manages the creations of dynamic sitemaps in ContentBox
*/
component {
-
// DI
property name="entryService" inject="id:entryService@contentbox";
+
property name="pageService" inject="id:pageService@contentbox";
+
property name="contentService" inject="id:contentService@contentbox";
+
property name="CBHelper" inject="id:CBHelper@contentbox";
+
property name="settingService" inject="id:settingService@contentbox";
/**
* Executes before all handler actions
*/
- any function preHandler( event, rc, prc, action, eventArguments ){
+ any function preHandler(
+ event,
+ rc,
+ prc,
+ action,
+ eventArguments
+ ) {
// params
- param name="rc.format" default="html";
+ param name ="rc.format" default="html";
// Prepare UI Request
CBHelper.prepareUIRequest( "pages" );
// Verify if sitemap is enabled, else, proxy into the page event
@@ -33,15 +42,16 @@ component {
/**
* Sitemap Wrapper
*/
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
// Caching Enabled? Then test if data is in cache.
var cacheEnabled = ( !event.valueExists( "cbCache" ) );
if ( cacheEnabled ) {
// Get appropriate cache provider from settings
- var cache = cacheBox.getCache( prc.cbSettings.cb_content_cacheName );
- var cacheKey = "cb-content-sitemap-#cgi.HTTP_HOST#" &
- hash( ".#rc.format#.#event.isSSL()#" & prc.cbox_incomingContextHash );
+ var cache = cacheBox.getCache( prc.cbSettings.cb_content_cacheName );
+ var cacheKey = "cb-content-sitemap-#cgi.HTTP_HOST##hash(
+ ".#rc.format#.#event.isSSL()##prc.cbox_incomingContextHash#"
+ )#";
// get content data from cache
var results = cache.get( cacheKey );
@@ -53,10 +63,10 @@ component {
}
// return cache content to be displayed
event.renderData(
- data = results.data,
- contentType = results.contentType,
- statusCode = prc.cbSettings.cb_content_cachingHeader ? 203 : 200
- );
+ data = results.data,
+ contentType = results.contentType,
+ statusCode = prc.cbSettings.cb_content_cachingHeader ? 203 : 200
+ );
return;
}
}
@@ -68,11 +78,11 @@ component {
if ( cacheEnabled ) {
// Cache data
cache.set(
- cachekey,
- results,
- ( prc.cbSettings.cb_content_cachingTimeout ),
- ( prc.cbSettings.cb_content_cachingTimeoutIdle )
- );
+ cachekey,
+ results,
+ ( prc.cbSettings.cb_content_cachingTimeout ),
+ ( prc.cbSettings.cb_content_cachingTimeoutIdle )
+ );
}
// Render it out
@@ -84,24 +94,24 @@ component {
*
* @return { data, contentType }
*/
- private struct function _index( event, rc, prc ){
+ private struct function _index( event, rc, prc ) {
// store UI module root
- prc.cbRoot = getContextRoot() & event.getModuleRoot( "contentbox" );
+ prc.cbRoot = getContextRoot() & event.getModuleRoot( "contentbox" );
// store module entry point
prc.cbEntryPoint = getModuleConfig( "contentbox-ui" ).entryPoint;
// Several Link Defs
- prc.linkHome = CBHelper.linkHome();
+ prc.linkHome = CBHelper.linkHome();
prc.siteBaseURL = CBHelper.siteBaseURL();
prc.disableBlog = !prc.oCurrentSite.getIsBlogEnabled();
// Get Content Data
prc.aPages = pageService.getAllFlatContent(
- sortOrder = "order asc",
- isPublished = true,
- showInSearch = true,
- siteID = prc.oCurrentSite.getsiteID()
- );
+ sortOrder = "order asc",
+ isPublished = true,
+ showInSearch = true,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
// Blog data if enabled
if ( prc.disableBlog == false ) {
@@ -111,41 +121,44 @@ component {
}
// Entry Content
prc.aEntries = entryService.getAllFlatContent(
- sortOrder = "createdDate asc",
- isPublished = true,
- showInSearch = true,
- siteID = prc.oCurrentSite.getsiteID()
- );
+ sortOrder = "createdDate asc",
+ isPublished = true,
+ showInSearch = true,
+ siteID = prc.oCurrentSite.getsiteID()
+ );
}
// Render it out in specific format
switch ( rc.format ) {
case "xml": {
return {
- data : view( view = "sitemap_xml", module = "contentbox-sitemap" ),
- contentType : "application/xml"
+ data : view( view = "sitemap_xml", module = "contentbox-sitemap" ),
+ contentType: "application/xml"
};
}
case "json": {
return {
- data : view( view = "sitemap_json", module = "contentbox-sitemap" ),
- contentType : "application/json"
+ data : view( view = "sitemap_json", module = "contentbox-sitemap" ),
+ contentType: "application/json"
};
}
case "txt": {
return {
- data : view( view = "sitemap_txt", module = "contentbox-sitemap" ),
- contentType : "text/plain"
+ data : view( view = "sitemap_txt", module = "contentbox-sitemap" ),
+ contentType: "text/plain"
};
}
default: {
event.setView( "sitemap_html" );
return {
- data : layout( module = event.getCurrentLayoutModule(), viewModule = event.getCurrentViewModule() ),
- contentType : "text/html"
+ data: layout(
+ module = event.getCurrentLayoutModule(),
+ viewModule = event.getCurrentViewModule()
+ ),
+ contentType: "text/html"
};
}
}
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules_user/Hello/ModuleConfig.cfc b/modules/contentbox/modules_user/Hello/ModuleConfig.cfc
index a8d6d4e8ef..60a071e45f 100644
--- a/modules/contentbox/modules_user/Hello/ModuleConfig.cfc
+++ b/modules/contentbox/modules_user/Hello/ModuleConfig.cfc
@@ -5,21 +5,20 @@
* ---
*/
component hint="My Module Configuration" {
-
// Module Properties
- this.title = "HelloContentBox";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.description = "This is an awesome hello world module";
+ this.title = "HelloContentBox";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.description = "This is an awesome hello world module";
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
- this.viewParentLookup = true;
+ this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point
- this.entryPoint = "HelloContentBox";
- this.dependencies = [];
+ this.entryPoint = "HelloContentBox";
+ this.dependencies = [];
- function configure(){
+ function configure() {
// parent settings
parentSettings = {};
@@ -27,7 +26,7 @@ component hint="My Module Configuration" {
settings = {};
// Layout Settings
- layoutSettings = { defaultLayout : "" };
+ layoutSettings = { defaultLayout: "" };
// datasources
datasources = {};
@@ -38,17 +37,18 @@ component hint="My Module Configuration" {
// SES Routes
routes = [
// Module Entry Point
- { pattern : "/", handler : "home", action : "index" },
+ { pattern: "/", handler: "home", action: "index" },
// Convention Route
- { pattern : "/:handler/:action?" }
+ { pattern: "/:handler/:action?" }
];
// Custom Declared Points
- interceptorSettings = { customInterceptionPoints : "" };
+ interceptorSettings = { customInterceptionPoints: "" };
// Custom Declared Interceptors
interceptors = [];
+
// Binder Mappings
// binder.map( "Alias" ).to( "#moduleMapping#.model.MyService" );
}
@@ -56,28 +56,29 @@ component hint="My Module Configuration" {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
// Let's add ourselves to the main menu in the Modules section
var menuService = controller.getWireBox().getInstance( "AdminMenuService@contentbox" );
// Add Menu Contribution
menuService.addSubMenu(
- topMenu = menuService.MODULES,
- name = "HelloContentBox",
- label = "Hello ContentBox",
- href = "#menuService.buildModuleLink( "HelloContentBox", "home" )#"
- );
+ topMenu = menuService.MODULES,
+ name = "HelloContentBox",
+ label = "Hello ContentBox",
+ href = "#menuService.buildModuleLink( "HelloContentBox", "home" )#"
+ );
}
/**
* Fired when the module is activated by ContentBox
*/
- function onActivate(){
+ function onActivate() {
+
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
// Let's remove ourselves to the main menu in the Modules section
var menuService = controller.getWireBox().getInstance( "AdminMenuService@contentbox" );
// Remove Menu Contribution
@@ -87,7 +88,8 @@ component hint="My Module Configuration" {
/**
* Fired when the module is deactivated by ContentBox
*/
- function onDeactivate(){
+ function onDeactivate() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules_user/Hello/handlers/Home.cfc b/modules/contentbox/modules_user/Hello/handlers/Home.cfc
index 145e5d535f..151f51de48 100644
--- a/modules/contentbox/modules_user/Hello/handlers/Home.cfc
+++ b/modules/contentbox/modules_user/Hello/handlers/Home.cfc
@@ -7,8 +7,8 @@
*/
component {
- function index( event, rc, prc ){
+ function index( event, rc, prc ) {
event.setView( "home/index" );
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules_user/Hello/modules/hello-child/ModuleConfig.cfc b/modules/contentbox/modules_user/Hello/modules/hello-child/ModuleConfig.cfc
index 175e6ba63c..c4c8d05003 100644
--- a/modules/contentbox/modules_user/Hello/modules/hello-child/ModuleConfig.cfc
+++ b/modules/contentbox/modules_user/Hello/modules/hello-child/ModuleConfig.cfc
@@ -6,20 +6,19 @@
* A child module for hello
*/
component {
-
// Module Properties
- this.title = "Hello Child";
- this.author = "Ortus Solutions, Corp";
- this.webURL = "https://www.ortussolutions.com";
- this.description = "This is an awesome hello world module";
+ this.title = "Hello Child";
+ this.author = "Ortus Solutions, Corp";
+ this.webURL = "https://www.ortussolutions.com";
+ this.description = "This is an awesome hello world module";
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
- this.viewParentLookup = true;
+ this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point
- this.entryPoint = "Hello-Child";
+ this.entryPoint = "Hello-Child";
- function configure(){
+ function configure() {
// parent settings
parentSettings = {};
@@ -27,7 +26,7 @@ component {
settings = {};
// Layout Settings
- layoutSettings = { defaultLayout : "" };
+ layoutSettings = { defaultLayout: "" };
// datasources
datasources = {};
@@ -38,13 +37,13 @@ component {
// SES Routes
routes = [
// Module Entry Point
- { pattern : "/", handler : "main", action : "index" },
+ { pattern: "/", handler: "main", action: "index" },
// Convention Route
- { pattern : "/:handler/:action?" }
+ { pattern: "/:handler/:action?" }
];
// Custom Declared Points
- interceptorSettings = { customInterceptionPoints : "" };
+ interceptorSettings = { customInterceptionPoints: "" };
// Custom Declared Interceptors
interceptors = [];
@@ -53,25 +52,29 @@ component {
/**
* Fired when the module is registered and activated.
*/
- function onLoad(){
+ function onLoad() {
+
}
/**
* Fired when the module is activated by ContentBox
*/
- function onActivate(){
+ function onActivate() {
+
}
/**
* Fired when the module is unregistered and unloaded
*/
- function onUnload(){
+ function onUnload() {
+
}
/**
* Fired when the module is deactivated by ContentBox
*/
- function onDeactivate(){
+ function onDeactivate() {
+
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules_user/Hello/modules/hello-child/handlers/Main.cfc b/modules/contentbox/modules_user/Hello/modules/hello-child/handlers/Main.cfc
index fd37c992d7..78eb432d70 100644
--- a/modules/contentbox/modules_user/Hello/modules/hello-child/handlers/Main.cfc
+++ b/modules/contentbox/modules_user/Hello/modules/hello-child/handlers/Main.cfc
@@ -6,8 +6,8 @@ component extends="coldbox.system.EventHandler" {
/**
* Index
*/
- any function index( event, rc, prc ){
+ any function index( event, rc, prc ) {
return "Hello Child";
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/modules_user/Hello/views/home/index.cfm b/modules/contentbox/modules_user/Hello/views/home/index.cfm
index 06b84e1e98..70dbe899e6 100644
--- a/modules/contentbox/modules_user/Hello/views/home/index.cfm
+++ b/modules/contentbox/modules_user/Hello/views/home/index.cfm
@@ -9,33 +9,26 @@
-
+
+
+v.#getModuleConfig( "contentbox" ).version#
+(Codename:
#getModuleSettings( "contentbox" ).codename# )
+
-
-
-
- v.#getModuleConfig('contentbox').version#
- (Codename:
#getModuleSettings( "contentbox" ).codename# )
-
+
+ Hi and welcome to the Hello module, ContentBox says Hello Buddy! , what you expected more?
+
-
- Hi and welcome to the Hello module, ContentBox says Hello Buddy! , what you expected more?
-
-
-
-
-
-
-
-
-
Need Help?
-
-
- #view(view="_tags/needhelp", module="contentbox-admin" )#
-
+
+
+
+
+
Need Help?
+
+
#view( view = "_tags/needhelp", module = "contentbox-admin" )#
diff --git a/modules/contentbox/modules_user/Hello/widgets/Hello.cfc b/modules/contentbox/modules_user/Hello/widgets/Hello.cfc
index f341feb6ab..7d67e8f840 100644
--- a/modules/contentbox/modules_user/Hello/widgets/Hello.cfc
+++ b/modules/contentbox/modules_user/Hello/widgets/Hello.cfc
@@ -3,7 +3,7 @@
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
- function init(){
+ function init() {
// Widget Properties
setName( "Hello" );
setVersion( "1.0.0" );
@@ -20,14 +20,16 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @titleLevel The H{level} to use, by default we use H2
*/
- any function renderIt( string titleLevel = "2" ){
+ any function renderIt( string titleLevel = "2" ) {
var rString = "";
saveContent variable="rString" {
- writeOutput( "
Hello my friend! " );
+ writeOutput(
+ "
Hello my friend! "
+ );
}
return rString;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/themes/default/package-lock.json b/modules/contentbox/themes/default/package-lock.json
index aa6a85b245..9546b85568 100644
--- a/modules/contentbox/themes/default/package-lock.json
+++ b/modules/contentbox/themes/default/package-lock.json
@@ -13,7 +13,7 @@
"bootswatch": "^3.4.1",
"coldbox-elixir": "^4.0.5",
"font-awesome-sass": "^4.7.0",
- "webpack": "^5.97.1",
+ "webpack": "^5.105.0",
"webpack-cli": "^4.10.0"
},
"devDependencies": {
@@ -1549,49 +1549,37 @@
}
},
"node_modules/@jridgewell/source-map": {
- "version": "0.3.5",
- "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz",
- "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==",
+ "version": "0.3.11",
+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",
+ "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
"dependencies": {
- "@jridgewell/gen-mapping": "^0.3.0",
- "@jridgewell/trace-mapping": "^0.3.9"
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.25"
}
},
"node_modules/@jridgewell/source-map/node_modules/@jridgewell/gen-mapping": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
- "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"dependencies": {
- "@jridgewell/set-array": "^1.0.1",
- "@jridgewell/sourcemap-codec": "^1.4.10",
- "@jridgewell/trace-mapping": "^0.3.9"
- },
- "engines": {
- "node": ">=6.0.0"
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
}
},
"node_modules/@jridgewell/sourcemap-codec": {
- "version": "1.4.15",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
- "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="
},
"node_modules/@jridgewell/trace-mapping": {
- "version": "0.3.22",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz",
- "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==",
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
"dependencies": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
- "node_modules/@trysound/sax": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
- "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==",
- "engines": {
- "node": ">=10.13.0"
- }
- },
"node_modules/@types/eslint": {
"version": "9.6.1",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
@@ -1611,9 +1599,9 @@
}
},
"node_modules/@types/estree": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
- "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="
},
"node_modules/@types/glob": {
"version": "7.2.0",
@@ -1625,9 +1613,9 @@
}
},
"node_modules/@types/json-schema": {
- "version": "7.0.11",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
- "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ=="
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
},
"node_modules/@types/minimatch": {
"version": "3.0.5",
@@ -1814,9 +1802,9 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
},
"node_modules/acorn": {
- "version": "8.14.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
- "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"bin": {
"acorn": "bin/acorn"
},
@@ -1824,6 +1812,17 @@
"node": ">=0.4.0"
}
},
+ "node_modules/acorn-import-phases": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
+ "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "peerDependencies": {
+ "acorn": "^8.14.0"
+ }
+ },
"node_modules/adjust-sourcemap-loader": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/adjust-sourcemap-loader/-/adjust-sourcemap-loader-4.0.0.tgz",
@@ -1837,9 +1836,9 @@
}
},
"node_modules/ajv": {
- "version": "6.12.6",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "version": "6.14.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
+ "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
@@ -1868,14 +1867,14 @@
}
},
"node_modules/ajv-formats/node_modules/ajv": {
- "version": "8.11.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
- "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"dependencies": {
- "fast-deep-equal": "^3.1.1",
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
+ "require-from-string": "^2.0.2"
},
"funding": {
"type": "github",
@@ -1994,6 +1993,14 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.9.19",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz",
+ "integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.js"
+ }
+ },
"node_modules/big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
@@ -2051,9 +2058,9 @@
}
},
"node_modules/browserslist": {
- "version": "4.24.4",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz",
- "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==",
+ "version": "4.28.1",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
+ "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==",
"funding": [
{
"type": "opencollective",
@@ -2069,10 +2076,11 @@
}
],
"dependencies": {
- "caniuse-lite": "^1.0.30001688",
- "electron-to-chromium": "^1.5.73",
- "node-releases": "^2.0.19",
- "update-browserslist-db": "^1.1.1"
+ "baseline-browser-mapping": "^2.9.0",
+ "caniuse-lite": "^1.0.30001759",
+ "electron-to-chromium": "^1.5.263",
+ "node-releases": "^2.0.27",
+ "update-browserslist-db": "^1.2.0"
},
"bin": {
"browserslist": "cli.js"
@@ -2110,9 +2118,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001692",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz",
- "integrity": "sha512-A95VKan0kdtrsnMubMKxEKUKImOPSuCpYgxSQBo036P5YYgVIcOYJEgt/txJWqObiRQeISNCfef9nvlQ0vbV7A==",
+ "version": "1.0.30001769",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz",
+ "integrity": "sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg==",
"funding": [
{
"type": "opencollective",
@@ -2390,14 +2398,14 @@
}
},
"node_modules/css-minimizer-webpack-plugin/node_modules/ajv": {
- "version": "8.11.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
- "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"dependencies": {
- "fast-deep-equal": "^3.1.1",
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
+ "require-from-string": "^2.0.2"
},
"funding": {
"type": "github",
@@ -2691,9 +2699,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.5.80",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.80.tgz",
- "integrity": "sha512-LTrKpW0AqIuHwmlVNV+cjFYTnXtM9K37OGhpe0ZI10ScPSxqVSryZHIY3WnCS5NSYbBODRTZyhRMS2h5FAEqAw=="
+ "version": "1.5.286",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz",
+ "integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A=="
},
"node_modules/emojis-list": {
"version": "3.0.0",
@@ -2704,12 +2712,12 @@
}
},
"node_modules/enhanced-resolve": {
- "version": "5.18.0",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.0.tgz",
- "integrity": "sha512-0/r0MySGYG8YqlayBZ6MuCfECmHFdJ5qyPh8s8wa5Hnm6SaFLSK1VYCbj+NKp090Nm1caZhD+QTnmxO7esYGyQ==",
+ "version": "5.19.0",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz",
+ "integrity": "sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==",
"dependencies": {
"graceful-fs": "^4.2.4",
- "tapable": "^2.2.0"
+ "tapable": "^2.3.0"
},
"engines": {
"node": ">=10.13.0"
@@ -2735,9 +2743,9 @@
}
},
"node_modules/es-module-lexer": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.1.tgz",
- "integrity": "sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q=="
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz",
+ "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw=="
},
"node_modules/escalade": {
"version": "3.2.0",
@@ -2823,6 +2831,21 @@
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
+ "node_modules/fast-uri": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",
+ "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ]
+ },
"node_modules/fastest-levenshtein": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz",
@@ -3082,9 +3105,9 @@
}
},
"node_modules/immutable": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz",
- "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
+ "version": "4.3.8",
+ "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.8.tgz",
+ "integrity": "sha512-d/Ld9aLbKpNwyl0KiM2CT1WYvkitQ1TSvmRtkcV8FKStiDoA7Slzgjmb/1G2yhKM1p0XeNOieaTbFZmU1d3Xuw==",
"dev": true
},
"node_modules/import-local": {
@@ -3346,11 +3369,15 @@
}
},
"node_modules/loader-runner": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
- "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==",
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz",
+ "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q==",
"engines": {
"node": ">=6.11.5"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/webpack"
}
},
"node_modules/loader-utils": {
@@ -3465,14 +3492,14 @@
}
},
"node_modules/mini-css-extract-plugin/node_modules/ajv": {
- "version": "8.11.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
- "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"dependencies": {
- "fast-deep-equal": "^3.1.1",
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
+ "require-from-string": "^2.0.2"
},
"funding": {
"type": "github",
@@ -3514,9 +3541,9 @@
}
},
"node_modules/minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
@@ -3552,9 +3579,9 @@
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="
},
"node_modules/node-releases": {
- "version": "2.0.19",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz",
- "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="
+ "version": "2.0.27",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",
+ "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA=="
},
"node_modules/normalize-path": {
"version": "3.0.0",
@@ -3722,9 +3749,9 @@
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
},
"node_modules/picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true,
"engines": {
"node": ">=8.6"
@@ -4584,6 +4611,14 @@
}
}
},
+ "node_modules/sax": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",
+ "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==",
+ "engines": {
+ "node": ">=11.0.0"
+ }
+ },
"node_modules/schema-utils": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz",
@@ -4715,16 +4750,16 @@
}
},
"node_modules/svgo": {
- "version": "2.8.0",
- "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz",
- "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==",
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.2.tgz",
+ "integrity": "sha512-TyzE4NVGLUFy+H/Uy4N6c3G0HEeprsVfge6Lmq+0FdQQ/zqoVYB62IsBZORsiL+o96s6ff/V6/3UQo/C0cgCAA==",
"dependencies": {
- "@trysound/sax": "0.2.0",
"commander": "^7.2.0",
"css-select": "^4.1.3",
"css-tree": "^1.1.3",
"csso": "^4.2.0",
"picocolors": "^1.0.0",
+ "sax": "^1.5.0",
"stable": "^0.1.8"
},
"bin": {
@@ -4735,20 +4770,24 @@
}
},
"node_modules/tapable": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
- "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz",
+ "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg==",
"engines": {
"node": ">=6"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/webpack"
}
},
"node_modules/terser": {
- "version": "5.27.0",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz",
- "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==",
+ "version": "5.46.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.46.0.tgz",
+ "integrity": "sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
- "acorn": "^8.8.2",
+ "acorn": "^8.15.0",
"commander": "^2.20.0",
"source-map-support": "~0.5.20"
},
@@ -4760,15 +4799,15 @@
}
},
"node_modules/terser-webpack-plugin": {
- "version": "5.3.10",
- "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz",
- "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==",
+ "version": "5.3.16",
+ "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz",
+ "integrity": "sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==",
"dependencies": {
- "@jridgewell/trace-mapping": "^0.3.20",
+ "@jridgewell/trace-mapping": "^0.3.25",
"jest-worker": "^27.4.5",
- "schema-utils": "^3.1.1",
- "serialize-javascript": "^6.0.1",
- "terser": "^5.26.0"
+ "schema-utils": "^4.3.0",
+ "serialize-javascript": "^6.0.2",
+ "terser": "^5.31.1"
},
"engines": {
"node": ">= 10.13.0"
@@ -4792,14 +4831,46 @@
}
}
},
+ "node_modules/terser-webpack-plugin/node_modules/ajv": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/terser-webpack-plugin/node_modules/ajv-keywords": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
+ "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3"
+ },
+ "peerDependencies": {
+ "ajv": "^8.8.2"
+ }
+ },
+ "node_modules/terser-webpack-plugin/node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
+ },
"node_modules/terser-webpack-plugin/node_modules/schema-utils": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
- "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz",
+ "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",
"dependencies": {
- "@types/json-schema": "^7.0.8",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
+ "@types/json-schema": "^7.0.9",
+ "ajv": "^8.9.0",
+ "ajv-formats": "^2.1.1",
+ "ajv-keywords": "^5.1.0"
},
"engines": {
"node": ">= 10.13.0"
@@ -4874,9 +4945,9 @@
}
},
"node_modules/update-browserslist-db": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz",
- "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
"funding": [
{
"type": "opencollective",
@@ -4959,9 +5030,9 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/watchpack": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz",
- "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==",
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.1.tgz",
+ "integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==",
"dependencies": {
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.1.2"
@@ -4971,33 +5042,35 @@
}
},
"node_modules/webpack": {
- "version": "5.97.1",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.97.1.tgz",
- "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==",
+ "version": "5.105.0",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.0.tgz",
+ "integrity": "sha512-gX/dMkRQc7QOMzgTe6KsYFM7DxeIONQSui1s0n/0xht36HvrgbxtM1xBlgx596NbpHuQU8P7QpKwrZYwUX48nw==",
"dependencies": {
"@types/eslint-scope": "^3.7.7",
- "@types/estree": "^1.0.6",
+ "@types/estree": "^1.0.8",
+ "@types/json-schema": "^7.0.15",
"@webassemblyjs/ast": "^1.14.1",
"@webassemblyjs/wasm-edit": "^1.14.1",
"@webassemblyjs/wasm-parser": "^1.14.1",
- "acorn": "^8.14.0",
- "browserslist": "^4.24.0",
+ "acorn": "^8.15.0",
+ "acorn-import-phases": "^1.0.3",
+ "browserslist": "^4.28.1",
"chrome-trace-event": "^1.0.2",
- "enhanced-resolve": "^5.17.1",
- "es-module-lexer": "^1.2.1",
+ "enhanced-resolve": "^5.19.0",
+ "es-module-lexer": "^2.0.0",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.11",
"json-parse-even-better-errors": "^2.3.1",
- "loader-runner": "^4.2.0",
+ "loader-runner": "^4.3.1",
"mime-types": "^2.1.27",
"neo-async": "^2.6.2",
- "schema-utils": "^3.2.0",
- "tapable": "^2.1.1",
- "terser-webpack-plugin": "^5.3.10",
- "watchpack": "^2.4.1",
- "webpack-sources": "^3.2.3"
+ "schema-utils": "^4.3.3",
+ "tapable": "^2.3.0",
+ "terser-webpack-plugin": "^5.3.16",
+ "watchpack": "^2.5.1",
+ "webpack-sources": "^3.3.3"
},
"bin": {
"webpack": "bin/webpack.js"
@@ -5182,21 +5255,53 @@
}
},
"node_modules/webpack-sources": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
- "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==",
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz",
+ "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg==",
"engines": {
"node": ">=10.13.0"
}
},
+ "node_modules/webpack/node_modules/ajv": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/webpack/node_modules/ajv-keywords": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
+ "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.3"
+ },
+ "peerDependencies": {
+ "ajv": "^8.8.2"
+ }
+ },
+ "node_modules/webpack/node_modules/json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
+ },
"node_modules/webpack/node_modules/schema-utils": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
- "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz",
+ "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",
"dependencies": {
- "@types/json-schema": "^7.0.8",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
+ "@types/json-schema": "^7.0.9",
+ "ajv": "^8.9.0",
+ "ajv-formats": "^2.1.1",
+ "ajv-keywords": "^5.1.0"
},
"engines": {
"node": ">= 10.13.0"
@@ -5233,9 +5338,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"node_modules/yaml": {
- "version": "1.10.2",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
- "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz",
+ "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA==",
"engines": {
"node": ">= 6"
}
@@ -6268,45 +6373,39 @@
"integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ=="
},
"@jridgewell/source-map": {
- "version": "0.3.5",
- "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz",
- "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==",
+ "version": "0.3.11",
+ "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.11.tgz",
+ "integrity": "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==",
"requires": {
- "@jridgewell/gen-mapping": "^0.3.0",
- "@jridgewell/trace-mapping": "^0.3.9"
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.25"
},
"dependencies": {
"@jridgewell/gen-mapping": {
- "version": "0.3.3",
- "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
- "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
"requires": {
- "@jridgewell/set-array": "^1.0.1",
- "@jridgewell/sourcemap-codec": "^1.4.10",
- "@jridgewell/trace-mapping": "^0.3.9"
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
}
}
}
},
"@jridgewell/sourcemap-codec": {
- "version": "1.4.15",
- "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
- "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="
},
"@jridgewell/trace-mapping": {
- "version": "0.3.22",
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz",
- "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==",
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
"requires": {
"@jridgewell/resolve-uri": "^3.1.0",
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
- "@trysound/sax": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz",
- "integrity": "sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA=="
- },
"@types/eslint": {
"version": "9.6.1",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-9.6.1.tgz",
@@ -6326,9 +6425,9 @@
}
},
"@types/estree": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
- "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw=="
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
+ "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="
},
"@types/glob": {
"version": "7.2.0",
@@ -6340,9 +6439,9 @@
}
},
"@types/json-schema": {
- "version": "7.0.11",
- "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
- "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ=="
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="
},
"@types/minimatch": {
"version": "3.0.5",
@@ -6516,9 +6615,15 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
},
"acorn": {
- "version": "8.14.0",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
- "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA=="
+ "version": "8.15.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
+ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="
+ },
+ "acorn-import-phases": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/acorn-import-phases/-/acorn-import-phases-1.0.4.tgz",
+ "integrity": "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==",
+ "requires": {}
},
"adjust-sourcemap-loader": {
"version": "4.0.0",
@@ -6530,9 +6635,9 @@
}
},
"ajv": {
- "version": "6.12.6",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
+ "version": "6.14.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
+ "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",
"requires": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
@@ -6549,14 +6654,14 @@
},
"dependencies": {
"ajv": {
- "version": "8.11.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
- "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"requires": {
- "fast-deep-equal": "^3.1.1",
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
+ "require-from-string": "^2.0.2"
}
},
"json-schema-traverse": {
@@ -6646,6 +6751,11 @@
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
+ "baseline-browser-mapping": {
+ "version": "2.9.19",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz",
+ "integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg=="
+ },
"big.js": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz",
@@ -6691,14 +6801,15 @@
}
},
"browserslist": {
- "version": "4.24.4",
- "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz",
- "integrity": "sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A==",
+ "version": "4.28.1",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
+ "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==",
"requires": {
- "caniuse-lite": "^1.0.30001688",
- "electron-to-chromium": "^1.5.73",
- "node-releases": "^2.0.19",
- "update-browserslist-db": "^1.1.1"
+ "baseline-browser-mapping": "^2.9.0",
+ "caniuse-lite": "^1.0.30001759",
+ "electron-to-chromium": "^1.5.263",
+ "node-releases": "^2.0.27",
+ "update-browserslist-db": "^1.2.0"
}
},
"buffer-from": {
@@ -6727,9 +6838,9 @@
}
},
"caniuse-lite": {
- "version": "1.0.30001692",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001692.tgz",
- "integrity": "sha512-A95VKan0kdtrsnMubMKxEKUKImOPSuCpYgxSQBo036P5YYgVIcOYJEgt/txJWqObiRQeISNCfef9nvlQ0vbV7A=="
+ "version": "1.0.30001769",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001769.tgz",
+ "integrity": "sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg=="
},
"chokidar": {
"version": "3.5.3",
@@ -6912,14 +7023,14 @@
},
"dependencies": {
"ajv": {
- "version": "8.11.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
- "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"requires": {
- "fast-deep-equal": "^3.1.1",
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
+ "require-from-string": "^2.0.2"
}
},
"ajv-keywords": {
@@ -7117,9 +7228,9 @@
"integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ=="
},
"electron-to-chromium": {
- "version": "1.5.80",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.80.tgz",
- "integrity": "sha512-LTrKpW0AqIuHwmlVNV+cjFYTnXtM9K37OGhpe0ZI10ScPSxqVSryZHIY3WnCS5NSYbBODRTZyhRMS2h5FAEqAw=="
+ "version": "1.5.286",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.286.tgz",
+ "integrity": "sha512-9tfDXhJ4RKFNerfjdCcZfufu49vg620741MNs26a9+bhLThdB+plgMeou98CAaHu/WATj2iHOOHTp1hWtABj2A=="
},
"emojis-list": {
"version": "3.0.0",
@@ -7127,12 +7238,12 @@
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
},
"enhanced-resolve": {
- "version": "5.18.0",
- "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.0.tgz",
- "integrity": "sha512-0/r0MySGYG8YqlayBZ6MuCfECmHFdJ5qyPh8s8wa5Hnm6SaFLSK1VYCbj+NKp090Nm1caZhD+QTnmxO7esYGyQ==",
+ "version": "5.19.0",
+ "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.19.0.tgz",
+ "integrity": "sha512-phv3E1Xl4tQOShqSte26C7Fl84EwUdZsyOuSSk9qtAGyyQs2s3jJzComh+Abf4g187lUUAvH+H26omrqia2aGg==",
"requires": {
"graceful-fs": "^4.2.4",
- "tapable": "^2.2.0"
+ "tapable": "^2.3.0"
}
},
"entities": {
@@ -7146,9 +7257,9 @@
"integrity": "sha512-/o+BXHmB7ocbHEAs6F2EnG0ogybVVUdkRunTT2glZU9XAaGmhqskrvKwqXuDfNjEO0LZKWdejEEpnq8aM0tOaw=="
},
"es-module-lexer": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.1.tgz",
- "integrity": "sha512-JUFAyicQV9mXc3YRxPnDlrfBKpqt6hUYzz9/boprUJHs4e4KVr3XwOF70doO6gwXUor6EWZJAyWAfKki84t20Q=="
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz",
+ "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw=="
},
"escalade": {
"version": "3.2.0",
@@ -7212,6 +7323,11 @@
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
"integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
},
+ "fast-uri": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz",
+ "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA=="
+ },
"fastest-levenshtein": {
"version": "1.0.12",
"resolved": "https://registry.npmjs.org/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz",
@@ -7404,9 +7520,9 @@
"requires": {}
},
"immutable": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.1.0.tgz",
- "integrity": "sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ==",
+ "version": "4.3.8",
+ "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.8.tgz",
+ "integrity": "sha512-d/Ld9aLbKpNwyl0KiM2CT1WYvkitQ1TSvmRtkcV8FKStiDoA7Slzgjmb/1G2yhKM1p0XeNOieaTbFZmU1d3Xuw==",
"dev": true
},
"import-local": {
@@ -7591,9 +7707,9 @@
"integrity": "sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg=="
},
"loader-runner": {
- "version": "4.3.0",
- "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
- "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg=="
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.1.tgz",
+ "integrity": "sha512-IWqP2SCPhyVFTBtRcgMHdzlf9ul25NwaFx4wCEH/KjAXuuHY4yNjvPXsBokp8jCB936PyWRaPKUNh8NvylLp2Q=="
},
"loader-utils": {
"version": "2.0.4",
@@ -7676,14 +7792,14 @@
},
"dependencies": {
"ajv": {
- "version": "8.11.0",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz",
- "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==",
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
"requires": {
- "fast-deep-equal": "^3.1.1",
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
"json-schema-traverse": "^1.0.0",
- "require-from-string": "^2.0.2",
- "uri-js": "^4.2.2"
+ "require-from-string": "^2.0.2"
}
},
"ajv-keywords": {
@@ -7713,9 +7829,9 @@
}
},
"minimatch": {
- "version": "3.1.2",
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -7736,9 +7852,9 @@
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="
},
"node-releases": {
- "version": "2.0.19",
- "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz",
- "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw=="
+ "version": "2.0.27",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz",
+ "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA=="
},
"normalize-path": {
"version": "3.0.0",
@@ -7855,9 +7971,9 @@
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
},
"picomatch": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
- "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
"dev": true
},
"pify": {
@@ -8404,6 +8520,11 @@
"neo-async": "^2.6.2"
}
},
+ "sax": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",
+ "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA=="
+ },
"schema-utils": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz",
@@ -8497,31 +8618,31 @@
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="
},
"svgo": {
- "version": "2.8.0",
- "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.0.tgz",
- "integrity": "sha512-+N/Q9kV1+F+UeWYoSiULYo4xYSDQlTgb+ayMobAXPwMnLvop7oxKMo9OzIrX5x3eS4L4f2UHhc9axXwY8DpChg==",
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/svgo/-/svgo-2.8.2.tgz",
+ "integrity": "sha512-TyzE4NVGLUFy+H/Uy4N6c3G0HEeprsVfge6Lmq+0FdQQ/zqoVYB62IsBZORsiL+o96s6ff/V6/3UQo/C0cgCAA==",
"requires": {
- "@trysound/sax": "0.2.0",
"commander": "^7.2.0",
"css-select": "^4.1.3",
"css-tree": "^1.1.3",
"csso": "^4.2.0",
"picocolors": "^1.0.0",
+ "sax": "^1.5.0",
"stable": "^0.1.8"
}
},
"tapable": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz",
- "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ=="
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz",
+ "integrity": "sha512-g9ljZiwki/LfxmQADO3dEY1CbpmXT5Hm2fJ+QaGKwSXUylMybePR7/67YW7jOrrvjEgL1Fmz5kzyAjWVWLlucg=="
},
"terser": {
- "version": "5.27.0",
- "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz",
- "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==",
+ "version": "5.46.0",
+ "resolved": "https://registry.npmjs.org/terser/-/terser-5.46.0.tgz",
+ "integrity": "sha512-jTwoImyr/QbOWFFso3YoU3ik0jBBDJ6JTOQiy/J2YxVJdZCc+5u7skhNwiOR3FQIygFqVUPHl7qbbxtjW2K3Qg==",
"requires": {
"@jridgewell/source-map": "^0.3.3",
- "acorn": "^8.8.2",
+ "acorn": "^8.15.0",
"commander": "^2.20.0",
"source-map-support": "~0.5.20"
},
@@ -8534,25 +8655,50 @@
}
},
"terser-webpack-plugin": {
- "version": "5.3.10",
- "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.10.tgz",
- "integrity": "sha512-BKFPWlPDndPs+NGGCr1U59t0XScL5317Y0UReNrHaw9/FwhPENlq6bfgs+4yPfyP51vqC1bQ4rp1EfXW5ZSH9w==",
+ "version": "5.3.16",
+ "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.16.tgz",
+ "integrity": "sha512-h9oBFCWrq78NyWWVcSwZarJkZ01c2AyGrzs1crmHZO3QUg9D61Wu4NPjBy69n7JqylFF5y+CsUZYmYEIZ3mR+Q==",
"requires": {
- "@jridgewell/trace-mapping": "^0.3.20",
+ "@jridgewell/trace-mapping": "^0.3.25",
"jest-worker": "^27.4.5",
- "schema-utils": "^3.1.1",
- "serialize-javascript": "^6.0.1",
- "terser": "^5.26.0"
+ "schema-utils": "^4.3.0",
+ "serialize-javascript": "^6.0.2",
+ "terser": "^5.31.1"
},
"dependencies": {
+ "ajv": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
+ "requires": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
+ "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
+ "requires": {
+ "fast-deep-equal": "^3.1.3"
+ }
+ },
+ "json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
+ },
"schema-utils": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
- "integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz",
+ "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",
"requires": {
- "@types/json-schema": "^7.0.8",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
+ "@types/json-schema": "^7.0.9",
+ "ajv": "^8.9.0",
+ "ajv-formats": "^2.1.1",
+ "ajv-keywords": "^5.1.0"
}
}
}
@@ -8599,9 +8745,9 @@
"integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ=="
},
"update-browserslist-db": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz",
- "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==",
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
"requires": {
"escalade": "^3.2.0",
"picocolors": "^1.1.1"
@@ -8643,52 +8789,79 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"watchpack": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.2.tgz",
- "integrity": "sha512-TnbFSbcOCcDgjZ4piURLCbJ3nJhznVh9kw6F6iokjiFPl8ONxe9A6nMDVXDiNbrSfLILs6vB07F7wLBrwPYzJw==",
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.1.tgz",
+ "integrity": "sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==",
"requires": {
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.1.2"
}
},
"webpack": {
- "version": "5.97.1",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.97.1.tgz",
- "integrity": "sha512-EksG6gFY3L1eFMROS/7Wzgrii5mBAFe4rIr3r2BTfo7bcc+DWwFZ4OJ/miOuHJO/A85HwyI4eQ0F6IKXesO7Fg==",
+ "version": "5.105.0",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.105.0.tgz",
+ "integrity": "sha512-gX/dMkRQc7QOMzgTe6KsYFM7DxeIONQSui1s0n/0xht36HvrgbxtM1xBlgx596NbpHuQU8P7QpKwrZYwUX48nw==",
"requires": {
"@types/eslint-scope": "^3.7.7",
- "@types/estree": "^1.0.6",
+ "@types/estree": "^1.0.8",
+ "@types/json-schema": "^7.0.15",
"@webassemblyjs/ast": "^1.14.1",
"@webassemblyjs/wasm-edit": "^1.14.1",
"@webassemblyjs/wasm-parser": "^1.14.1",
- "acorn": "^8.14.0",
- "browserslist": "^4.24.0",
+ "acorn": "^8.15.0",
+ "acorn-import-phases": "^1.0.3",
+ "browserslist": "^4.28.1",
"chrome-trace-event": "^1.0.2",
- "enhanced-resolve": "^5.17.1",
- "es-module-lexer": "^1.2.1",
+ "enhanced-resolve": "^5.19.0",
+ "es-module-lexer": "^2.0.0",
"eslint-scope": "5.1.1",
"events": "^3.2.0",
"glob-to-regexp": "^0.4.1",
"graceful-fs": "^4.2.11",
"json-parse-even-better-errors": "^2.3.1",
- "loader-runner": "^4.2.0",
+ "loader-runner": "^4.3.1",
"mime-types": "^2.1.27",
"neo-async": "^2.6.2",
- "schema-utils": "^3.2.0",
- "tapable": "^2.1.1",
- "terser-webpack-plugin": "^5.3.10",
- "watchpack": "^2.4.1",
- "webpack-sources": "^3.2.3"
+ "schema-utils": "^4.3.3",
+ "tapable": "^2.3.0",
+ "terser-webpack-plugin": "^5.3.16",
+ "watchpack": "^2.5.1",
+ "webpack-sources": "^3.3.3"
},
"dependencies": {
+ "ajv": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz",
+ "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==",
+ "requires": {
+ "fast-deep-equal": "^3.1.3",
+ "fast-uri": "^3.0.1",
+ "json-schema-traverse": "^1.0.0",
+ "require-from-string": "^2.0.2"
+ }
+ },
+ "ajv-keywords": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz",
+ "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==",
+ "requires": {
+ "fast-deep-equal": "^3.1.3"
+ }
+ },
+ "json-schema-traverse": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
+ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
+ },
"schema-utils": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz",
- "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==",
+ "version": "4.3.3",
+ "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.3.3.tgz",
+ "integrity": "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==",
"requires": {
- "@types/json-schema": "^7.0.8",
- "ajv": "^6.12.5",
- "ajv-keywords": "^3.5.2"
+ "@types/json-schema": "^7.0.9",
+ "ajv": "^8.9.0",
+ "ajv-formats": "^2.1.1",
+ "ajv-keywords": "^5.1.0"
}
}
}
@@ -8804,9 +8977,9 @@
}
},
"webpack-sources": {
- "version": "3.2.3",
- "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz",
- "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w=="
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.3.3.tgz",
+ "integrity": "sha512-yd1RBzSGanHkitROoPFd6qsrxt+oFhg/129YzheDGqeustzX0vTZJZsSsQjVQC4yzBQ56K55XU8gaNCtIzOnTg=="
},
"which": {
"version": "1.3.1",
@@ -8832,9 +9005,9 @@
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
},
"yaml": {
- "version": "1.10.2",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz",
- "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg=="
+ "version": "1.10.3",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.3.tgz",
+ "integrity": "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA=="
}
}
}
diff --git a/modules/contentbox/themes/default/package.json b/modules/contentbox/themes/default/package.json
index 52c5ca6b0b..5e57a1e10c 100644
--- a/modules/contentbox/themes/default/package.json
+++ b/modules/contentbox/themes/default/package.json
@@ -15,7 +15,7 @@
"bootswatch": "^3.4.1",
"coldbox-elixir": "^4.0.5",
"font-awesome-sass": "^4.7.0",
- "webpack": "^5.97.1",
+ "webpack": "^5.105.0",
"webpack-cli": "^4.10.0"
},
"devDependencies": {
diff --git a/modules/contentbox/widgets/Archives.cfc b/modules/contentbox/widgets/Archives.cfc
index 3e773e024f..32532145c1 100644
--- a/modules/contentbox/widgets/Archives.cfc
+++ b/modules/contentbox/widgets/Archives.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,11 +10,13 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
/**
* Constructor
*/
- Archives function init(){
+ Archives function init() {
// Widget Properties
setName( "Archives" );
setVersion( "1.0" );
- setDescription( "A cool widget that renders your blog archives summary information." );
+ setDescription(
+ "A cool widget that renders your blog archives summary information."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "calendar" );
@@ -35,9 +37,9 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
boolean showPostCount = true,
string title = "",
string titleLevel = "2"
- ){
+ ) {
var archives = variables.entryService.getArchiveReport();
- var rString = "";
+ var rString = "";
saveContent variable="rString" {
// title
@@ -58,7 +60,7 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
return rString;
}
- private function buildDropDown( archives, showPostCount ){
+ private function buildDropDown( archives, showPostCount ) {
var rString = "";
saveContent variable="rString" {
@@ -72,71 +74,55 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
"
);
// iterate and create
- for ( var x = 1; x lte arrayLen( arguments.archives ); x++ ) {
+ for ( var x = 1; x LTE arrayLen( arguments.archives ); x++ ) {
var thisDate = arguments.archives[ x ][ "year" ] & "-" & arguments.archives[ x ][ "month" ] & "-1";
writeOutput(
"
#dateFormat( thisDate, "mmmm yyyy" )#"
);
if ( arguments.showPostCount ) {
writeOutput( " (#arguments.archives[ x ][ "count" ]#)" );
}
- writeOutput(
- "
- "
- );
+ writeOutput( "
+ " );
}
// close ul
- writeOutput(
- "
+ writeOutput( "
-"
- );
+" );
}
return rString;
}
- private function buildList( archives, showPostCount ){
+ private function buildList( archives, showPostCount ) {
var rString = "";
saveContent variable="rString" {
- writeOutput(
- "
- "
- );
+ writeOutput( "
-"
- );
+" );
}
return rString;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/Categories.cfc b/modules/contentbox/widgets/Categories.cfc
index f55ae87f0f..c76f1742b3 100644
--- a/modules/contentbox/widgets/Categories.cfc
+++ b/modules/contentbox/widgets/Categories.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -7,10 +7,12 @@
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
- Categories function init(){
+ Categories function init() {
// Widget Properties
setName( "Categories" );
- setDescription( "A cool widget that renders your blog categories summary." );
+ setDescription(
+ "A cool widget that renders your blog categories summary."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "tags" );
@@ -33,98 +35,104 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
string title = "",
string titleLevel = "2",
boolean isPublic = true
- ){
+ ) {
var categories = variables.categoryService.search(
- isPublic: (
- isNull( arguments.isPublic ) || !len( arguments.isPublic ) ? javacast( "null", "" ) : arguments.isPublic
- ),
- siteId: getSite().getSiteId()
- ).categories;
+ isPublic = (
+ isNull( arguments.isPublic ) || !len( arguments.isPublic )
+ ? javacast( "null", "" )
+ : arguments.isPublic
+ ),
+ siteId = getSite().getSiteId()
+ ).categories;
var rString = "";
-
// cfformat-ignore-start
// generate recent comments
saveContent variable="rString" {
- // title
- if ( len( arguments.title ) ) {
- writeOutput(
- "#arguments.title# "
- );
- }
- // Build Type
- if ( arguments.dropdown ) {
- writeOutput( buildDropDown( categories, arguments.showPostCount ) );
- } else {
- writeOutput( buildList( categories, arguments.showPostCount ) );
- }
- }
+// title
+if ( len( arguments.title ) ) {
+writeOutput(
+"#arguments.title# "
+);
+}
+// Build Type
+if ( arguments.dropdown ) {
+writeOutput( buildDropDown( categories, arguments.showPostCount ) );
+} else {
+writeOutput( buildList( categories, arguments.showPostCount ) );
+}
+}
// cfformat-ignore-end
return rString;
}
- private function buildDropDown( categories, showPostCount ){
+ private function buildDropDown( categories, showPostCount ) {
var rString = "";
-
// generate recent comments
// cfformat-ignore-start
saveContent variable="rString" {
- writeOutput("
-
- Select Category
- ");
-
- // iterate and create
- for ( var x = 1; x lte arrayLen( arguments.categories ); x++ ) {
- if ( arguments.categories[ x ].getNumberOfEntries() gt 0 ) {
- writeOutput(
- "#arguments.categories[ x ].getCategory()#"
- );
-
- if ( arguments.showPostCount ) {
- writeOutput( " (#arguments.categories[ x ].getNumberOfEntries()#)" );
- }
-
- writeOutput( " " );
- }
- }
-
- // close
- writeOutput( " " );
- }
+writeOutput(
+"
+
+Select Category
+"
+);
+
+// iterate and create
+for ( var x = 1; x LTE arrayLen( arguments.categories ); x++ ) {
+if ( arguments.categories[ x ].getNumberOfEntries() GT 0 ) {
+writeOutput(
+"#arguments.categories[ x ].getCategory()#"
+);
+
+if ( arguments.showPostCount ) {
+writeOutput( " (#arguments.categories[ x ].getNumberOfEntries()#)" );
+}
+
+writeOutput( " " );
+}
+}
+
+// close
+writeOutput( " " );
+}
return rString;
+
+
// cfformat-ignore-end
}
- private function buildList( categories, showPostCount ){
+ private function buildList( categories, showPostCount ) {
var rString = "";
-
// generate recent comments
// cfformat-ignore-start
saveContent variable="rString" {
- writeOutput( "" );
- }
+writeOutput( "" );
+}
return rString;
+
+
// cfformat-ignore-end
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/CommentForm.cfc b/modules/contentbox/widgets/CommentForm.cfc
index 8266fb0a67..355646a2b0 100644
--- a/modules/contentbox/widgets/CommentForm.cfc
+++ b/modules/contentbox/widgets/CommentForm.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -6,17 +6,18 @@
* A cool basic commenting form for ContentBox
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
-
// DI
property name="messagebox" inject="messagebox@cbmessagebox";
/**
* Constructor
*/
- CommentForm function init(){
+ CommentForm function init() {
// Widget Properties
setName( "CommentForm" );
- setDescription( "A cool basic commenting form for ContentBox content objects." );
+ setDescription(
+ "A cool basic commenting form for ContentBox content objects."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "commenting" );
@@ -29,21 +30,22 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @content The content object to build the comment form or a content slug to load. If empty, we will take the content object from the prc scopes.
*/
- any function renderIt( any content ){
- var event = getRequestContext();
- var prc = event.getPrivateCollection();
- var cbSettings = event.getPrivateValue( "cbSettings" );
- var commentForm = "";
+ any function renderIt( any content ) {
+ var event = getRequestContext();
+ var prc = event.getPrivateCollection();
+ var cbSettings = event.getPrivateValue( "cbSettings" );
+ var commentForm = "";
var oCurrentAuthor = variables.securityService.getAuthorSession();
// Check if content simple value
- if ( isSimpleValue( arguments.content ) and len( arguments.content ) ) {
+ if ( isSimpleValue( arguments.content ) && len( arguments.content ) ) {
var originalSlug = arguments.content;
- arguments.content = variables.contentService.findBySlug(
- slug : arguments.content,
- siteID: variables.cb.site().getsiteID()
- );
+ arguments.content = variables.contentService.findBySlug( slug = arguments.content,
+ siteID = variables
+ .cb
+ .site()
+ .getsiteID() );
if ( !arguments.content.isLoaded() ) {
return "The content slug: #originalSlug# was not found, cannot generate comment form.";
@@ -68,10 +70,10 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
writeOutput(
"
#html.startForm(
- name = "commentForm",
- action = cb.linkCommentPost( arguments.content ),
- novalidate = "novalidate"
- )#
+ name = "commentForm",
+ action = cb.linkCommentPost( arguments.content ),
+ novalidate = "novalidate"
+ )#
#cb.event( "cbui_preCommentForm" )#
@@ -81,58 +83,58 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
#html.hiddenField( name = "contentType", value = arguments.content.getContentType() )#
#html.textField(
- name = "author",
- label = "Name: (required)",
- size = "50",
- class = "form-control",
- groupWrapper = "div class=form-group",
- required = "required",
- value = event.getValue( "author", oCurrentauthor.getFullName() )
- )#
+ name = "author",
+ label = "Name: (required)",
+ size = "50",
+ class = "form-control",
+ groupWrapper = "div class=form-group",
+ required = "required",
+ value = event.getValue( "author", oCurrentauthor.getFullName() )
+ )#
#html.inputField(
- name = "authorEmail",
- type = "email",
- label = "Email: (required)",
- size = "50",
- class = "form-control",
- groupWrapper = "div class=form-group",
- required = "required",
- value = event.getValue( "authorEmail", oCurrentAuthor.getEmail() )
- )#
+ name = "authorEmail",
+ type = "email",
+ label = "Email: (required)",
+ size = "50",
+ class = "form-control",
+ groupWrapper = "div class=form-group",
+ required = "required",
+ value = event.getValue( "authorEmail", oCurrentAuthor.getEmail() )
+ )#
#html.inputField(
- name = "authorURL",
- type = "url",
- label = "Website:",
- size = "50",
- class = "form-control",
- groupWrapper = "div class=form-group",
- value = event.getValue( "authorURL", "" )
- )#
+ name = "authorURL",
+ type = "url",
+ label = "Website:",
+ size = "50",
+ class = "form-control",
+ groupWrapper = "div class=form-group",
+ value = event.getValue( "authorURL", "" )
+ )#
#html.textArea(
- name = "content",
- label = "Comment: (Markdown allowed)",
- class = "form-control",
- required = "required",
- value = event.getValue( "content", "" )
- )#
+ name = "content",
+ label = "Comment: (Markdown allowed)",
+ class = "form-control",
+ required = "required",
+ value = event.getValue( "content", "" )
+ )#
#html.checkBox(
- name = "subscribe",
- label = "Notify me of follow-up comments by email.",
- groupwrapper = "div class=checkbox",
- checked = event.getValue( "subscribe", false )
- )#
+ name = "subscribe",
+ label = "Notify me of follow-up comments by email.",
+ groupwrapper = "div class=checkbox",
+ checked = event.getValue( "subscribe", false )
+ )#
#cb.event( "cbui_postCommentForm" )#
#html.submitButton(
- name = "commentSubmitButton",
- value = "Submit",
- class = "btn btn-primary"
- )#
+ name = "commentSubmitButton",
+ value = "Submit",
+ class = "btn btn-primary"
+ )#
#html.endForm()#
"
);
@@ -141,4 +143,4 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
return commentForm;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/ContentStore.cfc b/modules/contentbox/widgets/ContentStore.cfc
index 68efda59aa..a2aabe0a20 100644
--- a/modules/contentbox/widgets/ContentStore.cfc
+++ b/modules/contentbox/widgets/ContentStore.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,11 +10,13 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
/**
* Constructor
*/
- ContentStore function init(){
+ ContentStore function init() {
// Widget Properties
setName( "ContentStore" );
setVersion( "1.0" );
- setDescription( "A widget that renders ContentStore content anywhere you like." );
+ setDescription(
+ "A widget that renders ContentStore content anywhere you like."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "hdd-o" );
@@ -34,12 +36,15 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @throws InvalidContentStoreException
*/
- any function renderIt( required string slug, string defaultValue ){
+ any function renderIt( required string slug, string defaultValue ) {
var content = variables.contentStoreService.findBySlug(
- slug = arguments.slug,
- showUnpublished = true,
- siteID = variables.cb.site().getsiteID()
- );
+ slug = arguments.slug,
+ showUnpublished = true,
+ siteID = variables
+ .cb
+ .site()
+ .getsiteID()
+ );
// Return if loaded and published
if ( content.isLoaded() && content.isContentPublished() && !content.isExpired() ) {
@@ -57,7 +62,10 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
}
// else throw
- throw( message = "The content slug '#arguments.slug#' does not exist", type = "InvalidContentStoreException" );
+ throw(
+ message = "The content slug '#arguments.slug#' does not exist",
+ type = "InvalidContentStoreException"
+ );
}
/**
@@ -65,8 +73,8 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @cbignore
*/
- array function getSlugList(){
+ array function getSlugList() {
return variables.contentStoreService.getAllFlatSlugs();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/EntryInclude.cfc b/modules/contentbox/widgets/EntryInclude.cfc
index de94c853c6..f538cb7983 100644
--- a/modules/contentbox/widgets/EntryInclude.cfc
+++ b/modules/contentbox/widgets/EntryInclude.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -7,11 +7,13 @@
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
- EntryInclude function init(){
+ EntryInclude function init() {
// Widget Properties
setName( "EntryInclude" );
setVersion( "1.0" );
- setDescription( "A widget that can render out ContentBox blog entries inline" );
+ setDescription(
+ "A widget that can render out ContentBox blog entries inline"
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "arrow-circle-left" );
@@ -26,12 +28,12 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
* @slug.optionsUDF getSlugList
* @defaultValue.hint The string to show if the page does not exist
*/
- any function renderIt( required string slug, string defaultValue ){
+ any function renderIt( required string slug, string defaultValue ) {
var entry = entryService.findBySlug(
- slug = arguments.slug,
- includeUnpublished = false,
- siteId = getSite().getSiteId()
- );
+ slug = arguments.slug,
+ includeUnpublished = false,
+ siteId = getSite().getSiteId()
+ );
if ( !isNull( entry ) ) {
return entry.renderContent();
@@ -53,8 +55,8 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @cbignore
*/
- array function getSlugList(){
+ array function getSlugList() {
return entryService.getAllFlatSlugs();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/Menu.cfc b/modules/contentbox/widgets/Menu.cfc
index 2b8d819d4d..dcbf4acbaf 100644
--- a/modules/contentbox/widgets/Menu.cfc
+++ b/modules/contentbox/widgets/Menu.cfc
@@ -7,11 +7,13 @@
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
- Menu function init(){
+ Menu function init() {
// Widget Properties
setName( "Menu" );
setVersion( "1.0" );
- setDescription( "A widget that can render out a ContentBox menu anywhere you like." );
+ setDescription(
+ "A widget that can render out a ContentBox menu anywhere you like."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "bars" );
@@ -26,7 +28,10 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
* @slug.optionsUDF getSlugList
* @defaultValue.hint The string to show if the menu does not exist
*/
- any function renderIt( string slug = "EmptyMenuList", string defaultValue ){
+ any function renderIt(
+ string slug = "EmptyMenuList",
+ string defaultValue
+ ) {
var menu = menuService.findBySlug( slug = arguments.slug, siteId = getSite().getSiteId() );
if ( !isNull( menu ) ) {
@@ -34,7 +39,7 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
savecontent variable="menuContent" {
writeOutput( "#cb.menu( slug = arguments.slug, type = "html" )#" );
}
- } catch ( any e ) {
+ } catch (any e) {
return arguments.defaultValue;
}
return menuContent;
@@ -49,7 +54,10 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
return arguments.defaultValue;
}
- throw( message = "The menu slug '#arguments.slug#' does not exist", type = "MenuWidget.InvalidMenuSlug" );
+ throw(
+ message = "The menu slug '#arguments.slug#' does not exist",
+ type = "MenuWidget.InvalidMenuSlug"
+ );
}
/**
@@ -57,8 +65,8 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @cbignore
*/
- array function getSlugList(){
+ array function getSlugList() {
return menuService.getAllSlugs();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/Meta.cfc b/modules/contentbox/widgets/Meta.cfc
index 3a81d634fe..68394eff48 100644
--- a/modules/contentbox/widgets/Meta.cfc
+++ b/modules/contentbox/widgets/Meta.cfc
@@ -1,13 +1,15 @@
-/**
+/**
* A cool basic widget that shows some ContentBox meta links
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
- Meta function init(){
+ Meta function init() {
// Widget Properties
setName( "Meta" );
setVersion( "1.0" );
- setDescription( "A cool basic widget that shows some ContentBox meta links anywhere you like." );
+ setDescription(
+ "A cool basic widget that shows some ContentBox meta links anywhere you like."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "info" );
@@ -25,31 +27,31 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
boolean dropdown = false,
string title = "ContentBox",
string titleLevel = "2"
- ){
+ ) {
var rString = "";
// build links accordingly to authentication
if ( securityService.getAuthorSession().isLoggedIn() ) {
var links = [
- { link : cb.linkAdmin(), title : "Site Admin" },
- { link : cb.linkAdminLogout(), title : "Logout" }
+ { link: cb.linkAdmin(), title: "Site Admin" },
+ { link: cb.linkAdminLogout(), title: "Logout" }
];
} else {
- var links = [ { link : cb.linkAdminLogin(), title : "Login" } ];
+ var links = [ { link: cb.linkAdminLogin(), title: "Login" }];
}
- arrayAppend( links, { link : cb.linkRSS(), title : "Entries RSS" } );
+ arrayAppend( links, { link: cb.linkRSS(), title: "Entries RSS" } );
arrayAppend(
links,
{
- link : cb.linkRSS( comments = true ),
- title : "Comments RSS"
+ link : cb.linkRSS( comments = true ),
+ title: "Comments RSS"
}
);
arrayAppend(
links,
{
- link : "https://www.ortussolutions.com/products/contentbox",
- title : "ContentBox"
+ link : "https://www.ortussolutions.com/products/contentbox",
+ title: "ContentBox"
}
);
@@ -72,7 +74,7 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
return rString;
}
- private function buildDropDown( links ){
+ private function buildDropDown( links ) {
var rString = "";
saveContent variable="rString" {
@@ -82,40 +84,40 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
"
);
// iterate and create
- for ( var x = 1; x lte arrayLen( arguments.links ); x++ ) {
+ for ( var x = 1; x LTE arrayLen( arguments.links ); x++ ) {
writeOutput(
"
#links[ x ].title#
"
);
}
// close ul
- writeOutput(
- "
+ writeOutput( "
-"
- );
+" );
}
return rString;
}
- private function buildList( links ){
- var rString = "";
+ private function buildList( links ) {
+ var rString = "";
// cfformat-ignore-start
- saveContent variable="rString"{
- writeOutput( '
" );
- }
+ saveContent variable="rString" {
+writeOutput( "
" );
+// iterate and create
+for ( var x = 1; x LTE arrayLen( arguments.links ); x++ ) {
+writeOutput(
+"
+#links[ x ].title#
+
+"
+);
+}
+// close ul
+writeOutput( " " );
+}
// cfformat-ignore-end
-return rString;
+ return rString;
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/PageInclude.cfc b/modules/contentbox/widgets/PageInclude.cfc
index afbfb21f78..db3e02fdc7 100644
--- a/modules/contentbox/widgets/PageInclude.cfc
+++ b/modules/contentbox/widgets/PageInclude.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -7,11 +7,13 @@
*/
component extends="contentbox.models.ui.BaseWidget" singleton {
- PageInclude function init(){
+ PageInclude function init() {
// Widget Properties
setName( "PageInclude" );
setVersion( "1.0" );
- setDescription( "A widget that can render out a ContentBox page anywhere you like." );
+ setDescription(
+ "A widget that can render out a ContentBox page anywhere you like."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setIcon( "arrow-circle-left" );
@@ -26,12 +28,12 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
* @slug.optionsUDF getSlugList
* @defaultValue.hint The string to show if the page does not exist
*/
- any function renderIt( required string slug, string defaultValue ){
+ any function renderIt( required string slug, string defaultValue ) {
var page = pageService.findBySlug(
- slug = arguments.slug,
- includeUnpublished = false,
- siteId = getSite().getSiteId()
- );
+ slug = arguments.slug,
+ includeUnpublished = false,
+ siteId = getSite().getSiteId()
+ );
if ( !isNull( page ) ) {
return page.renderContent();
@@ -53,8 +55,8 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
*
* @cbignore
*/
- array function getSlugList(){
+ array function getSlugList() {
return pageService.getAllFlatSlugs();
}
-}
+}
\ No newline at end of file
diff --git a/modules/contentbox/widgets/RSS.cfc b/modules/contentbox/widgets/RSS.cfc
index 880b333282..542eef439a 100644
--- a/modules/contentbox/widgets/RSS.cfc
+++ b/modules/contentbox/widgets/RSS.cfc
@@ -1,4 +1,4 @@
-/**
+/**
* ContentBox - A Modular Content Platform
* Copyright since 2012 by Ortus Solutions, Corp
* www.ortussolutions.com/products/contentbox
@@ -10,11 +10,13 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
/**
* Constructor
*/
- RSS function init(){
+ RSS function init() {
// Widget Properties
setName( "RSS" );
setVersion( "1.0" );
- setDescription( "A widget that reads an RSS feed and displays the items as you see fit." );
+ setDescription(
+ "A widget that reads an RSS feed and displays the items as you see fit."
+ );
setAuthor( "Ortus Solutions" );
setAuthorURL( "https://www.ortussolutions.com" );
setCategory( "Content" );
@@ -39,18 +41,18 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
string linkTarget = "_blank",
string title = "",
string titleLevel = "2"
- ){
+ ) {
// Detect Feed URL
if ( !len( arguments.feedURL ) ) {
return "Please enter a valid RSS Feed URL";
}
var rString = "";
- var feed = getInstance( "FeedReader@cbfeeds" ).readFeed(
- feedURL = arguments.feedURL,
- maxItems = arguments.maxItems,
- itemsType = "query"
- );
+ var feed = getInstance( "FeedReader@cbfeeds" ).readFeed(
+ feedURL = arguments.feedURL,
+ maxItems = arguments.maxItems,
+ itemsType = "query"
+ );
// generate recent comments
saveContent variable="rString" {
@@ -85,34 +87,35 @@ component extends="contentbox.models.ui.BaseWidget" singleton {
required entries,
required boolean showBody,
required linkTarget
- ){
+ ) {
var rString = "";
-
// cfformat-ignore-start
// generate Items
- saveContent variable="rString"{
- writeOutput( '