Skip to content

Commit 9c63ca8

Browse files
committed
getting ready for final release
1 parent 0d5972b commit 9c63ca8

File tree

11 files changed

+126
-107
lines changed

11 files changed

+126
-107
lines changed

config/Coldbox.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
missingTemplateHandler = "",
2424

2525
//Extension Points
26-
ApplicationHelper = "",
26+
UDFLibraryFile = "",
2727
coldboxExtensionsLocation = "",
2828
modulesExternalLocation = [],
2929
pluginsExternalLocation = "",

modules/validation/ModuleConfig.cfc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ component{
1111
this.author = "Luis Majano";
1212
this.webURL = "http://www.ortussolutions.com";
1313
this.description = "This module provides server-side validation to ColdBox applications";
14-
this.version = "1.0.0.@build.number@";
14+
this.version = "1.0.0+@build.number@";
1515
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
1616
this.viewParentLookup = true;
1717
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
@@ -33,7 +33,7 @@ component{
3333
function configure(){
3434

3535
// Mixin our own methods on handlers, interceptors and views via the ColdBox UDF Library File setting
36-
arrayAppend( controller.getSetting( "ApplicationHelper" ), "#moduleMapping#/models/Mixins.cfm" );
36+
arrayAppend( controller.getSetting( "UDFLibraryFile" ), "#moduleMapping#/models/Mixins.cfm" );
3737

3838
// Validation Settings
3939
settings = {
@@ -56,15 +56,15 @@ component{
5656
var configSettings = controller.getConfigSettings();
5757
// parse parent settings
5858
parseParentSettings();
59-
// setup shared constraints
60-
wirebox.getInstance( "validationManager@validation" )
61-
.setSharedConstraints( configSettings.validation.sharedConstraints );
62-
// Did you change the manager
59+
// Did you change the validation manager?
6360
if( configSettings.validation.manager != this.COLDBOX_VALIDATION_MANAGER ){
64-
map( "validationManager@validation" )
61+
binder.map( "validationManager@validation" )
6562
.to( configSettings.validation.manager )
6663
.asSingleton();
6764
}
65+
// setup shared constraints
66+
wirebox.getInstance( "validationManager@validation" )
67+
.setSharedConstraints( configSettings.validation.sharedConstraints );
6868

6969
}
7070

modules/validation/box.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "ColdBox Validation",
33
"author" : "Luis Majano <[email protected]",
4-
"version" : "1.0.0.@build.number@",
4+
"version" : "1.0.0+@build.number@",
55
"slug" : "validation",
66
"type" : "modules",
77
"homepage" : "http://www.coldbox.org",
@@ -16,7 +16,7 @@
1616
],
1717
"engines" : [
1818
{ "type" : "railo", "version" : ">4.1" },
19-
{ "type" : "adobe", "version" : ">9.02" },
19+
{ "type" : "adobe", "version" : ">9.02" }
2020
],
2121
"dependencies" :{
2222
"i18n" : "1.0.0"

modules/validation/changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CHANGELOG
2+
=========
3+
4+
##1.0.0
5+
* Create first module version

modules/validation/changelog.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

modules/validation/instructions.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
INSTRUCTIONS
2+
============
3+
4+
Just drop into your **modules** folder or use the box-cli to install
5+
6+
`box install validation`
7+
8+
The module will register several objects into WireBox using the `@validation` namespace. The validation manager is registered as `ValidationManager@validation`
9+
10+
## Mixins
11+
The module will also register two methods in your handlers/interceptors/layouts/views
12+
13+
```js
14+
/**
15+
* Validate an object or structure according to the constraints rules.
16+
* @target An object or structure to validate
17+
* @fields The fields to validate on the target. By default, it validates on all fields
18+
* @constraints A structure of constraint rules or the name of the shared constraint rules to use for validation
19+
* @locale The i18n locale to use for validation messages
20+
* @excludeFields The fields to exclude in the validation
21+
*
22+
* @return cbvalidation.model.result.IValidationResult
23+
*/
24+
function validateModel()
25+
26+
/**
27+
* Retrieve the application's configured Validation Manager
28+
*/
29+
function getValidationManager()
30+
```
31+
32+
## Settings
33+
Here are the module settings you can place in your `ColdBox.cfc` by using the `validation` settings structure:
34+
35+
```js
36+
validation = {
37+
// The third-party validation manager to use, by default it uses CBValidation.
38+
manager = "class path",
39+
// You can store global constraint rules here with unique names
40+
sharedConstraints = {
41+
name = {
42+
field = { constraints here }
43+
}
44+
}
45+
46+
}
47+
```
48+
49+
You can read more about ColdBox Validation here: http://wiki.coldbox.org/wiki/Validation.cfm

modules/validation/instructions.txt

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
<!--- validateModel --->
2-
<cffunction name="validateModel" output="false" access="public" returntype="any" hint="Validate a target object">
3-
<cfargument name="target" type="any" required="true" hint="The target object to validate or a structure of name-value paris to validate."/>
4-
<cfargument name="fields" type="string" required="false" default="*" hint="Validate on all or one or a list of fields (properties) on the target, by default we validate all fields declared in its constraints"/>
5-
<cfargument name="constraints" type="any" required="false" hint="The shared constraint name to use, or an actual constraints structure"/>
6-
<cfargument name="locale" type="string" required="false" default="" hint="The locale to validate in"/>
7-
<cfargument name="excludeFields" type="string" required="false" default="" hint="The fields to exclude in the validation"/>
8-
<cfreturn getValidationManager().validate( argumentCollection=arguments )>
9-
</cffunction>
1+
<cfscript>
102
11-
<!--- Retrieve the applications Validation Manager --->
12-
<cffunction name="getValidationManager" access="public" returntype="any" output="false" hint="Retrieve the application's configured Validation Manager">
13-
<cfreturn wirebox.getInstance( "ValidationManager@validation" )>
14-
</cffunction>
3+
/**
4+
* Validate an object or structure according to the constraints rules.
5+
* @target An object or structure to validate
6+
* @fields The fields to validate on the target. By default, it validates on all fields
7+
* @constraints A structure of constraint rules or the name of the shared constraint rules to use for validation
8+
* @locale The i18n locale to use for validation messages
9+
* @excludeFields The fields to exclude in the validation
10+
*
11+
* @return cbvalidation.model.result.IValidationResult
12+
*/
13+
function validateModel(
14+
required any target,
15+
string fields="*",
16+
any constraints,
17+
string locale="",
18+
string excludeFields=""
19+
){
20+
return getValidationManager().validate( argumentCollection=arguments );
21+
}
22+
23+
/**
24+
* Retrieve the application's configured Validation Manager
25+
*/
26+
function getValidationManager(){
27+
return wirebox.getInstance( "ValidationManager@validation" );
28+
}
29+
30+
</cfscript>

readme.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
WELCOME TO THE COLDBOX VALIDATION MODULE
2+
========================================
3+
ColdBox sports its own server side validation engine so it can provide you with a unified approach to object and form validation.
4+
5+
##LICENSE
6+
Apache License, Version 2.0.
7+
8+
##IMPORTANT LINKS
9+
- https://github.com/ColdBox/cbox-validation
10+
- http://www.coldbox.org/forgebox/validation
11+
- http://wiki.coldbox.org/wiki/Validation.cfm
12+
13+
##SYSTEM REQUIREMENTS
14+
- Railo 4+
15+
- ColdFusion 9+
16+
17+
********************************************************************************
18+
Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp
19+
www.coldbox.org | www.luismajano.com | www.ortussolutions.com
20+
********************************************************************************
21+
####HONOR GOES TO GOD ABOVE ALL
22+
Because of His grace, this project exists. If you don't like this, then don't read it, its not for you.
23+
24+
>"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ:
25+
By whom also we have access by faith into this grace wherein we stand, and rejoice in hope of the glory of God.
26+
And not only so, but we glory in tribulations also: knowing that tribulation worketh patience;
27+
And patience, experience; and experience, hope:
28+
And hope maketh not ashamed; because the love of God is shed abroad in our hearts by the
29+
Holy Ghost which is given unto us. ." Romans 5:5
30+
31+
###THE DAILY BREAD
32+
> "I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12

readme.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)