aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/validate
diff options
context:
space:
mode:
Diffstat (limited to 'includes/js/dojox/validate')
-rw-r--r--includes/js/dojox/validate/README37
-rw-r--r--includes/js/dojox/validate/_base.js183
-rw-r--r--includes/js/dojox/validate/ca.js44
-rw-r--r--includes/js/dojox/validate/check.js261
-rw-r--r--includes/js/dojox/validate/creditCard.js92
-rw-r--r--includes/js/dojox/validate/isbn.js37
-rw-r--r--includes/js/dojox/validate/regexp.js331
-rw-r--r--includes/js/dojox/validate/tests/creditcard.js119
-rw-r--r--includes/js/dojox/validate/tests/module.js14
-rw-r--r--includes/js/dojox/validate/tests/runTests.html9
-rw-r--r--includes/js/dojox/validate/tests/validate.js316
-rw-r--r--includes/js/dojox/validate/us.js67
-rw-r--r--includes/js/dojox/validate/web.js89
13 files changed, 0 insertions, 1599 deletions
diff --git a/includes/js/dojox/validate/README b/includes/js/dojox/validate/README
deleted file mode 100644
index 795afcb..0000000
--- a/includes/js/dojox/validate/README
+++ /dev/null
@@ -1,37 +0,0 @@
--------------------------------------------------------------------------------
-dojox.validate
--------------------------------------------------------------------------------
-Version 0.01
-Release date: 07/12/2007
--------------------------------------------------------------------------------
-Project state: experimental / beta
--------------------------------------------------------------------------------
-Credits
- port: Peter Higgins (dante)
- contributions: Kun Xi (bookstack@gmail.com)
--------------------------------------------------------------------------------
-Project description
-
- Provides a set of validation functions to match
- values against known constants for use in form
- validation, such as email address, TLD, ipAddress,
- country-specific phone numbers and SSN, among
- others..
-
--------------------------------------------------------------------------------
-Dependencies:
-
- Requires dojo base and dojo.regexp.
-
--------------------------------------------------------------------------------
-Installation instructions
-
-Grab the following from the Dojo SVN Repository:
-
-http://svn.dojotoolkit.org/dojo/dojox/trunk/validate.js
-http://svn.dojotoolkit.org/dojo/dojox/trunk/validate
-
-Install into the following directory structure:
-/dojox/validate/
-
-...which should be at the same level as your Dojo checkout.
diff --git a/includes/js/dojox/validate/_base.js b/includes/js/dojox/validate/_base.js
deleted file mode 100644
index 9dbba59..0000000
--- a/includes/js/dojox/validate/_base.js
+++ /dev/null
@@ -1,183 +0,0 @@
-if(!dojo._hasResource["dojox.validate._base"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate._base"] = true;
-dojo.provide("dojox.validate._base");
-
-dojo.require("dojo.regexp"); // dojo core expressions
-dojo.require("dojo.number"); // dojo number expressions
-dojo.require("dojox.validate.regexp"); // additional expressions
-
-dojox.validate.isText = function(/*String*/value, /*Object?*/flags){
- // summary:
- // Checks if a string has non whitespace characters.
- // Parameters allow you to constrain the length.
- //
- // value: A string
- // flags: {length: Number, minlength: Number, maxlength: Number}
- // flags.length If set, checks if there are exactly flags.length number of characters.
- // flags.minlength If set, checks if there are at least flags.minlength number of characters.
- // flags.maxlength If set, checks if there are at most flags.maxlength number of characters.
-
- flags = (typeof flags == "object") ? flags : {};
-
- // test for text
- if(/^\s*$/.test(value)){ return false; } // Boolean
-
- // length tests
- if(typeof flags.length == "number" && flags.length != value.length){ return false; } // Boolean
- if(typeof flags.minlength == "number" && flags.minlength > value.length){ return false; } // Boolean
- if(typeof flags.maxlength == "number" && flags.maxlength < value.length){ return false; } // Boolean
-
- return true; // Boolean
-
-}
-
-dojox.validate._isInRangeCache = {};
-dojox.validate.isInRange = function(/*String*/value, /*Object?*/flags){
- // summary:
- // Validates whether a string denoting an integer,
- // real number, or monetary value is between a max and min.
- //
- // value: A string
- // flags: {max:Number, min:Number, decimal:String}
- // flags.max A number, which the value must be less than or equal to for the validation to be true.
- // flags.min A number, which the value must be greater than or equal to for the validation to be true.
- // flags.decimal The character used for the decimal point. Default is ".".
-
- // fixes ticket #2908
- value = dojo.number.parse(value, flags);
- if(isNaN(value)){
- return false; // Boolean
- }
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- var max = (typeof flags.max == "number") ? flags.max : Infinity;
- var min = (typeof flags.min == "number") ? flags.min : -Infinity;
- var dec = (typeof flags.decimal == "string") ? flags.decimal : ".";
-
- var cache = dojox.validate._isInRangeCache;
- var cacheIdx = value+"max"+max+"min"+min+"dec"+dec;
- if(typeof cache[cacheIdx] != "undefined"){
- return cache[cacheIdx];
- }
-
- if ( value < min || value > max ) { cache[cacheIdx] = false; return false; } // Boolean
-
- cache[cacheIdx] = true; return true; // Boolean
-}
-
-dojox.validate.isNumberFormat = function(/*String*/value, /*Object?*/flags){
- // summary:
- // Validates any sort of number based format
- //
- // description:
- // Use it for phone numbers, social security numbers, zip-codes, etc.
- // The value can be validated against one format or one of multiple formats.
- //
- // Format
- // # Stands for a digit, 0-9.
- // ? Stands for an optional digit, 0-9 or nothing.
- // All other characters must appear literally in the expression.
- //
- // Example
- // "(###) ###-####" -> (510) 542-9742
- // "(###) ###-#### x#???" -> (510) 542-9742 x153
- // "###-##-####" -> 506-82-1089 i.e. social security number
- // "#####-####" -> 98225-1649 i.e. zip code
- //
- // value: A string
- // flags: {format:String}
- // flags.format A string or an Array of strings for multiple formats.
-
- var re = new RegExp("^" + dojox.regexp.numberFormat(flags) + "$", "i");
- return re.test(value); // Boolean
-}
-
-dojox.validate.isValidLuhn = function(/*String*/value){
- //summary: Compares value against the Luhn algorithm to verify its integrity
- var sum, parity, curDigit;
- if(typeof value!='string'){
- value = String(value);
- }
- value = value.replace(/[- ]/g,''); //ignore dashes and whitespaces
- parity = value.length%2;
- sum=0;
- for(var i=0;i<value.length;i++){
- curDigit = parseInt(value.charAt(i));
- if(i%2==parity){
- curDigit*=2;
- }
- if(curDigit>9){
- curDigit-=9;
- }
- sum+=curDigit;
- }
- return !(sum%10); //Boolean
-}
-
-/**
- Procedural API Description
-
- The main aim is to make input validation expressible in a simple format.
- You define profiles which declare the required and optional fields and any constraints they might have.
- The results are provided as an object that makes it easy to handle missing and invalid input.
-
- Usage
-
- var results = dojo.validate.check(form, profile);
-
- Profile Object
-
- var profile = {
- // filters change the field value and are applied before validation.
- trim: ["tx1", "tx2"],
- uppercase: ["tx9"],
- lowercase: ["tx5", "tx6", "tx7"],
- ucfirst: ["tx10"],
- digit: ["tx11"],
-
- // required input fields that are blank will be reported missing.
- // required radio button groups and drop-down lists with no selection will be reported missing.
- // checkbox groups and selectboxes can be required to have more than one value selected.
- // List required fields by name and use this notation to require more than one value: {checkboxgroup: 2}, {selectboxname: 3}.
- required: ["tx7", "tx8", "pw1", "ta1", "rb1", "rb2", "cb3", "s1", {"doubledip":2}, {"tripledip":3}],
-
- // dependant/conditional fields are required if the target field is present and not blank.
- // At present only textbox, password, and textarea fields are supported.
- dependencies: {
- cc_exp: "cc_no",
- cc_type: "cc_no",
- },
-
- // Fields can be validated using any boolean valued function.
- // Use arrays to specify parameters in addition to the field value.
- constraints: {
- field_name1: myValidationFunction,
- field_name2: dojo.validate.isInteger,
- field_name3: [myValidationFunction, additional parameters],
- field_name4: [dojo.validate.isValidDate, "YYYY.MM.DD"],
- field_name5: [dojo.validate.isEmailAddress, false, true],
- },
-
- // Confirm is a sort of conditional validation.
- // It associates each field in its property list with another field whose value should be equal.
- // If the values are not equal, the field in the property list is reported as Invalid. Unless the target field is blank.
- confirm: {
- email_confirm: "email",
- pw2: "pw1",
- }
- };
-
- Results Object
-
- isSuccessful(): Returns true if there were no invalid or missing fields, else it returns false.
- hasMissing(): Returns true if the results contain any missing fields.
- getMissing(): Returns a list of required fields that have values missing.
- isMissing(field): Returns true if the field is required and the value is missing.
- hasInvalid(): Returns true if the results contain fields with invalid data.
- getInvalid(): Returns a list of fields that have invalid values.
- isInvalid(field): Returns true if the field has an invalid value.
-
-*/
-
-}
diff --git a/includes/js/dojox/validate/ca.js b/includes/js/dojox/validate/ca.js
deleted file mode 100644
index dbd3aa5..0000000
--- a/includes/js/dojox/validate/ca.js
+++ /dev/null
@@ -1,44 +0,0 @@
-if(!dojo._hasResource["dojox.validate.ca"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.ca"] = true;
-dojo.provide("dojox.validate.ca");
-
-dojo.require("dojox.validate._base");
-
-dojox.validate.ca.isPhoneNumber = function(/* String */value) {
- // summary: Validates 10 Canadian digit phone number for several common formats
- // returns: Boolean
- return dojox.validate.us.isPhoneNumber(value); // same as US
-};
-
-dojox.validate.ca.isProvince = function(/* String[2] */value) {
- // summary: Validates Canadian province abbreviations (2 chars)
- // returns: Boolean
- var re = new RegExp("^" + dojox.regexp.ca.province() + "$", "i");
- return re.test(value);
-};
-
-dojox.validate.ca.isSocialInsuranceNumber = function(/* String */value) {
- // summary: Validates Canadian 9 digit social insurance number for several common formats
- // This routine only pattern matches and does not use the Luhn Algorithm to validate number.
- // returns: Boolean
- var flags = {
- format: [
- "###-###-###",
- "### ### ###",
- "#########"
- ]
- };
- return dojox.validate.isNumberFormat(value, flags);
-};
-
-dojox.validate.ca.isPostalCode = function(value) {
- // summary: Validates Canadian 6 digit postal code:
- // Canadian postal codes are in the format ANA NAN,
- // where A is a letter and N is a digit, with a space
- // separating the third and fourth characters.
- // returns: Boolean
- var re = new RegExp("^" + dojox.regexp.ca.postalCode() + "$", "i");
- return re.test(value);
-};
-
-}
diff --git a/includes/js/dojox/validate/check.js b/includes/js/dojox/validate/check.js
deleted file mode 100644
index 015da79..0000000
--- a/includes/js/dojox/validate/check.js
+++ /dev/null
@@ -1,261 +0,0 @@
-if(!dojo._hasResource["dojox.validate.check"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.check"] = true;
-dojo.provide("dojox.validate.check");
-
-dojo.require("dojox.validate._base");
-
-dojox.validate.check = function(/*HTMLFormElement*/form, /*Object*/profile){
- // summary: validates user input of an HTML form based on input profile
- //
- // description:
- // returns an object that contains several methods summarizing the results of the validation
- //
- // form: form to be validated
- // profile: specifies how the form fields are to be validated
- // {trim:Array, uppercase:Array, lowercase:Array, ucfirst:Array, digit:Array,
- // required:Array, dependencies:Object, constraints:Object, confirm:Object}
-
- // Essentially private properties of results object
- var missing = [];
- var invalid = [];
-
- // results object summarizes the validation
- var results = {
- isSuccessful: function() {return ( !this.hasInvalid() && !this.hasMissing() );},
- hasMissing: function() {return ( missing.length > 0 );},
- getMissing: function() {return missing;},
- isMissing: function(elemname) {
- for(var i = 0; i < missing.length; i++){
- if(elemname == missing[i]){ return true; }
- }
- return false;
- },
- hasInvalid: function() {return ( invalid.length > 0 );},
- getInvalid: function() {return invalid;},
- isInvalid: function(elemname){
- for(var i = 0; i < invalid.length; i++){
- if(elemname == invalid[i]){ return true; }
- }
- return false;
- }
- };
-
- var _undef = function(name,object){
- return (typeof object[name] == "undefined");
- };
-
- // Filters are applied before fields are validated.
- // Trim removes white space at the front and end of the fields.
- if(profile.trim instanceof Array){
- for(var i = 0; i < profile.trim.length; i++){
- var elem = form[profile.trim[i]];
- if(_undef("type", elem) || elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; }
- elem.value = elem.value.replace(/(^\s*|\s*$)/g, "");
- }
- }
- // Convert to uppercase
- if(profile.uppercase instanceof Array){
- for(var i = 0; i < profile.uppercase.length; i++){
- var elem = form[profile.uppercase[i]];
- if(_undef("type", elem) || elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; }
- elem.value = elem.value.toUpperCase();
- }
- }
- // Convert to lowercase
- if(profile.lowercase instanceof Array){
- for (var i = 0; i < profile.lowercase.length; i++){
- var elem = form[profile.lowercase[i]];
- if(_undef("type", elem) || elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; }
- elem.value = elem.value.toLowerCase();
- }
- }
- // Uppercase first letter
- if(profile.ucfirst instanceof Array){
- for(var i = 0; i < profile.ucfirst.length; i++){
- var elem = form[profile.ucfirst[i]];
- if(_undef("type", elem) || elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; }
- elem.value = elem.value.replace(/\b\w+\b/g, function(word) { return word.substring(0,1).toUpperCase() + word.substring(1).toLowerCase(); });
- }
- }
- // Remove non digits characters from the input.
- if(profile.digit instanceof Array){
- for(var i = 0; i < profile.digit.length; i++){
- var elem = form[profile.digit[i]];
- if(_undef("type", elem) || elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; }
- elem.value = elem.value.replace(/\D/g, "");
- }
- }
-
- // See if required input fields have values missing.
- if(profile.required instanceof Array){
- for(var i = 0; i < profile.required.length; i++){
- if(!dojo.isString(profile.required[i])){ continue; }
- var elem = form[profile.required[i]];
- // Are textbox, textarea, or password fields blank.
- if(!_undef("type", elem)
- && (elem.type == "text" || elem.type == "textarea" || elem.type == "password" || elem.type == "file")
- && /^\s*$/.test(elem.value)){
- missing[missing.length] = elem.name;
- }
- // Does drop-down box have option selected.
- else if(!_undef("type", elem) && (elem.type == "select-one" || elem.type == "select-multiple")
- && (elem.selectedIndex == -1
- || /^\s*$/.test(elem.options[elem.selectedIndex].value))){
- missing[missing.length] = elem.name;
- }
- // Does radio button group (or check box group) have option checked.
- else if(elem instanceof Array){
- var checked = false;
- for(var j = 0; j < elem.length; j++){
- if (elem[j].checked) { checked = true; }
- }
- if(!checked){
- missing[missing.length] = elem[0].name;
- }
- }
- }
- }
-
- // See if checkbox groups and select boxes have x number of required values.
- if(profile.required instanceof Array){
- for (var i = 0; i < profile.required.length; i++){
- if(!dojo.isObject(profile.required[i])){ continue; }
- var elem, numRequired;
- for(var name in profile.required[i]){
- elem = form[name];
- numRequired = profile.required[i][name];
- }
- // case 1: elem is a check box group
- if(elem instanceof Array){
- var checked = 0;
- for(var j = 0; j < elem.length; j++){
- if(elem[j].checked){ checked++; }
- }
- if(checked < numRequired){
- missing[missing.length] = elem[0].name;
- }
- }
- // case 2: elem is a select box
- else if(!_undef("type", elem) && elem.type == "select-multiple" ){
- var selected = 0;
- for(var j = 0; j < elem.options.length; j++){
- if (elem.options[j].selected && !/^\s*$/.test(elem.options[j].value)) { selected++; }
- }
- if(selected < numRequired){
- missing[missing.length] = elem.name;
- }
- }
- }
- }
-
- // Dependent fields are required when the target field is present (not blank).
- // Todo: Support dependent and target fields that are radio button groups, or select drop-down lists.
- // Todo: Make the dependency based on a specific value of the target field.
- // Todo: allow dependent fields to have several required values, like {checkboxgroup: 3}.
- if(dojo.isObject(profile.dependencies)){
- // properties of dependencies object are the names of dependent fields to be checked
- for(name in profile.dependencies){
- var elem = form[name]; // the dependent element
- if(_undef("type", elem)){continue;}
- if(elem.type != "text" && elem.type != "textarea" && elem.type != "password"){ continue; } // limited support
- if(/\S+/.test(elem.value)){ continue; } // has a value already
- if(results.isMissing(elem.name)){ continue; } // already listed as missing
- var target = form[profile.dependencies[name]];
- if(target.type != "text" && target.type != "textarea" && target.type != "password"){ continue; } // limited support
- if(/^\s*$/.test(target.value)){ continue; } // skip if blank
- missing[missing.length] = elem.name; // ok the dependent field is missing
- }
- }
-
- // Find invalid input fields.
- if(dojo.isObject(profile.constraints)){
- // constraint properties are the names of fields to bevalidated
- for(name in profile.constraints){
- var elem = form[name];
- if(!elem) {continue;}
-
- // skip if blank - its optional unless required, in which case it
- // is already listed as missing.
- if(!_undef("tagName",elem)
- && (elem.tagName.toLowerCase().indexOf("input") >= 0
- || elem.tagName.toLowerCase().indexOf("textarea") >= 0)
- && /^\s*$/.test(elem.value)){
- continue;
- }
-
- var isValid = true;
- // case 1: constraint value is validation function
- if(dojo.isFunction(profile.constraints[name])){
- isValid = profile.constraints[name](elem.value);
- }else if(dojo.isArray(profile.constraints[name])){
-
- // handle nested arrays for multiple constraints
- if(dojo.isArray(profile.constraints[name][0])){
- for (var i=0; i<profile.constraints[name].length; i++){
- isValid = dojox.validate.evaluateConstraint(profile, profile.constraints[name][i], name, elem);
- if(!isValid){ break; }
- }
- }else{
- // case 2: constraint value is array, first elem is function,
- // tail is parameters
- isValid = dojox.validate.evaluateConstraint(profile, profile.constraints[name], name, elem);
- }
- }
-
- if(!isValid){
- invalid[invalid.length] = elem.name;
- }
- }
- }
-
- // Find unequal confirm fields and report them as Invalid.
- if(dojo.isObject(profile.confirm)){
- for(name in profile.confirm){
- var elem = form[name]; // the confirm element
- var target = form[profile.confirm[name]];
- if (_undef("type", elem) || _undef("type", target) || (elem.type != "text" && elem.type != "textarea" && elem.type != "password")
- ||(target.type != elem.type)
- ||(target.value == elem.value) // it's valid
- ||(results.isInvalid(elem.name))// already listed as invalid
- ||(/^\s*$/.test(target.value))) // skip if blank - only confirm if target has a value
- {
- continue;
- }
- invalid[invalid.length] = elem.name;
- }
- }
- return results; // Object
-};
-
-//TODO: evaluateConstraint doesn't use profile or fieldName args?
-dojox.validate.evaluateConstraint=function(profile, /*Array*/constraint, fieldName, elem){
- // summary:
- // Evaluates dojo.validate.check() constraints that are specified as array
- // arguments
- //
- // description: The arrays are expected to be in the format of:
- // constraints:{
- // fieldName: [functionToCall, param1, param2, etc.],
- // fieldName: [[functionToCallFirst, param1],[functionToCallSecond,param2]]
- // }
- //
- // This function evaluates a single array function in the format of:
- // [functionName, argument1, argument2, etc]
- //
- // The function will be parsed out and evaluated against the incoming parameters.
- //
- // profile: The dojo.validate.check() profile that this evaluation is against.
- // constraint: The single [] array of function and arguments for the function.
- // fieldName: The form dom name of the field being validated.
- // elem: The form element field.
-
- var isValidSomething = constraint[0];
- var params = constraint.slice(1);
- params.unshift(elem.value);
- if(typeof isValidSomething != "undefined"){
- return isValidSomething.apply(null, params);
- }
- return false; // Boolean
-}
-
-}
diff --git a/includes/js/dojox/validate/creditCard.js b/includes/js/dojox/validate/creditCard.js
deleted file mode 100644
index 903aab1..0000000
--- a/includes/js/dojox/validate/creditCard.js
+++ /dev/null
@@ -1,92 +0,0 @@
-if(!dojo._hasResource["dojox.validate.creditCard"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.creditCard"] = true;
-dojo.provide("dojox.validate.creditCard");
-
-dojo.require("dojox.validate._base");
-
-/*
- Validates Credit Cards using account number rules in conjunction with the Luhn algorigthm
-
- */
-
-dojox.validate.isValidCreditCard = function(/*String|Int*/value, /*String*/ccType){
- //Summary:
- // checks if ccType matches the # scheme in value, and if Luhn checksum is accurate (unless its an Enroute card, the checkSum is skipped)
-
- //Value: Boolean
- return ((ccType.toLowerCase() == 'er' || dojox.validate.isValidLuhn(value)) &&
- dojox.validate.isValidCreditCardNumber(value,ccType.toLowerCase())); //Boolean
-}
-
-dojox.validate.isValidCreditCardNumber = function(/*String|Int*/value,/*String?*/ccType){
- // summary:
- // checks if value matches the pattern for that card or any card types if none is specified
- //
- // value: Boolean
- // CC #, white spaces and dashes are ignored
- //
- // ccType: String?
- // one of the values in cardinfo -- if Omitted it it returns a | delimited string of matching card types, or false if no matches found
-
- value = String(value).replace(/[- ]/g,''); //ignore dashes and whitespaces
-
- /* FIXME: not sure on all the abbreviations for credit cards,below is what each stands for atleast to my knowledge
- mc: Mastercard
- ec: Eurocard
- vi: Visa
- ax: American Express
- dc: Diners Club
- bl: Carte Blanch
- di: Discover
- jcb: JCB
- er: Enroute
- */
- var cardinfo = {
- 'mc':'5[1-5][0-9]{14}','ec':'5[1-5][0-9]{14}','vi':'4(?:[0-9]{12}|[0-9]{15})',
- 'ax':'3[47][0-9]{13}', 'dc':'3(?:0[0-5][0-9]{11}|[68][0-9]{12})',
- 'bl':'3(?:0[0-5][0-9]{11}|[68][0-9]{12})','di':'6011[0-9]{12}',
- 'jcb':'(?:3[0-9]{15}|(2131|1800)[0-9]{11})','er':'2(?:014|149)[0-9]{11}'
- };
- if(ccType){
- var expr = cardinfo[ccType.toLowerCase()];
- return expr ? !!(value.match(cardinfo[ccType.toLowerCase()])) : false; // boolean
- }
- var results=[];
- for(var p in cardinfo){
- if(value.match('^'+cardinfo[p]+'$')){
- results.push(p);
- }
- }
- return results.length ? results.join('|') : false; // string | boolean
-}
-
-dojox.validate.isValidCvv = function(/*String|Int*/value, /*String*/ccType) {
- //Summary:
- // returns true if the security code (CCV) matches the correct format for supplied ccType
-
- //Value: Boolean
-
- if(typeof value!='string'){
- value=String(value);
- }
- var format;
- switch (ccType.toLowerCase()){
- case 'mc':
- case 'ec':
- case 'vi':
- case 'di':
- format = '###';
- break;
- case 'ax':
- format = '####';
- break;
- default:
- return false; //Boolean
- }
- var flags = {format:format};
- //FIXME? Why does isNumberFormat take an object for flags when its only parameter is either a string or an array inside the object?
- //FIXME: um... just check value.length?
- return (value.length == format.length && dojox.validate.isNumberFormat(value, flags)); //Boolean
-}
-
-}
diff --git a/includes/js/dojox/validate/isbn.js b/includes/js/dojox/validate/isbn.js
deleted file mode 100644
index 030c7cf..0000000
--- a/includes/js/dojox/validate/isbn.js
+++ /dev/null
@@ -1,37 +0,0 @@
-if(!dojo._hasResource["dojox.validate.isbn"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.isbn"] = true;
-dojo.provide("dojox.validate.isbn");
-
-dojox.validate.isValidIsbn = function(/* String */value) {
- // summary: Vadlidate ISBN-10 or ISBN-13 based on the length of value
- // returns: Boolean
- var len, sum, weight;
- if(typeof value!='string'){
- value = String(value);
- }
- value = value.replace(/[- ]/g,''); //ignore dashes and whitespaces
- len = value.length;
- sum = 0;
- if(len == 10){
- weight = 10;
- // ISBN-10 validation algorithm
- for(var i = 0; i< 9; i++){
- sum += parseInt(value.charAt(i)) * weight;
- weight --;
- }
- var t = value.charAt(9).toUpperCase();
- sum += t == 'X' ? 10 : parseInt(t);
- return sum % 11 == 0;
- }else if(len == 13) {
- weight = -1;
- for(var i=0; i< len; i++){
- sum += parseInt(value.charAt(i)) * (2 + weight);
- weight *= -1;
- }
- return sum % 10 == 0;
- }else{
- return false;
- }
-}
-
-}
diff --git a/includes/js/dojox/validate/regexp.js b/includes/js/dojox/validate/regexp.js
deleted file mode 100644
index 0924750..0000000
--- a/includes/js/dojox/validate/regexp.js
+++ /dev/null
@@ -1,331 +0,0 @@
-if(!dojo._hasResource["dojox.validate.regexp"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.regexp"] = true;
-dojo.provide("dojox.validate.regexp");
-
-dojo.require("dojo.regexp");
-
-// *** Regular Expression Generator does not entirely live here ***
-// FIXME: is this useful enough to be in /dojox/regexp/_base.js, or
-// should it respect namespace and be dojox.validate.regexp?
-// some say a generic regexp to match zipcodes and urls would be useful
-// others would say it's a spare tire.
-dojox.regexp = { ca: {}, us: {} };
-
-dojox.regexp.tld = function(/*Object?*/flags){
- // summary: Builds a RE that matches a top-level domain
- //
- // flags:
- // flags.allowCC Include 2 letter country code domains. Default is true.
- // flags.allowGeneric Include the generic domains. Default is true.
- // flags.allowInfra Include infrastructure domains. Default is true.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(typeof flags.allowCC != "boolean"){ flags.allowCC = true; }
- if(typeof flags.allowInfra != "boolean"){ flags.allowInfra = true; }
- if(typeof flags.allowGeneric != "boolean"){ flags.allowGeneric = true; }
-
- // Infrastructure top-level domain - only one at present
- var infraRE = "arpa";
-
- // Generic top-level domains RE.
- var genericRE =
- "aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|xxx|jobs|mobi|post";
-
- // Country Code top-level domains RE
- var ccRE =
- "ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|" +
- "bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|" +
- "ec|ee|eg|er|eu|es|et|fi|fj|fk|fm|fo|fr|ga|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|"
- +
- "gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|" +
- "la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|" +
- "my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|" +
- "re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sk|sl|sm|sn|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|" +
- "tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw";
-
- // Build top-level domain RE
- var a = [];
- if(flags.allowInfra){ a.push(infraRE); }
- if(flags.allowGeneric){ a.push(genericRE); }
- if(flags.allowCC){ a.push(ccRE); }
-
- var tldRE = "";
- if (a.length > 0) {
- tldRE = "(" + a.join("|") + ")";
- }
-
- return tldRE; // String
-}
-
-dojox.regexp.ipAddress = function(/*Object?*/flags){
- // summary: Builds a RE that matches an IP Address
- //
- // description:
- // Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal.
- // Supports 2 formats for Ipv6.
- //
- // flags An object. All flags are boolean with default = true.
- // flags.allowDottedDecimal Example, 207.142.131.235. No zero padding.
- // flags.allowDottedHex Example, 0x18.0x11.0x9b.0x28. Case insensitive. Zero padding allowed.
- // flags.allowDottedOctal Example, 0030.0021.0233.0050. Zero padding allowed.
- // flags.allowDecimal Example, 3482223595. A decimal number between 0-4294967295.
- // flags.allowHex Example, 0xCF8E83EB. Hexadecimal number between 0x0-0xFFFFFFFF.
- // Case insensitive. Zero padding allowed.
- // flags.allowIPv6 IPv6 address written as eight groups of four hexadecimal digits.
- // FIXME: ipv6 can be written multiple ways IIRC
- // flags.allowHybrid IPv6 address written as six groups of four hexadecimal digits
- // followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(typeof flags.allowDottedDecimal != "boolean"){ flags.allowDottedDecimal = true; }
- if(typeof flags.allowDottedHex != "boolean"){ flags.allowDottedHex = true; }
- if(typeof flags.allowDottedOctal != "boolean"){ flags.allowDottedOctal = true; }
- if(typeof flags.allowDecimal != "boolean"){ flags.allowDecimal = true; }
- if(typeof flags.allowHex != "boolean"){ flags.allowHex = true; }
- if(typeof flags.allowIPv6 != "boolean"){ flags.allowIPv6 = true; }
- if(typeof flags.allowHybrid != "boolean"){ flags.allowHybrid = true; }
-
- // decimal-dotted IP address RE.
- var dottedDecimalRE =
- // Each number is between 0-255. Zero padding is not allowed.
- "((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
-
- // dotted hex IP address RE. Each number is between 0x0-0xff. Zero padding is allowed, e.g. 0x00.
- var dottedHexRE = "(0[xX]0*[\\da-fA-F]?[\\da-fA-F]\\.){3}0[xX]0*[\\da-fA-F]?[\\da-fA-F]";
-
- // dotted octal IP address RE. Each number is between 0000-0377.
- // Zero padding is allowed, but each number must have at least 4 characters.
- var dottedOctalRE = "(0+[0-3][0-7][0-7]\\.){3}0+[0-3][0-7][0-7]";
-
- // decimal IP address RE. A decimal number between 0-4294967295.
- var decimalRE = "(0|[1-9]\\d{0,8}|[1-3]\\d{9}|4[01]\\d{8}|42[0-8]\\d{7}|429[0-3]\\d{6}|" +
- "4294[0-8]\\d{5}|42949[0-5]\\d{4}|429496[0-6]\\d{3}|4294967[01]\\d{2}|42949672[0-8]\\d|429496729[0-5])";
-
- // hexadecimal IP address RE.
- // A hexadecimal number between 0x0-0xFFFFFFFF. Case insensitive. Zero padding is allowed.
- var hexRE = "0[xX]0*[\\da-fA-F]{1,8}";
-
- // IPv6 address RE.
- // The format is written as eight groups of four hexadecimal digits, x:x:x:x:x:x:x:x,
- // where x is between 0000-ffff. Zero padding is optional. Case insensitive.
- var ipv6RE = "([\\da-fA-F]{1,4}\\:){7}[\\da-fA-F]{1,4}";
-
- // IPv6/IPv4 Hybrid address RE.
- // The format is written as six groups of four hexadecimal digits,
- // followed by the 4 dotted decimal IPv4 format. x:x:x:x:x:x:d.d.d.d
- var hybridRE = "([\\da-fA-F]{1,4}\\:){6}" +
- "((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.){3}(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";
-
- // Build IP Address RE
- var a = [];
- if(flags.allowDottedDecimal){ a.push(dottedDecimalRE); }
- if(flags.allowDottedHex){ a.push(dottedHexRE); }
- if(flags.allowDottedOctal){ a.push(dottedOctalRE); }
- if(flags.allowDecimal){ a.push(decimalRE); }
- if(flags.allowHex){ a.push(hexRE); }
- if(flags.allowIPv6){ a.push(ipv6RE); }
- if(flags.allowHybrid){ a.push(hybridRE); }
-
- var ipAddressRE = "";
- if(a.length > 0){
- ipAddressRE = "(" + a.join("|") + ")";
- }
- return ipAddressRE; // String
-}
-
-dojox.regexp.host = function(/*Object?*/flags){
- // summary: Builds a RE that matches a host
- // description: A host is a named host (A-z0-9_- but not starting with -), a domain name or an IP address, possibly followed by a port number.
- // flags: An object.
- // flags.allowNamed Allow a named host for local networks. Default is false.
- // flags.allowIP Allow an IP address for hostname. Default is true.
- // flags.allowLocal Allow the host to be "localhost". Default is false.
- // flags.allowPort Allow a port number to be present. Default is true.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(typeof flags.allowIP != "boolean"){ flags.allowIP = true; }
- if(typeof flags.allowLocal != "boolean"){ flags.allowLocal = false; }
- if(typeof flags.allowPort != "boolean"){ flags.allowPort = true; }
- if(typeof flags.allowNamed != "boolean"){ flags.allowNamed = false; }
-
- // Domain names can not end with a dash.
- var domainNameRE = "([0-9a-zA-Z]([-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?\\.)+" + dojox.regexp.tld(flags);
-
- // port number RE
- var portRE = flags.allowPort ? "(\\:\\d+)?" : "";
-
- // build host RE
- var hostNameRE = domainNameRE;
- if(flags.allowIP){ hostNameRE += "|" + dojox.regexp.ipAddress(flags); }
- if(flags.allowLocal){ hostNameRE += "|localhost"; }
- if(flags.allowNamed){ hostNameRE += "|^[^-][a-zA-Z0-9_-]*"; }
- return "(" + hostNameRE + ")" + portRE; // String
-}
-
-dojox.regexp.url = function(/*Object?*/flags){
- // summary: Builds a regular expression that matches a URL
- //
- // flags: An object
- // flags.scheme Can be true, false, or [true, false].
- // This means: required, not allowed, or match either one.
- // flags in regexp.host can be applied.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(!("scheme" in flags)){ flags.scheme = [true, false]; }
-
- // Scheme RE
- var protocolRE = dojo.regexp.buildGroupRE(flags.scheme,
- function(q){ if(q){ return "(https?|ftps?)\\://"; } return ""; }
- );
-
- // Path and query and anchor RE
- var pathRE = "(/([^?#\\s/]+/)*)?([^?#\\s/]+(\\?[^?#\\s/]*)?(#[A-Za-z][\\w.:-]*)?)?";
-
- return protocolRE + dojox.regexp.host(flags) + pathRE;
-}
-
-dojox.regexp.emailAddress = function(/*Object?*/flags){
-
- // summary: Builds a regular expression that matches an email address
- //
- //flags: An object
- // flags.allowCruft Allow address like <mailto:foo@yahoo.com>. Default is false.
- // flags in regexp.host can be applied.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if (typeof flags.allowCruft != "boolean") { flags.allowCruft = false; }
- flags.allowPort = false; // invalid in email addresses
-
- // user name RE - apostrophes are valid if there's not 2 in a row
- var usernameRE = "([\\da-zA-Z]+[-._+&'])*[\\da-zA-Z]+";
-
- // build emailAddress RE
- var emailAddressRE = usernameRE + "@" + dojox.regexp.host(flags);
-
- // Allow email addresses with cruft
- if ( flags.allowCruft ) {
- emailAddressRE = "<?(mailto\\:)?" + emailAddressRE + ">?";
- }
-
- return emailAddressRE; // String
-}
-
-dojox.regexp.emailAddressList = function(/*Object?*/flags){
- // summary: Builds a regular expression that matches a list of email addresses.
- //
- // flags: An object.
- // flags.listSeparator The character used to separate email addresses. Default is ";", ",", "\n" or " ".
- // flags in regexp.emailAddress can be applied.
- // flags in regexp.host can be applied.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(typeof flags.listSeparator != "string"){ flags.listSeparator = "\\s;,"; }
-
- // build a RE for an Email Address List
- var emailAddressRE = dojox.regexp.emailAddress(flags);
- var emailAddressListRE = "(" + emailAddressRE + "\\s*[" + flags.listSeparator + "]\\s*)*" +
- emailAddressRE + "\\s*[" + flags.listSeparator + "]?\\s*";
-
- return emailAddressListRE; // String
-}
-
-dojox.regexp.us.state = function(/*Object?*/flags){
- // summary: A regular expression to match US state and territory abbreviations
- //
- // flags An object.
- // flags.allowTerritories Allow Guam, Puerto Rico, etc. Default is true.
- // flags.allowMilitary Allow military 'states', e.g. Armed Forces Europe (AE). Default is true.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(typeof flags.allowTerritories != "boolean"){ flags.allowTerritories = true; }
- if(typeof flags.allowMilitary != "boolean"){ flags.allowMilitary = true; }
-
- // state RE
- var statesRE =
- "AL|AK|AZ|AR|CA|CO|CT|DE|DC|FL|GA|HI|ID|IL|IN|IA|KS|KY|LA|ME|MD|MA|MI|MN|MS|MO|MT|" +
- "NE|NV|NH|NJ|NM|NY|NC|ND|OH|OK|OR|PA|RI|SC|SD|TN|TX|UT|VT|VA|WA|WV|WI|WY";
-
- // territories RE
- var territoriesRE = "AS|FM|GU|MH|MP|PW|PR|VI";
-
- // military states RE
- var militaryRE = "AA|AE|AP";
-
- // Build states and territories RE
- if(flags.allowTerritories){ statesRE += "|" + territoriesRE; }
- if(flags.allowMilitary){ statesRE += "|" + militaryRE; }
-
- return "(" + statesRE + ")"; // String
-}
-
-dojox.regexp.ca.postalCode = function(){
- var postalRE =
- "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]";
- return "(" + postalRE + ")";
-}
-
-dojox.regexp.ca.province = function(){
- // summary: a regular expression to match Canadian Province Abbreviations
- var stateRE =
- "AB|BC|MB|NB|NL|NS|NT|NU|ON|PE|QC|SK|YT";
- return "(" + statesRE + ")";
-}
-
-dojox.regexp.numberFormat = function(/*Object?*/flags){
- // summary: Builds a regular expression to match any sort of number based format
- // description:
- // Use this method for phone numbers, social security numbers, zip-codes, etc.
- // The RE can match one format or one of multiple formats.
- //
- // Format
- // # Stands for a digit, 0-9.
- // ? Stands for an optional digit, 0-9 or nothing.
- // All other characters must appear literally in the expression.
- //
- // Example
- // "(###) ###-####" -> (510) 542-9742
- // "(###) ###-#### x#???" -> (510) 542-9742 x153
- // "###-##-####" -> 506-82-1089 i.e. social security number
- // "#####-####" -> 98225-1649 i.e. zip code
- //
- // flags: An object
- // flags.format A string or an Array of strings for multiple formats.
-
- // assign default values to missing paramters
- flags = (typeof flags == "object") ? flags : {};
- if(typeof flags.format == "undefined"){ flags.format = "###-###-####"; }
-
- // Converts a number format to RE.
- var digitRE = function(format){
- // escape all special characters, except '?'
- format = dojo.regexp.escapeString(format, "?");
-
- // Now replace '?' with Regular Expression
- format = format.replace(/\?/g, "\\d?");
-
- // replace # with Regular Expression
- format = format.replace(/#/g, "\\d");
-
- return format; // String
- };
-
- // build RE for multiple number formats
- return dojo.regexp.buildGroupRE(flags.format, digitRE); //String
-}
-
-}
diff --git a/includes/js/dojox/validate/tests/creditcard.js b/includes/js/dojox/validate/tests/creditcard.js
deleted file mode 100644
index bacb01e..0000000
--- a/includes/js/dojox/validate/tests/creditcard.js
+++ /dev/null
@@ -1,119 +0,0 @@
-if(!dojo._hasResource["dojox.validate.tests.creditcard"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.tests.creditcard"] = true;
-dojo.provide("dojox.validate.tests.creditcard");
-dojo.require("dojox.validate.creditCard");
-
-tests.register("dojox.validate.tests.creditcard",
- [{
- name:"isValidLuhn",
- runTests: function(tests) {
- tests.t(dojox.validate.isValidLuhn('5105105105105100')); //test string input
- tests.t(dojox.validate.isValidLuhn('5105-1051 0510-5100')); //test string input with dashes and spaces (commonly used when entering card #'s)
- tests.t(dojox.validate.isValidLuhn(38520000023237)); //test numerical input as well
- tests.f(dojox.validate.isValidLuhn(3852000002323)); //testing failures
- tests.t(dojox.validate.isValidLuhn(18)); //length doesnt matter
- tests.f(dojox.validate.isValidLuhn(818181)); //short length failure
- }
- },
- {
- name:"isValidCvv",
- runTests: function(tests) {
- tests.t(dojox.validate.isValidCvv('123','mc')); //string is ok
- tests.f(dojox.validate.isValidCvv('5AA','ec')); //invalid characters are not ok
- tests.t(dojox.validate.isValidCvv(723,'mc')); //numbers are ok too
- tests.f(dojox.validate.isValidCvv(7234,'mc')); //too long
- tests.t(dojox.validate.isValidCvv(612,'ec'));
- tests.t(dojox.validate.isValidCvv(421,'vi'));
- tests.t(dojox.validate.isValidCvv(543,'di'));
- tests.t(dojox.validate.isValidCvv('1234','ax'));
- tests.t(dojox.validate.isValidCvv(4321,'ax'));
- tests.f(dojox.validate.isValidCvv(43215,'ax')); //too long
- tests.f(dojox.validate.isValidCvv(215,'ax')); //too short
- }
- },
- {
- name:"isValidCreditCard",
- runTests: function(tests) {
- //misc checks
- tests.t(dojox.validate.isValidCreditCard('5105105105105100','mc')); //test string input
- tests.t(dojox.validate.isValidCreditCard('5105-1051 0510-5100','mc')); //test string input with dashes and spaces (commonly used when entering card #'s)
- tests.t(dojox.validate.isValidCreditCard(5105105105105100,'mc')); //test numerical input as well
- tests.f(dojox.validate.isValidCreditCard('5105105105105100','vi')); //fails, wrong card type
- //Mastercard/Eurocard checks
- tests.t(dojox.validate.isValidCreditCard('5105105105105100','mc'));
- tests.t(dojox.validate.isValidCreditCard('5204105105105100','ec'));
- tests.t(dojox.validate.isValidCreditCard('5303105105105100','mc'));
- tests.t(dojox.validate.isValidCreditCard('5402105105105100','ec'));
- tests.t(dojox.validate.isValidCreditCard('5501105105105100','mc'));
- //Visa card checks
- tests.t(dojox.validate.isValidCreditCard('4111111111111111','vi'));
- tests.t(dojox.validate.isValidCreditCard('4111111111010','vi'));
- //American Express card checks
- tests.t(dojox.validate.isValidCreditCard('378 2822 4631 0005','ax'));
- tests.t(dojox.validate.isValidCreditCard('341-1111-1111-1111','ax'));
- //Diners Club/Carte Blanch card checks
- tests.t(dojox.validate.isValidCreditCard('36400000000000','dc'));
- tests.t(dojox.validate.isValidCreditCard('38520000023237','bl'));
- tests.t(dojox.validate.isValidCreditCard('30009009025904','dc'));
- tests.t(dojox.validate.isValidCreditCard('30108009025904','bl'));
- tests.t(dojox.validate.isValidCreditCard('30207009025904','dc'));
- tests.t(dojox.validate.isValidCreditCard('30306009025904','bl'));
- tests.t(dojox.validate.isValidCreditCard('30405009025904','dc'));
- tests.t(dojox.validate.isValidCreditCard('30504009025904','bl'));
- //Discover card checks
- tests.t(dojox.validate.isValidCreditCard('6011111111111117','di'));
- //JCB card checks
- tests.t(dojox.validate.isValidCreditCard('3530111333300000','jcb'));
- tests.t(dojox.validate.isValidCreditCard('213100000000001','jcb'));
- tests.t(dojox.validate.isValidCreditCard('180000000000002','jcb'));
- tests.f(dojox.validate.isValidCreditCard('1800000000000002','jcb')); //should fail, good checksum, good prefix, but wrong length'
- //Enroute card checks
- tests.t(dojox.validate.isValidCreditCard('201400000000000','er'));
- tests.t(dojox.validate.isValidCreditCard('214900000000000','er'));
- }
- },
- {
- name:"isValidCreditCardNumber",
- runTests: function(tests) {
- //misc checks
- tests.t(dojox.validate.isValidCreditCardNumber('5105105105105100','mc')); //test string input
- tests.t(dojox.validate.isValidCreditCardNumber('5105-1051 0510-5100','mc')); //test string input with dashes and spaces (commonly used when entering card #'s)
- tests.t(dojox.validate.isValidCreditCardNumber(5105105105105100,'mc')); //test numerical input as well
- tests.f(dojox.validate.isValidCreditCardNumber('5105105105105100','vi')); //fails, wrong card type
- //Mastercard/Eurocard checks
- tests.is("mc|ec", dojox.validate.isValidCreditCardNumber('5100000000000000')); //should match 'mc|ec'
- tests.is("mc|ec", dojox.validate.isValidCreditCardNumber('5200000000000000')); //should match 'mc|ec'
- tests.is("mc|ec", dojox.validate.isValidCreditCardNumber('5300000000000000')); //should match 'mc|ec'
- tests.is("mc|ec", dojox.validate.isValidCreditCardNumber('5400000000000000')); //should match 'mc|ec'
- tests.is("mc|ec", dojox.validate.isValidCreditCardNumber('5500000000000000')); //should match 'mc|ec'
- tests.f(dojox.validate.isValidCreditCardNumber('55000000000000000')); //should fail, too long
- //Visa card checks
- tests.is("vi", dojox.validate.isValidCreditCardNumber('4111111111111111')); //should match 'vi'
- tests.is("vi", dojox.validate.isValidCreditCardNumber('4111111111010')); //should match 'vi'
- //American Express card checks
- tests.is("ax", dojox.validate.isValidCreditCardNumber('378 2822 4631 0005')); //should match 'ax'
- tests.is("ax", dojox.validate.isValidCreditCardNumber('341-1111-1111-1111')); //should match 'ax'
- //Diners Club/Carte Blanch card checks
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('36400000000000')); //should match 'dc|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('38520000023237')); //should match 'dc|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('30009009025904')); //should match 'di|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('30108009025904')); //should match 'di|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('30207009025904')); //should match 'di|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('30306009025904')); //should match 'di|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('30405009025904')); //should match 'di|bl'
- tests.is("dc|bl", dojox.validate.isValidCreditCardNumber('30504009025904')); //should match 'di|bl'
- //Discover card checks
- tests.is("di", dojox.validate.isValidCreditCardNumber('6011111111111117')); //should match 'di'
- //JCB card checks
- tests.is("jcb", dojox.validate.isValidCreditCardNumber('3530111333300000')); //should match 'jcb'
- tests.is("jcb", dojox.validate.isValidCreditCardNumber('213100000000001')); //should match 'jcb'
- tests.is("jcb", dojox.validate.isValidCreditCardNumber('180000000000002')); //should match 'jcb'
- tests.f(dojox.validate.isValidCreditCardNumber('1800000000000002')); //should fail, good checksum, good prefix, but wrong length'
- //Enroute card checks
- tests.is("er", dojox.validate.isValidCreditCardNumber('201400000000000')); //should match 'er'
- tests.is("er", dojox.validate.isValidCreditCardNumber('214900000000000')); //should match 'er'
- }
- }
-]);
-
-}
diff --git a/includes/js/dojox/validate/tests/module.js b/includes/js/dojox/validate/tests/module.js
deleted file mode 100644
index c04fe4f..0000000
--- a/includes/js/dojox/validate/tests/module.js
+++ /dev/null
@@ -1,14 +0,0 @@
-if(!dojo._hasResource["dojox.validate.tests.module"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.tests.module"] = true;
-dojo.provide("dojox.validate.tests.module");
-
-try{
- dojo.require("dojox.validate.tests.creditcard");
- dojo.require("dojox.validate.tests.validate");
-
-}catch(e){
- doh.debug(e);
- console.debug(e);
-}
-
-}
diff --git a/includes/js/dojox/validate/tests/runTests.html b/includes/js/dojox/validate/tests/runTests.html
deleted file mode 100644
index 390674c..0000000
--- a/includes/js/dojox/validate/tests/runTests.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
- <head>
- <title>Dijit Unit Test Runner</title>
- <meta http-equiv="REFRESH" content="0;url=../../../util/doh/runner.html?testModule=dojox.validate.tests.module"></HEAD>
- <BODY>
- Redirecting to D.O.H runner.
- </BODY>
-</HTML>
diff --git a/includes/js/dojox/validate/tests/validate.js b/includes/js/dojox/validate/tests/validate.js
deleted file mode 100644
index 2fb272f..0000000
--- a/includes/js/dojox/validate/tests/validate.js
+++ /dev/null
@@ -1,316 +0,0 @@
-if(!dojo._hasResource["dojox.validate.tests.validate"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.tests.validate"] = true;
-dojo.provide("dojox.validate.tests.validate");
-
-dojo.require("dojox.validate._base");
-dojo.require("dojox.validate.check");
-dojo.require("dojox.validate.us");
-dojo.require("dojox.validate.ca");
-dojo.require("dojox.validate.web");
-dojo.require("dojox.validate.isbn");
-
-tests.register("dojox.validate.tests.validate",
- [{
- name: "isText",
- runTest: function(tests){
- tests.t(dojox.validate.isValidIsbn('0596007590')); //test string input
- tests.t(dojox.validate.isValidIsbn('0-596-00759-0')); //test string input with dashes
- tests.f(dojox.validate.isValidIsbn(596007590)); //test numerical input as well
- tests.t(dojox.validate.isValidIsbn("960-425-059-0"));
- tests.t(dojox.validate.isValidIsbn(9604250590)); //test numerical input as well
- tests.t(dojox.validate.isValidIsbn('0-9752298-0-X')); // test string with X
- tests.t(dojox.validate.isValidIsbn('0-9752298-0-x'));
- tests.t(dojox.validate.isValidIsbn('097522980x'));
- tests.t(dojox.validate.isValidIsbn('097522980X'));
- tests.f(dojox.validate.isValidIsbn(596007598)); //testing failures
- tests.f(dojox.validate.isValidIsbn('059-600759-X')); //testing failures
- tests.f(dojox.validate.isValidIsbn('059600')); // too short
-
- tests.t(dojox.validate.isValidIsbn('9780596007591'));
- tests.t(dojox.validate.isValidIsbn('978-0-596 00759-1'));
- tests.t(dojox.validate.isValidIsbn(9780596007591));
- tests.f(dojox.validate.isValidIsbn('978059600759X'));
- tests.f(dojox.validate.isValidIsbn('978-3250-596 00759-1 '));
- tests.f(dojox.validate.isValidIsbn('3250-596 00759 '));
-
- tests.t(dojox.validate.isText(' x'));
- tests.t(dojox.validate.isText('x '));
- tests.t(dojox.validate.isText(' x '));
- tests.f(dojox.validate.isText(' '));
- tests.f(dojox.validate.isText(''));
-
- // test lengths
- tests.t(dojox.validate.isText('123456', {length: 6} ));
- tests.f(dojox.validate.isText('1234567', {length: 6} ));
- tests.t(dojox.validate.isText('1234567', {minlength: 6} ));
- tests.t(dojox.validate.isText('123456', {minlength: 6} ));
- tests.f(dojox.validate.isText('12345', {minlength: 6} ));
- tests.f(dojox.validate.isText('1234567', {maxlength: 6} ));
- tests.t(dojox.validate.isText('123456', {maxlength: 6} ));
- }
- },
- {
- name: "isIpAddress",
- runTest: function(tests){
- tests.t(dojox.validate.isIpAddress('24.17.155.40'));
- tests.f(dojox.validate.isIpAddress('024.17.155.040'));
- tests.t(dojox.validate.isIpAddress('255.255.255.255'));
- tests.f(dojox.validate.isIpAddress('256.255.255.255'));
- tests.f(dojox.validate.isIpAddress('255.256.255.255'));
- tests.f(dojox.validate.isIpAddress('255.255.256.255'));
- tests.f(dojox.validate.isIpAddress('255.255.255.256'));
-
- // test dotted hex
- tests.t(dojox.validate.isIpAddress('0x18.0x11.0x9b.0x28'));
- tests.f(dojox.validate.isIpAddress('0x18.0x11.0x9b.0x28', {allowDottedHex: false}) );
- tests.t(dojox.validate.isIpAddress('0x18.0x000000011.0x9b.0x28'));
- tests.t(dojox.validate.isIpAddress('0xff.0xff.0xff.0xff'));
- tests.f(dojox.validate.isIpAddress('0x100.0xff.0xff.0xff'));
-
- // test dotted octal
- tests.t(dojox.validate.isIpAddress('0030.0021.0233.0050'));
- tests.f(dojox.validate.isIpAddress('0030.0021.0233.0050', {allowDottedOctal: false}) );
- tests.t(dojox.validate.isIpAddress('0030.0000021.0233.00000050'));
- tests.t(dojox.validate.isIpAddress('0377.0377.0377.0377'));
- tests.f(dojox.validate.isIpAddress('0400.0377.0377.0377'));
- tests.f(dojox.validate.isIpAddress('0377.0378.0377.0377'));
- tests.f(dojox.validate.isIpAddress('0377.0377.0380.0377'));
- tests.f(dojox.validate.isIpAddress('0377.0377.0377.377'));
-
- // test decimal
- tests.t(dojox.validate.isIpAddress('3482223595'));
- tests.t(dojox.validate.isIpAddress('0'));
- tests.t(dojox.validate.isIpAddress('4294967295'));
- tests.f(dojox.validate.isIpAddress('4294967296'));
- tests.f(dojox.validate.isIpAddress('3482223595', {allowDecimal: false}));
-
- // test hex
- tests.t(dojox.validate.isIpAddress('0xCF8E83EB'));
- tests.t(dojox.validate.isIpAddress('0x0'));
- tests.t(dojox.validate.isIpAddress('0x00ffffffff'));
- tests.f(dojox.validate.isIpAddress('0x100000000'));
- tests.f(dojox.validate.isIpAddress('0xCF8E83EB', {allowHex: false}));
-
- // IPv6
- tests.t(dojox.validate.isIpAddress('fedc:BA98:7654:3210:FEDC:BA98:7654:3210'));
- tests.t(dojox.validate.isIpAddress('1080:0:0:0:8:800:200C:417A'));
- tests.f(dojox.validate.isIpAddress('1080:0:0:0:8:800:200C:417A', {allowIPv6: false}));
-
- // Hybrid of IPv6 and IPv4
- tests.t(dojox.validate.isIpAddress('0:0:0:0:0:0:13.1.68.3'));
- tests.t(dojox.validate.isIpAddress('0:0:0:0:0:FFFF:129.144.52.38'));
- tests.f(dojox.validate.isIpAddress('0:0:0:0:0:FFFF:129.144.52.38', {allowHybrid: false}));
-
- }
- },
- {
- name: "isUrlTest",
- runTest: function(tests){
-
- tests.t(dojox.validate.isUrl('www.yahoo.com'));
- tests.t(dojox.validate.isUrl('http://www.yahoo.com'));
- tests.t(dojox.validate.isUrl('https://www.yahoo.com'));
- tests.f(dojox.validate.isUrl('http://.yahoo.com'));
- tests.f(dojox.validate.isUrl('http://www.-yahoo.com'));
- tests.f(dojox.validate.isUrl('http://www.yahoo-.com'));
- tests.t(dojox.validate.isUrl('http://y-a---h-o-o.com'));
- tests.t(dojox.validate.isUrl('http://www.y.com'));
- tests.t(dojox.validate.isUrl('http://www.yahoo.museum'));
- tests.t(dojox.validate.isUrl('http://www.yahoo.co.uk'));
- tests.f(dojox.validate.isUrl('http://www.micro$oft.com'));
-
- tests.t(dojox.validate.isUrl('http://www.y.museum:8080'));
- tests.t(dojox.validate.isUrl('http://12.24.36.128:8080'));
- tests.f(dojox.validate.isUrl('http://12.24.36.128:8080', {allowIP: false} ));
- tests.t(dojox.validate.isUrl('www.y.museum:8080'));
- tests.f(dojox.validate.isUrl('www.y.museum:8080', {scheme: true} ));
- tests.t(dojox.validate.isUrl('localhost:8080', {allowLocal: true} ));
- tests.f(dojox.validate.isUrl('localhost:8080', {} ));
- tests.t(dojox.validate.isUrl('http://www.yahoo.com/index.html?a=12&b=hello%20world#anchor'));
- tests.f(dojox.validate.isUrl('http://www.yahoo.xyz'));
- tests.t(dojox.validate.isUrl('http://www.yahoo.com/index.html#anchor'));
- tests.t(dojox.validate.isUrl('http://cocoon.apache.org/2.1/'));
- }
- },
- {
- name: "isEmailAddress",
- runTest: function(tests) {
- tests.t(dojox.validate.isEmailAddress('x@yahoo.com'));
- tests.t(dojox.validate.isEmailAddress('x.y.z.w@yahoo.com'));
- tests.f(dojox.validate.isEmailAddress('x..y.z.w@yahoo.com'));
- tests.f(dojox.validate.isEmailAddress('x.@yahoo.com'));
- tests.t(dojox.validate.isEmailAddress('x@z.com'));
- tests.f(dojox.validate.isEmailAddress('x@yahoo.x'));
- tests.t(dojox.validate.isEmailAddress('x@yahoo.museum'));
- tests.t(dojox.validate.isEmailAddress("o'mally@yahoo.com"));
- tests.f(dojox.validate.isEmailAddress("'mally@yahoo.com"));
- tests.t(dojox.validate.isEmailAddress("fred&barney@stonehenge.com"));
- tests.f(dojox.validate.isEmailAddress("fred&&barney@stonehenge.com"));
-
- // local addresses
- tests.t(dojox.validate.isEmailAddress("fred&barney@localhost", {allowLocal: true} ));
- tests.f(dojox.validate.isEmailAddress("fred&barney@localhost"));
-
- // addresses with cruft
- tests.t(dojox.validate.isEmailAddress("mailto:fred&barney@stonehenge.com", {allowCruft: true} ));
- tests.t(dojox.validate.isEmailAddress("<fred&barney@stonehenge.com>", {allowCruft: true} ));
- tests.f(dojox.validate.isEmailAddress("mailto:fred&barney@stonehenge.com"));
- tests.f(dojox.validate.isEmailAddress("<fred&barney@stonehenge.com>"));
-
- // local addresses with cruft
- tests.t(dojox.validate.isEmailAddress("<mailto:fred&barney@localhost>", {allowLocal: true, allowCruft: true} ));
- tests.f(dojox.validate.isEmailAddress("<mailto:fred&barney@localhost>", {allowCruft: true} ));
- tests.f(dojox.validate.isEmailAddress("<mailto:fred&barney@localhost>", {allowLocal: true} ));
- }
- },
- {
- name: "isEmailsAddressList",
- runTest: function(tests) {
- tests.t(dojox.validate.isEmailAddressList(
- "x@yahoo.com \n x.y.z.w@yahoo.com ; o'mally@yahoo.com , fred&barney@stonehenge.com \n" )
- );
- tests.t(dojox.validate.isEmailAddressList(
- "x@yahoo.com \n x.y.z.w@localhost \n o'mally@yahoo.com \n fred&barney@localhost",
- {allowLocal: true} )
- );
- tests.f(dojox.validate.isEmailAddressList(
- "x@yahoo.com; x.y.z.w@localhost; o'mally@yahoo.com; fred&barney@localhost", {listSeparator: ";"} )
- );
- tests.t(dojox.validate.isEmailAddressList(
- "mailto:x@yahoo.com; <x.y.z.w@yahoo.com>; <mailto:o'mally@yahoo.com>; fred&barney@stonehenge.com",
- {allowCruft: true, listSeparator: ";"} )
- );
- tests.f(dojox.validate.isEmailAddressList(
- "mailto:x@yahoo.com; <x.y.z.w@yahoo.com>; <mailto:o'mally@yahoo.com>; fred&barney@stonehenge.com",
- {listSeparator: ";"} )
- );
- tests.t(dojox.validate.isEmailAddressList(
- "mailto:x@yahoo.com; <x.y.z.w@localhost>; <mailto:o'mally@localhost>; fred&barney@localhost",
- {allowLocal: true, allowCruft: true, listSeparator: ";"} )
- );
- }
- },
- {
- name: "getEmailAddressList",
- runTest: function(tests) {
- var list = "x@yahoo.com \n x.y.z.w@yahoo.com ; o'mally@yahoo.com , fred&barney@stonehenge.com";
- tests.is(4, dojox.validate.getEmailAddressList(list).length);
-
- var localhostList = "x@yahoo.com; x.y.z.w@localhost; o'mally@yahoo.com; fred&barney@localhost";
- tests.is(0, dojox.validate.getEmailAddressList(localhostList).length);
- tests.is(4, dojox.validate.getEmailAddressList(localhostList, {allowLocal: true} ).length);
- }
- },
- {
- name: "isInRangeInt",
- runTest: function(tests) {
- // test integers
- tests.f(dojox.validate.isInRange( '0', {min: 1, max: 100} ));
- tests.t(dojox.validate.isInRange( '1', {min: 1, max: 100} ));
- tests.f(dojox.validate.isInRange( '-50', {min: 1, max: 100} ));
- tests.t(dojox.validate.isInRange( '+50', {min: 1, max: 100} ));
- tests.t(dojox.validate.isInRange( '100', {min: 1, max: 100} ));
- tests.f(dojox.validate.isInRange( '101', {min: 1, max: 100} ));
- }
- },
- {
- name:"isInRangeReal",
- runTest: function(tests){
-
- tests.f(dojox.validate.isInRange( '0.9', {min: 1.0, max: 10.0} ));
- tests.t(dojox.validate.isInRange( '1.0', {min: 1.0, max: 10.0} ));
- tests.f(dojox.validate.isInRange( '-5.0', {min: 1.0, max: 10.0} ));
- tests.t(dojox.validate.isInRange( '+5.50', {min: 1.0, max: 10.0} ));
- tests.t(dojox.validate.isInRange( '10.0', {min: 1.0, max: 10.0} ));
- tests.f(dojox.validate.isInRange( '10.1', {min: 1.0, max: 10.0} ));
- tests.f(dojox.validate.isInRange( '5.566e28', {min: 5.567e28, max: 6.000e28} ));
- tests.t(dojox.validate.isInRange( '5.7e28', {min: 5.567e28, max: 6.000e28} ));
- tests.f(dojox.validate.isInRange( '6.00000001e28', {min: 5.567e28, max: 6.000e28} ));
- tests.f(dojox.validate.isInRange( '10.000.000,12345e-5', {decimal: ",", max: 10000000.1e-5} ));
- tests.f(dojox.validate.isInRange( '10.000.000,12345e-5', {decimal: ",", min: 10000000.2e-5} ));
- tests.t(dojox.validate.isInRange('1,500,000', {separator: ',', min: 0}));
- tests.f(dojox.validate.isInRange('1,500,000', {separator: ',', min: 1000, max: 20000}));
- }
- },
- {
-
- name:"isInRangeCurrency",
- runTest: function(test){
-
- tests.f(dojox.validate.isInRange('\u20AC123,456,789', {max: 123456788, symbol: '\u20AC'} ));
- tests.f(dojox.validate.isInRange('\u20AC123,456,789', { min: 123456790, symbol: '\u20AC'} ));
- tests.f(dojox.validate.isInRange('$123,456,789.07', { max: 123456789.06} ));
- tests.f(dojox.validate.isInRange('$123,456,789.07', { min: 123456789.08} ));
- tests.f(dojox.validate.isInRange('123.456.789,00 \u20AC', {max: 123456788, decimal: ",", symbol: '\u20AC'} ));
- tests.f(dojox.validate.isInRange('123.456.789,00 \u20AC', {min: 123456790, decimal: ",", symbol: '\u20AC'} ));
- tests.f(dojox.validate.isInRange('- T123 456 789-00', {decimal: "-", min:0} ));
- tests.t(dojox.validate.isInRange('\u20AC123,456,789', { max: 123456790, symbol: '\u20AC'} ));
- tests.t(dojox.validate.isInRange('$123,456,789.07', { min: 123456789.06} ));
- // test non number
- //tests.f("test25", dojox.validate.isInRange( 'a'));
- }
- },
- {
- name: "isUsPhoneNumber",
- runTest: function(tests) {
- tests.t(dojox.validate.us.isPhoneNumber('(111) 111-1111'));
- tests.t(dojox.validate.us.isPhoneNumber('(111) 111 1111'));
- tests.t(dojox.validate.us.isPhoneNumber('111 111 1111'));
- tests.t(dojox.validate.us.isPhoneNumber('111.111.1111'));
- tests.t(dojox.validate.us.isPhoneNumber('111-111-1111'));
- tests.t(dojox.validate.us.isPhoneNumber('111/111-1111'));
- tests.f(dojox.validate.us.isPhoneNumber('111 111-1111'));
- tests.f(dojox.validate.us.isPhoneNumber('111-1111'));
- tests.f(dojox.validate.us.isPhoneNumber('(111)-111-1111'));
-
- // test extensions
- tests.t(dojox.validate.us.isPhoneNumber('111-111-1111 x1'));
- tests.t(dojox.validate.us.isPhoneNumber('111-111-1111 x12'));
- tests.t(dojox.validate.us.isPhoneNumber('111-111-1111 x1234'));
- }
- },
- {
- name: "isUsSocialSecurityNumber",
- runTest: function(tests) {
- tests.t(dojox.validate.us.isSocialSecurityNumber('123-45-6789'));
- tests.t(dojox.validate.us.isSocialSecurityNumber('123 45 6789'));
- tests.t(dojox.validate.us.isSocialSecurityNumber('123456789'));
- tests.f(dojox.validate.us.isSocialSecurityNumber('123-45 6789'));
- tests.f(dojox.validate.us.isSocialSecurityNumber('12345 6789'));
- tests.f(dojox.validate.us.isSocialSecurityNumber('123-456789'));
- }
- },
- {
- name:"isUsZipCode",
- runTest: function(tests) {
- tests.t(dojox.validate.us.isZipCode('12345-6789'));
- tests.t(dojox.validate.us.isZipCode('12345 6789'));
- tests.t(dojox.validate.us.isZipCode('123456789'));
- tests.t(dojox.validate.us.isZipCode('12345'));
- }
- },
- {
- name:"isCaZipCode",
- runTest: function(tests) {
- tests.t(dojox.validate.ca.isPostalCode('A1Z 3F3'));
- tests.f(dojox.validate.ca.isPostalCode('1AZ 3F3'));
- tests.t(dojox.validate.ca.isPostalCode('a1z 3f3'));
- tests.f(dojox.validate.ca.isPostalCode('xxxxxx'));
- tests.t(dojox.validate.ca.isPostalCode('A1Z3F3'));
-
- }
- },
- {
- name:"isUsState",
- runTest: function(tests) {
- tests.t(dojox.validate.us.isState('CA'));
- tests.t(dojox.validate.us.isState('ne'));
- tests.t(dojox.validate.us.isState('PR'));
- tests.f(dojox.validate.us.isState('PR', {allowTerritories: false} ));
- tests.t(dojox.validate.us.isState('AA'));
- tests.f(dojox.validate.us.isState('AA', {allowMilitary: false} ));
- }
- }
-]);
-
-}
diff --git a/includes/js/dojox/validate/us.js b/includes/js/dojox/validate/us.js
deleted file mode 100644
index 531b96d..0000000
--- a/includes/js/dojox/validate/us.js
+++ /dev/null
@@ -1,67 +0,0 @@
-if(!dojo._hasResource["dojox.validate.us"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.us"] = true;
-dojo.provide("dojox.validate.us");
-dojo.require("dojox.validate._base");
-
-dojox.validate.us.isState = function(/*String*/value, /*Object?*/flags){
- // summary: Validates US state and territory abbreviations.
- //
- // value: A two character string
- // flags: An object
- // flags.allowTerritories Allow Guam, Puerto Rico, etc. Default is true.
- // flags.allowMilitary Allow military 'states', e.g. Armed Forces Europe (AE). Default is true.
-
- var re = new RegExp("^" + dojox.regexp.us.state(flags) + "$", "i");
- return re.test(value); // Boolean
-}
-
-dojox.validate.us.isPhoneNumber = function(/*String*/value){
- // summary: Validates 10 US digit phone number for several common formats
- // value: The telephone number string
-
- var flags = {
- format: [
- "###-###-####",
- "(###) ###-####",
- "(###) ### ####",
- "###.###.####",
- "###/###-####",
- "### ### ####",
- "###-###-#### x#???",
- "(###) ###-#### x#???",
- "(###) ### #### x#???",
- "###.###.#### x#???",
- "###/###-#### x#???",
- "### ### #### x#???",
- "##########"
- ]
- };
- return dojox.validate.isNumberFormat(value, flags); // Boolean
-}
-
-dojox.validate.us.isSocialSecurityNumber = function(/*String*/value){
- // summary: Validates social security number
- var flags = {
- format: [
- "###-##-####",
- "### ## ####",
- "#########"
- ]
- };
- return dojox.validate.isNumberFormat(value, flags); // Boolean
-}
-
-dojox.validate.us.isZipCode = function(/*String*/value){
- // summary: Validates U.S. zip-code
- var flags = {
- format: [
- "#####-####",
- "##### ####",
- "#########",
- "#####"
- ]
- };
- return dojox.validate.isNumberFormat(value, flags); // Boolean
-}
-
-}
diff --git a/includes/js/dojox/validate/web.js b/includes/js/dojox/validate/web.js
deleted file mode 100644
index c6d7a45..0000000
--- a/includes/js/dojox/validate/web.js
+++ /dev/null
@@ -1,89 +0,0 @@
-if(!dojo._hasResource["dojox.validate.web"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
-dojo._hasResource["dojox.validate.web"] = true;
-dojo.provide("dojox.validate.web");
-dojo.require("dojox.validate._base");
-
-dojox.validate.isIpAddress = function(/*String*/value, /*Object?*/flags) {
- // summary: Validates an IP address
- //
- // description:
- // Supports 5 formats for IPv4: dotted decimal, dotted hex, dotted octal, decimal and hexadecimal.
- // Supports 2 formats for Ipv6.
- //
- // value A string.
- // flags An object. All flags are boolean with default = true.
- // flags.allowDottedDecimal Example, 207.142.131.235. No zero padding.
- // flags.allowDottedHex Example, 0x18.0x11.0x9b.0x28. Case insensitive. Zero padding allowed.
- // flags.allowDottedOctal Example, 0030.0021.0233.0050. Zero padding allowed.
- // flags.allowDecimal Example, 3482223595. A decimal number between 0-4294967295.
- // flags.allowHex Example, 0xCF8E83EB. Hexadecimal number between 0x0-0xFFFFFFFF.
- // Case insensitive. Zero padding allowed.
- // flags.allowIPv6 IPv6 address written as eight groups of four hexadecimal digits.
- // flags.allowHybrid IPv6 address written as six groups of four hexadecimal digits
- // followed by the usual 4 dotted decimal digit notation of IPv4. x:x:x:x:x:x:d.d.d.d
-
- var re = new RegExp("^" + dojox.regexp.ipAddress(flags) + "$", "i");
- return re.test(value); // Boolean
-}
-
-
-dojox.validate.isUrl = function(/*String*/value, /*Object?*/flags) {
- // summary: Checks if a string could be a valid URL
- // value: A string
- // flags: An object
- // flags.scheme Can be true, false, or [true, false].
- // This means: required, not allowed, or either.
- // flags in regexp.host can be applied.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- var re = new RegExp("^" + dojox.regexp.url(flags) + "$", "i");
- return re.test(value); // Boolean
-}
-
-dojox.validate.isEmailAddress = function(/*String*/value, /*Object?*/flags) {
- // summary: Checks if a string could be a valid email address
- //
- // value: A string
- // flags: An object
- // flags.allowCruft Allow address like <mailto:foo@yahoo.com>. Default is false.
- // flags in regexp.host can be applied.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- var re = new RegExp("^" + dojox.regexp.emailAddress(flags) + "$", "i");
- return re.test(value); // Boolean
-}
-
-dojox.validate.isEmailAddressList = function(/*String*/value, /*Object?*/flags) {
- // summary: Checks if a string could be a valid email address list.
- //
- // value A string.
- // flags An object.
- // flags.listSeparator The character used to separate email addresses. Default is ";", ",", "\n" or " ".
- // flags in regexp.emailAddress can be applied.
- // flags in regexp.host can be applied.
- // flags in regexp.ipAddress can be applied.
- // flags in regexp.tld can be applied.
-
- var re = new RegExp("^" + dojox.regexp.emailAddressList(flags) + "$", "i");
- return re.test(value); // Boolean
-}
-
-dojox.validate.getEmailAddressList = function(/*String*/value, /*Object?*/flags) {
- // summary: Check if value is an email address list. If an empty list
- // is returned, the value didn't pass the test or it was empty.
- //
- // value: A string
- // flags: An object (same as dojo.validate.isEmailAddressList)
-
- if(!flags) { flags = {}; }
- if(!flags.listSeparator) { flags.listSeparator = "\\s;,"; }
-
- if ( dojox.validate.isEmailAddressList(value, flags) ) {
- return value.split(new RegExp("\\s*[" + flags.listSeparator + "]\\s*")); // Array
- }
- return []; // Array
-}
-
-}