### Node.js Installation and API Documentation Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md Instructions for installing highlight.js with Node.js using npm and a link to the API documentation for developers. ```bash npm install highlight.js ``` ```text API docs are available on our wiki. ``` -------------------------------- ### Node.js Integration with Highlight.js Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/README.md Demonstrates how to use Highlight.js within a Node.js environment. It covers installation via npm and provides examples for highlighting code with known languages or using automatic language detection. ```bash npm install highlight.js ``` ```javascript var hljs = require('highlight.js'); // If you know the language hls.highlight(lang, code).value; // Automatic language detection hls.highlightAuto(code).value; ``` -------------------------------- ### Custom Initialization with Highlight.js Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/README.md Provides examples of manually initializing Highlight.js for code blocks that don't use the default `
` markup or for dynamically added content. It includes a jQuery example and how to handle `
` tags.
```javascript
$(document).ready(function() {
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
});
```
```javascript
hljs.configure({useBR: true});
$('div.code').each(function(i, e) {hljs.highlightBlock(e)});
```
--------------------------------
### AMD Module Usage for Highlight.js
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/README.md
Shows how to build and use Highlight.js as an AMD module. This involves building from source and then requiring the module to highlight code, similar to the Node.js examples.
```bash
python3 tools/build.py -tamd lang1 lang2 ..
```
```javascript
require(["highlight.js/build/highlight.pack"], function(hljs){
// If you know the language
hljs.highlight(lang, code).value;
// Automatic language detection
hljs.highlightAuto(code).value;
});
```
--------------------------------
### Preside CMS AdminHandler Base Configuration
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Defines the base structure of an AdminHandler in Preside CMS, including property injections for DAO and MessageBox, and the preHandler method for initial setup and permission checks.
```cfml
component extends="preside.system.base.AdminHandler" {
property name="dao" inject="presidecms:object:${objectId}";
property name="messageBox" inject="messagebox@cbmessagebox";
// BEGIN BATCHEDIT
property name="dataManagerService" inject="dataManagerService";
// END BATCHEDIT
function prehandler( event, rc, prc ) {
super.preHandler( argumentCollection = arguments );
_checkPermissions( event=event, key="read" );
event.addAdminBreadCrumb(
title = translateResource( "${translationFile}:breadcrumb" )
, link = event.buildAdminLink( linkTo="${handlerRoot}" )
);
prc.pageIcon = "${pageIcon}";
}
```
--------------------------------
### Highlight.js Developer Mode Example
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Demonstrates how developers can include language submodes directly within the 'contains' array for more streamlined parsing. This approach is useful for auxiliary modes that are only needed in a specific context and may not require separate markup.
```javascript
contains: [
'string',
'number',
{begin: '\n', end: hljs.IMMEDIATE_RE}
]
```
--------------------------------
### Preside CMS Get History for Ajax Datatables
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Retrieves record history for Ajax DataTables, fetching record data and then running an event to get the detailed history. Includes handling for not found records.
```cfml
public void function getHistoryForAjaxDatatables( event, rc, prc ) {
var id = rc.id ?: "";
prc.record = dao.selectData( id=id, selectFields=[ "${labelfield} as label" ] );
if ( !prc.record.recordCount ) {
event.notFound();
}
runEvent(
event = "admin.DataManager._getRecordHistoryForAjaxDataTables"
, prePostExempt = true
, private = true
, eventArguments = {
object = "${objectId}"
, recordId = id
, actionsView = "admin/${handlerFolder}/_historyActions"
}
);
}
```
--------------------------------
### Apache Configuration and Magula Style
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Introduces highlighting for Apache configuration files and a new visual style named 'Magula'.
```Apache
[Ruslan Keba][rukeba] created highlighting for Apache config file.
```
```General
Also his
original visual style for it is now available for all highlight.js languages
under the name "Magula".
```
--------------------------------
### Nginx Configuration Language Definition
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds support for Nginx configuration file highlighting.
```Nginx
a long-time highlight.js contributor [Peter Leonov][pl] made a definition for
Nginx config
```
--------------------------------
### Nginx Syntax Remake
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Details the significant improvement and simplification of Nginx syntax highlighting through a more generic approach.
```nginx
Nginx syntax has become a million times smaller and more universal thanks to remaking it in a more generic manner
```
--------------------------------
### Basic HTML Usage for Highlight.js
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/README.md
This snippet shows how to include Highlight.js and its stylesheet in an HTML page to automatically highlight code blocks on page load. It assumes the use of `` tags for code markup.
```html
```
--------------------------------
### 1C Keywords and Apache Fixes
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds new keywords for 1C and includes minor fixes for Apache highlighting.
```1C
new keywords and built-ins for 1C by Sergey Baranov
```
```Apache
a couple of small fixes to Apache highlighting
```
--------------------------------
### Clojure Language and Rainbow Style
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Introduces support for Clojure syntax highlighting and the accompanying 'Rainbow' style.
```clojure
definition for Clojure
```
--------------------------------
### Render Version Navigator Viewlet in ColdFusion
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/edit.cfm.txt
This snippet demonstrates rendering a version navigation viewlet using `renderViewlet`. It passes arguments such as the object ID, record ID, version information, draft status, and URLs for navigating between versions and viewing the version history. Dependencies include the `admin.datamanager.versionNavigator` viewlet and functions for building admin links.
```ColdFusion
#renderViewlet( event='admin.datamanager.versionNavigator', args={
object = "${objectId}"
, id = recordId
, version = version
, isDraft = IsTrue( prc.record._version_is_draft ?: "" )
, baseUrl = event.buildAdminLink( linkto="${handlerRoot}.edit", queryString="id=#recordId#&version=" )
, allVersionsUrl = event.buildAdminLink( linkto="${handlerRoot}.versionHistory", queryString="id=#recordId#" )
} )#
```
--------------------------------
### Ruby Language Definition and YARD Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Reworks the Ruby definition to include highlighting for YARD inline documentation.
```Ruby
[Loren Segal][ls] reworked the Ruby definition and added highlighting for
[YARD][] inline documentation
```
--------------------------------
### Untitled
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
No description
```PHP
```
--------------------------------
### C# Language Definition and Visual Studio Style
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds C# language definition and a Visual Studio-like highlighting style.
```C#
language definition for C# (yes! it was a long-missed thing!)
```
```CSS
Visual Studio-like highlighting style
```
--------------------------------
### Multi-Language Packing Mechanism
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Introduces a mechanism to pack multiple languages into a single compressed file for faster loading.
```General
The main change in the new major version of highlight.js is a mechanism for
packing several languages along with the library itself into a single compressed
file. Now sites using several languages will load considerably faster because
the library won't dynamically include additional files while loading.
```
--------------------------------
### D Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Announces the addition of D as a newly supported language for syntax highlighting.
```d
D
```
--------------------------------
### Lisp Highlighting (Experimental)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Experimental Lisp highlighting that identifies keywords by looking for the first word within parentheses, aiming to highlight based on context rather than predefined sets.
```Lisp
;; Example of Lisp code highlighting
(defun hello-world ()
(print "Hello, World!"))
```
--------------------------------
### Brainfuck Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Announces the addition of Brainfuck as a newly supported language for syntax highlighting.
```brainfuck
Brainfuck
```
--------------------------------
### RenderMan Language Keywords
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Updates RenderMan language support with new keywords.
```RenderMan
[Shuen-Huei Guan][drake] (aka Drake) sent new keywords for RenderMan
languages.
```
--------------------------------
### Highlight.js: Initial Release (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 1.0 marked the first release of the Javascript syntax highlighter, providing basic syntax highlighting capabilities for Javascript code.
```javascript
console.log('Hello, World!');
```
--------------------------------
### VHDL Rework
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Describes the significant rework of VHDL syntax highlighting to improve richness and correctness.
```vhdl
VHDL were significantly reworked to be more rich and correct
```
--------------------------------
### SQL Language Rigidity Improvement
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Enhances SQL parsing rigidity to prevent overly greedy language detection, particularly with SmallTalk in tests.
```SQL
SQL parsing is even more rigid now and doesn't step over SmallTalk in tests
the definition of SQL has become more solid and now it shouldn't be overly
greedy when it comes to language detection
```
--------------------------------
### GLSL Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Announces the addition of GLSL (OpenGL Shading Language) as a newly supported language for syntax highlighting.
```glsl
GLSL
```
--------------------------------
### AVR Assembler Language Definition
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds highlighting support for AVR Assembler.
```AVR Assembler
[Vladimir Ermakov][vooon] created highlighting for AVR Assembler
```
--------------------------------
### AMD Format Build
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Highlights the library's capability to be built in the popular AMD (Asynchronous Module Definition) format.
```text
the library can now be built in the popular [AMD format][amd].
```
--------------------------------
### R Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Announces the addition of R as a newly supported language for syntax highlighting.
```r
R
```
--------------------------------
### CoffeeScript @-properties and Classes
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Describes enhancements to CoffeeScript syntax highlighting, including support for @-properties and classes.
```coffeescript
@-properties and classes in CoffeeScript
```
--------------------------------
### DOS Batch File Scripting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for highlighting DOS batch files (.bat).
```Batchfile
@echo off
REM Example DOS batch file
echo Hello Batch!
```
--------------------------------
### CSS and Ruby Enhancements
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Implements a GitHub-like style, support for CSS @-rules, and Ruby symbols.
```CSS
Vasily Polovnyov][vp] has sent a GitHub-like style and has implemented
support for CSS @-rules
```
```Ruby
and Ruby symbols.
```
--------------------------------
### SmallTalk Language Description
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Description and support for the SmallTalk programming language.
```Smalltalk
"Example Smalltalk code"
Transcript show: 'Hello Smalltalk!';
```
--------------------------------
### Highlighting HTTP Headers and Request Body
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Demonstrates the capability of highlight.js to highlight HTTP headers and arbitrary content within a request body, specifically mentioning support for XML and JSON.
```text
highlighting *HTTP* headers and an arbitrary language in the request body. The most useful languages here are *XML* and *JSON* both of which highlight.js does support.
```
--------------------------------
### Bash Scripting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for highlighting Bash shell scripts.
```Bash
#!/bin/bash
# Example Bash script
echo "Hello Bash!"
```
--------------------------------
### Haskell Rework
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Describes the significant rework of Haskell syntax highlighting to improve richness and correctness.
```haskell
Haskell ... were significantly reworked to be more rich and correct
```
--------------------------------
### Configuring Tab Replacement in Highlight.js
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/README.md
Illustrates how to configure Highlight.js to replace tab characters with spaces or styled spans for consistent indentation. This is done before initializing highlighting.
```javascript
hljs.configure({tabReplace: ' '}); // 4 spaces
// ... or
hljs.configure({tabReplace: '\t'});
hljs.initHighlightingOnLoad();
```
--------------------------------
### Ini File Formatting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for highlighting Ini files, used for configuration settings.
```Ini
[Settings]
Key=Value
AnotherKey=AnotherValue
```
--------------------------------
### 1C Language Description
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Description and support for the 1C programming language.
```1C
// Example 1C code
Сообщить("Hello 1C!");
```
--------------------------------
### Axapta Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for the Axapta programming language.
```Axapta
static void HelloWorld(Args _args)
{
info("Hello Axapta!");
}
```
--------------------------------
### Python Interpreter Prompt Highlighting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Highlights the interpreter prompt in Python, specifically the '>>>' and '...' indicators.
```python
interpreter prompt in Python (`>>>` and `...`)
```
--------------------------------
### AppleScript Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Announces the addition of AppleScript as a newly supported language for syntax highlighting.
```applescript
AppleScript
```
--------------------------------
### Initialize Record and Version Variables in ColdFusion
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/edit.cfm.txt
This snippet initializes `recordId` and `version` variables using ColdFusion's script syntax. It utilizes the Elvis operator (`?:`) to assign default empty string values if the `rc.id` or `rc.version` are not provided.
```ColdFusion
recordId = rc.id ?: "";
version = rc.version ?: "";
```
--------------------------------
### Configure Preside CMS Component Settings
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/extension.Config.cfc.txt
This CFML code snippet demonstrates the `configure` function within a Preside CMS component. It allows for the overriding and appending of core Preside and ColdBox settings, including configurations for i18n, interceptors, cacheBox, wirebox, logbox, and environments.
```cfml
component {
/**
* This extension Config.cfc has been scaffolded by the Preside
* Scaffolding service.
*
* Override or append to core Preside/Coldbox settings here.
*
*/
public void function configure( required struct config ) {
// core settings that will effect Preside
var settings = arguments.config.settings ?: {};
// other ColdBox settings
var coldbox = arguments.config.coldbox ?: {};
var i18n = arguments.config.i18n ?: {};
var interceptors = arguments.config.interceptors ?: {};
var interceptorSettings = arguments.config.interceptorSettings ?: {};
var cacheBox = arguments.config.cacheBox ?: {};
var wirebox = arguments.config.wirebox ?: {};
var logbox = arguments.config.logbox ?: {};
var environments = arguments.config.environments ?: {};
}
}
```
--------------------------------
### Render Object Data Table with Options
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/index.cfm.txt
This CFScript and HTML snippet renders the main data table for an object. It configures the table with options for multi-actions (if 'canDelete' is true), data source URL, multi-action URL, grid fields, drafts, batch editing, and data export.
```html
#renderView( view="/admin/datamanager/_objectDataTable", args={
objectName = objectName
, useMultiActions = canDelete
, datasourceUrl = event.buildAdminLink( linkTo="${handlerRoot}.getRecordsForAjaxDataTables" )
, multiActionUrl = event.buildAdminLink( linkTo='${handlerRoot}.multiAction' )
, gridFields = gridFields
// BEGIN DRAFTS
, draftsEnabled = true
// END DRAFTS
// BEGIN BATCHEDIT
, batchEditableFields = batchEditableFields
// END BATCHEDIT
// BEGIN DATAEXPORT
, allowDataExport = true
, dataExportUrl = event.buildAdminLink( linkTo='${handlerRoot}.exportDataAction' )
// END DATAEXPORT
} )#
```
--------------------------------
### Django Templates
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for highlighting Django template syntax.
```Django
{% extends "base.html" %}
{% block content %}
Hello {{ name }}!
{% endblock %}
```
--------------------------------
### Ruby Syntax Update
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Mentions a significant update to the Ruby syntax highlighting, including a refactoring for better correctness and consistency.
```ruby
big Ruby syntax update
```
--------------------------------
### C++ and PHP Auto-Detection
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Improved auto-detection capabilities for C++ and PHP code, ensuring more accurate highlighting.
```C++
// Example C++ code
#include
int main() {
std::cout << "Hello C++!" << std::endl;
return 0;
}
```
--------------------------------
### Highlight.js: Ruby and Perl Keyword Highlighting (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 2.2 fixed highlighting for keywords like 'def' and 'class' in Ruby, and 'sub' in Perl, improving the accuracy of keyword recognition in these languages.
```ruby
class MyClass
def my_method
end
end
```
```perl
sub my_subroutine {
# code here
}
```
--------------------------------
### JavaScript TAB Replacement Configuration
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Allows replacement of indentation TABs with a specified number of spaces (e.g., 2 or 4) for improved code readability and consistency.
```JavaScript
highlight.js now preserves custom user markup in code along with its own highlighting markup.
Also it's possible to replace indentation TABs with something sensible (e.g. 2 or 4 spaces)
```
--------------------------------
### JavaScript Style Switcher
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Implementation of a JavaScript-based style switcher for test.html, allowing users to dynamically change the appearance of highlighted code.
```JavaScript
// Example of JavaScript style switcher logic
document.getElementById('theme-switcher').addEventListener('change', function(event) {
// Apply selected theme to the highlighter
});
```
--------------------------------
### Add support for Clojure function calls
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Allows a function call in the beginning of s-expressions in Clojure highlighting. This enables more flexible and accurate highlighting of Clojure code.
```Clojure
(($filter "myCount") (arr 1 2 3 4 5))
```
--------------------------------
### Highlight.js: Ruby Support and Parsing Speed (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 2.0 added support for Ruby and significantly increased parsing speed through a new parsing method. This new method also allows for more correct keyword highlighting in tricky cases, such as 'End' in Delphi classes.
```ruby
puts 'Hello from Ruby!'
```
```delphi
class TMyClass
// ...
end;
```
--------------------------------
### Diff File Formatting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for highlighting Diff files, commonly used to show changes between code versions.
```Diff
--- a/old_file.txt
+++ b/new_file.txt
@@ -1 +1 @@
-Old content
+New content
```
--------------------------------
### Initialize Object Properties in CFScript
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/index.cfm.txt
This CFScript block initializes variables related to an object's properties, such as its name, title, and description, by translating resource URIs. It also sets flags for user permissions like 'canAdd' and 'canDelete'.
```cfscript
objectName = "${objectId}"
gridFields = ${explodedGridFields};
objectTitle = translateResource( uri = "preside-objects.#objectName#:title" , defaultValue = objectName );
objectTitleSingular = translateResource( uri = "preside-objects.#objectName#:title.singular", defaultValue = objectName );
objectDescription = translateResource( uri = "preside-objects.#objectName#:description" , defaultValue = "" );
addRecordTitle = translateResource( uri = "cms:datamanager.addrecord.title" , data = [ LCase( objectTitleSingular ) ] );
canAdd = IsTrue( prc.canAdd ?: false );
canDelete = IsTrue( prc.canDelete ?: false );
// BEGIN BATCHEDIT
batchEditableFields = prc.batchEditableFields ?: {};
// END BATCHEDIT
```
--------------------------------
### Add support for Ruby character syntax
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds support for characters like `?A`, `?1`, `?\012` etc. and `%r{..}` regexps in Ruby highlighting. This enhancement improves the accuracy of Ruby code highlighting.
```Ruby
?A
?1
?\012
%r{..}
```
--------------------------------
### Highlight.js: Javascript Highlighting (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 2.2 added initial highlighting support for Javascript, enabling basic syntax highlighting for Javascript code.
```javascript
function greet(name) {
console.log('Hello, ' + name);
}
```
--------------------------------
### Render Edit Record Form Viewlet in ColdFusion
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/edit.cfm.txt
This snippet renders an edit record form viewlet using `renderView`. It passes essential arguments including the object ID, record data, actions for editing and canceling, and versioning-related flags like `useVersioning`, `draftsEnabled`, `canPublish`, and `canSaveDraft`. Dependencies include the `/admin/datamanager/_editRecordForm` view and functions for building admin links.
```ColdFusion
#renderView( view="/admin/datamanager/_editRecordForm", args={
object = "${objectId}"
, id = rc.id ?: ""
, record = prc.record ?: {}
, editRecordAction = event.buildAdminLink( linkTo='${handlerRoot}.editAction' )
, cancelAction = event.buildAdminLink( linkTo='${handlerRoot}' )
, useVersioning = true
// BEGIN DRAFTS
, draftsEnabled = true
, canPublish = IsTrue( prc.canSaveDraft ?: "" )
, canSaveDraft = IsTrue( prc.canPublish ?: "" )
// END DRAFTS
} )#
```
--------------------------------
### JavaScript E4X Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Notes the inclusion of support for E4X (ECMAScript for XML) in JavaScript syntax highlighting.
```javascript
E4X in JavaScript
```
--------------------------------
### .ini File Key Name Enhancement
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Allows digits, underscores, and square brackets in key names for .ini files.
```INI
This version brings a small change: now .ini-files allow digits, underscores and
square brackets in key names.
```
--------------------------------
### Scala Language Definition
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds support for Scala programming language highlighting.
```Scala
Jan Berkel has contributed a definition for Scala. +1 to hotness!
```
--------------------------------
### SQL Keyword Grouping
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Feature for grouping SQL keywords (e.g., 'keyword', 'built-in function', 'literal') for more structured highlighting.
```SQL
-- Example SQL query
SELECT COUNT(*) FROM users WHERE status = 'active';
```
--------------------------------
### Render Add Record Button
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/index.cfm.txt
This HTML and CFScript snippet renders a button to add a new record if the user has the 'canAdd' permission. The button includes a plus icon and the translated 'addRecordTitle'.
```html
```
--------------------------------
### Basic 500 Error Page Styling (CSS)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/html/500.htm
Provides CSS rules to style a 500 error page, including layout, typography, and specific element styling. It also includes a hack to hide injected content from certain server environments.
```CSS
body {
background: #fff;
font-family: arial;
font-size: 14px;
padding: 0;
margin: 0;
color: #333;
}
#main {
margin: 0 10%;
}
#main ~ * {
display: none; /* hack for BlueDragon.net that insists on injecting error info at the end of the page - this hides that content */
}
h1, h2 {
margin: 30px 0;
font-weight: normal;
}
h1 span {
color: #808080;
}
h2 {
color: #808080;
font-size: 1.4em;
}
h3 {
color: #434343;
padding: 15px 0;
border-bottom: 1px dotted #d2d2d2;
}
ul li {
margin: 0;
}
p {
font-size: 12px;
margin: 20px 0;
}
```
--------------------------------
### Highlight.js: Ruby In-String Substitutions (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 2.9 added support for Ruby's in-string substitutions, allowing code like `#{...}` within strings to be highlighted correctly. This enhances the highlighting of Ruby code.
```ruby
puts "Hello, #{name}!"
```
--------------------------------
### HTML and XML Attribute Bug Fixes
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Includes minor bug fixes for parsing HTML and XML attributes.
```HTML
Plus there are a couple of minor bug fixes for parsing HTML
```
```XML
and XML attributes.
```
--------------------------------
### Lua Language Definition
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds support for Lua programming language highlighting.
```Lua
Andrew Fedorov made a definition for Lua
```
--------------------------------
### Preside CMS Add Handler - Form and Permissions
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Manages the 'add' action for content, checking add permissions, setting page titles, and verifying permissions for publishing or saving drafts. It also adds a breadcrumb for the add page.
```cfml
function add( event, rc, prc ) {
_checkPermissions( event=event, key="add" );
prc.pageTitle = translateResource( "${translationFile}:add.page.title" );
prc.pageSubtitle = translateResource( "${translationFile}:add.page.subtitle" );
// BEGIN DRAFTS
prc.canPublish = hasCmsPermission( "${permissionKey}.publish" );
prc.canSaveDraft = hasCmsPermission( "${permissionKey}.saveDraft" );
if ( !prc.canPublish && !prc.canSaveDraft ) {
event.adminAccessDenied();
}
// END DRAFTS
event.addAdminBreadCrumb(
title = translateResource( "${translationFile}:add.page.breadcrumb" )
, link = event.buildAdminLink( linkTo="${handlerRoot}.add" )
);
}
```
--------------------------------
### Display Version History
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Retrieves and displays the version history for a specific record. It fetches the record using its ID, checks if the record exists, and then sets the page title, subtitle, and breadcrumbs to display the record's label and link to its version history.
```Java
public void function versionHistory( event, rc, prc ) {
var id = rc.id ?: "";
prc.record = dao.selectData( id=id, selectFields=[ "${labelfield}" ] );
if ( !prc.record.recordCount ) {
messageBox.error( translateResource( uri="${translationFile}:record.not.found.error" ) );
setNextEvent( url=event.buildAdminLink( linkTo="${handlerRoot}" ) );
}
prc.pageTitle = translateResource( uri="${translationFile}:versionHistory.page.title" , data=[ prc.record.${labelfield} ] );
prc.pageSubTitle = translateResource( uri="${translationFile}:versionHistory.page.subTitle", data=[ prc.record.${labelfield} ] );
event.addAdminBreadCrumb(
title = translateResource( uri="${translationFile}:versionHistory.breadcrumb" , data=[ prc.record.${labelfield} ] )
, link = event.buildAdminLink( linkTo="${handlerRoot}.versionHistory", queryString="id=" & id )
);
}
```
--------------------------------
### Python Keyword Additions
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Addition of built-in keywords for Python, improving the accuracy of its auto-detection.
```Python
# Example Python code
def my_function():
print("Hello Python!")
```
--------------------------------
### PHP Function Title Highlighting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Notes the enhancement in PHP syntax highlighting to include highlighting for function titles.
```php
Function titles are now highlighted in *PHP*.
```
--------------------------------
### Preside CMS Grid Actions Configuration
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Configures arguments for grid actions, including object ID, grid fields, and draft status. It also defines links for editing, deleting, and viewing history, along with permission checks.
```cfml
eventArguments = {
object = "${objectId}"
, gridFields = "${gridFields}"
, actionsView = "admin.${handlerFolder}._gridActions"
// BEGIN DRAFTS
, draftsEnabled = true
// END DRAFTS
}
);
}
private string function _gridActions( event, rc, prc, args={} ) {
args.id = args.id ?: "";
args.deleteRecordLink = event.buildAdminLink( linkTo="${handlerRoot}.deleteAction" , queryString="id=" & args.id );
args.editRecordLink = event.buildAdminLink( linkTo="${handlerRoot}.edit" , queryString="id=" & args.id );
args.viewHistoryLink = event.buildAdminLink( linkTo="${handlerRoot}.versionHistory", queryString="id=" & args.id );
args.deleteRecordTitle = translateResource( "${translationFile}:delete.record.link.title" );
args.objectName = "${objectId}";
args.canEdit = hasCmsPermission( "${permissionKey}.edit" );
args.canDelete = hasCmsPermission( "${permissionKey}.delete" );
args.canViewHistory = hasCmsPermission( "${permissionKey}.view" );
return renderView( view="/admin/${handlerFolder}/_gridActions", args=args );
}
```
--------------------------------
### Prepare for Batch Field Editing
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Prepares the UI for batch editing a specific field across multiple records. It validates the presence of the field and record IDs, checks edit permissions, and sets page titles and breadcrumbs for the batch edit interface.
```Java
function batchEditField( event, rc, prc ) {
var ids = Trim( rc.id ?: "" );
var field = Trim( rc.field ?: "" );
var fieldName = translateResource( uri="preside-objects.${objectId}:field.#field#.title", defaultValue=field );
var recordCount = ids.listLen();
_checkPermissions( argumentCollection=arguments, key="edit" );
if ( !field.len() || !ids.len() ) {
messageBox.error( translateResource( uri="${translationFile}:record.not.found.error" ) );
setNextEvent( url=event.buildAdminLink( linkTo="${handlerRoot}" ) );
}
prc.pageTitle = translateResource( uri="${translationFile}:batchedit.page.title", data=[ fieldName, recordCount ] );
prc.pageSubtitle = translateResource( uri="${translationFile}:batchedit.page.subtitle", data=[ fieldName, recordCount ] );
event.addAdminBreadCrumb(
title = translateResource( uri="${translationFile}:batchedit.page.breadcrumb", data=[ fieldName ] )
, link = ""
);
}
```
--------------------------------
### C++ Keyword Additions
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Addition of built-in keywords for C++, enhancing its auto-detection capabilities.
```C++
// Example C++ code with keywords
#include
int main() {
const int MAX_SIZE = 100;
std::cout << "Hello C++!" << std::endl;
return 0;
}
```
--------------------------------
### Highlight.js: VBScript Highlighting (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 2.7 added highlighting support for VBScript, enabling accurate syntax highlighting for Visual Basic Scripting Edition code.
```vbscript
MsgBox "Hello World"
```
--------------------------------
### Perl New Keywords
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Indicates the addition of new keywords to the Perl syntax highlighting.
```perl
new keywords in Perl
```
--------------------------------
### Highlight.js: Dynamic Language Loading (JavaScript)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Version 3.0 introduced modularization to highlight.js, allowing it to dynamically load only the necessary languages when a list is provided. This improves performance by reducing the amount of code loaded into the browser.
```javascript
initHighlighting(languages);
```
--------------------------------
### Preside CMS Index Handler - Display and Permissions
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Handles the index action for an AdminHandler, setting page titles, subtitles, and determining user permissions for adding and deleting records. It also retrieves batch editable fields.
```cfml
function index( event, rc, prc ) {
prc.pageTitle = translateResource( "${translationFile}:page.title" );
prc.pageSubtitle = translateResource( "${translationFile}:page.subtitle" );
prc.canAdd = hasCmsPermission( "${permissionKey}.add" );
prc.canDelete = hasCmsPermission( "${permissionKey}.delete" );
// BEGIN BATCHEDIT
prc.batchEditableFields = dataManagerService.listBatchEditableFields( "${objectId}" );
// END BATCHEDIT
}
```
--------------------------------
### Placeholder for Form Control HTML Output
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/formcontrol.view.cfm.txt
This section provides a placeholder for the HTML output of a form control. It currently displays a message indicating that the form control view has not yet been implemented.
```html
${id} form control view not yet implemented
```
--------------------------------
### CoffeeScript Regular Expression Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Details the improved support for regular expressions within CoffeeScript syntax highlighting.
```coffeescript
CoffeeScript support continues to improve getting support for regular expressions.
```
--------------------------------
### MEL Language Support
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Support for the Maya Embedded Language (MEL), used for scripting in Autodesk Maya.
```MEL
// Example MEL command
string $myString = "Hello Maya";
print $myString;
```
--------------------------------
### Preside CMS Edit Handler - Record Loading and Permissions
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Handles the 'edit' action for existing content. It checks edit permissions, loads the record data (including drafts if enabled), handles cases where the record is not found, and sets up page titles and breadcrumbs.
```cfml
function edit( event, rc, prc ) {
_checkPermissions( event=event, key="edit" );
// BEGIN DRAFTS
prc.canSaveDraft = hasCmsPermission( "${permissionKey}.saveDraft" );
prc.canPublish = hasCmsPermission( "${permissionKey}.publish" );
if ( !prc.canSaveDraft && !prc.canPublish ) {
event.adminAccessDenied()
}
// END DRAFTS
var id = rc.id ?: "";
var version = Val( rc.version ?: "" );
prc.record = dao.selectData(
filter = { id=id }
, fromVersionTable = true
// BEGIN DRAFTS
, allowDraftVersions = true
// END DRAFTS
, specificVersion = version
);
if ( !prc.record.recordCount ) {
messageBox.error( translateResource( uri="${translationFile}:record.not.found.error" ) );
setNextEvent( url=event.buildAdminLink( linkTo="${handlerRoot}" ) );
}
prc.record = queryRowToStruct( prc.record );
prc.pageTitle = translateResource( uri="${translationFile}:edit.page.title", data=[ prc.record.${labelfield} ] );
prc.pageSubtitle = translateResource( uri="${translationFile}:edit.page.subtitle", data=[ prc.record.${labelfield} ] );
event.addAdminBreadCrumb(
title = translateResource( uri="${translationFile}:edit.page.breadcrumb", data=[ prc.record.${labelfield} ] )
, link = event.buildAdminLink( linkTo="${handlerRoot}.edit", queryString="id=#id#" )
);
}
```
--------------------------------
### XML Custom Tag Highlighting
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Improved highlighting for custom XML, allowing it to be detected and styled according to its own rules, including CDATA sections and processing instructions.
```XML
```
--------------------------------
### Fetch Records for DataTables (AJAX)
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Fetches records for display in AJAX-powered DataTables. It first checks for read permissions and then executes a predefined event to retrieve the data, likely for paginated and searchable table views.
```Java
public void function getRecordsForAjaxDataTables( event, rc, prc ) {
_checkPermissions( event=event, key="read" );
runEvent(
event = "admin.DataManager._getObjectRecordsForAjaxDataTables"
, prePostExempt = true
);
```
--------------------------------
### Bash Fixes
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Refers to minor fixes applied to the Bash syntax highlighting.
```bash
small fixes in Bash
```
--------------------------------
### Preside CMS Data Export Action
Source: https://github.com/pixl8/preside-cms/blob/stable/system/services/devtools/scaffoldingResources/crudAdmin/handler.cfc.txt
Handles the data export action by first checking read permissions and then running a specific event for data export, passing the object name.
```cfml
// BEGIN DATAEXPORT
public void function exportDataAction( event, rc, prc ) {
_checkPermissions( event=event, key="read" );
runEvent(
event = "admin.DataManager._exportDataAction"
, prePostExempt = true
, private = true
, eventArguments = { objectName="${objectId}" }
);
}
// END DATAEXPORT
```
--------------------------------
### Parser 3 Language Definition
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Adds support for the Parser 3 language.
```Parser 3
Oleg Volchkov has sent a definition for [Parser 3][p3].
```
--------------------------------
### Specifying Language and Disabling Highlighting in Highlight.js
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/README.md
Shows how to explicitly set the language for a code block or disable highlighting altogether by applying specific CSS classes to the `` or `` elements.
```html
...
```
```html
...
```
--------------------------------
### JavaScript Minification
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Reference to JSMin, a tool used for JavaScript minification, implying compatibility or integration.
```JavaScript
// Example of JavaScript code that might be minified
function add(a, b) {
return a + b;
}
```
--------------------------------
### HTML Embedded VBScript
Source: https://github.com/pixl8/preside-cms/blob/stable/system/assets/ckeditorExtensions/plugins/codesnippet/lib/highlight/CHANGES.md
Enables the highlighting of embedded VBScript code within HTML using `<% .. %>` tags.
```HTML
<%
Response.Write("Hello VBScript!")
%>
```