You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ol...@apache.org on 2008/12/15 22:51:01 UTC

svn commit: r726819 [4/4] - in /continuum/trunk/continuum-webapp/src/main: resources/template/default/ webapp/WEB-INF/jsp/admin/ webapp/WEB-INF/jsp/decorators/ webapp/struts/ webapp/struts/dojo/ webapp/struts/dojo/debug/ webapp/struts/dojo/event/ webap...

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,261 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.string.extras");
+
+dojo.require("dojo.string.common");
+dojo.require("dojo.lang.common");
+dojo.require("dojo.lang.array");
+
+//TODO: should we use ${} substitution syntax instead, like widgets do?
+dojo.string.substituteParams = function(/*string*/template, /* object - optional or ... */hash){
+// summary:
+//	Performs parameterized substitutions on a string. Throws an exception if any parameter is unmatched.
+//
+// description:
+//	For example,
+//		dojo.string.substituteParams("File '%{0}' is not found in directory '%{1}'.","foo.html","/temp");
+//	returns
+//		"File 'foo.html' is not found in directory '/temp'."
+//
+// template: the original string template with %{values} to be replaced
+// hash: name/value pairs (type object) to provide substitutions.  Alternatively, substitutions may be
+//	included as arguments 1..n to this function, corresponding to template parameters 0..n-1
+
+	var map = (typeof hash == 'object') ? hash : dojo.lang.toArray(arguments, 1);
+
+	return template.replace(/\%\{(\w+)\}/g, function(match, key){
+		if(typeof(map[key]) != "undefined" && map[key] != null){
+			return map[key];
+		}
+		dojo.raise("Substitution not found: " + key);
+	}); // string
+};
+
+dojo.string.capitalize = function(/*string*/str){
+// summary:
+//	Uppercases the first letter of each word
+
+	if(!dojo.lang.isString(str)){ return ""; }
+	if(arguments.length == 0){ str = this; }
+
+	var words = str.split(' ');
+	for(var i=0; i<words.length; i++){
+		words[i] = words[i].charAt(0).toUpperCase() + words[i].substring(1);
+	}
+	return words.join(" "); // string
+}
+
+dojo.string.isBlank = function(/*string*/str){
+// summary:
+//	Return true if the entire string is whitespace characters
+
+	if(!dojo.lang.isString(str)){ return true; }
+	return (dojo.string.trim(str).length == 0); // boolean
+}
+
+//FIXME: not sure exactly what encodeAscii is trying to do, or if it's working right
+dojo.string.encodeAscii = function(/*string*/str){
+	if(!dojo.lang.isString(str)){ return str; } // unknown
+	var ret = "";
+	var value = escape(str);
+	var match, re = /%u([0-9A-F]{4})/i;
+	while((match = value.match(re))){
+		var num = Number("0x"+match[1]);
+		var newVal = escape("&#" + num + ";");
+		ret += value.substring(0, match.index) + newVal;
+		value = value.substring(match.index+match[0].length);
+	}
+	ret += value.replace(/\+/g, "%2B");
+	return ret; // string
+}
+
+dojo.string.escape = function(/*string*/type, /*string*/str){
+// summary:
+//	Adds escape sequences for special characters according to the convention of 'type'
+//
+// type: one of xml|html|xhtml|sql|regexp|regex|javascript|jscript|js|ascii
+// str: the string to be escaped
+
+	var args = dojo.lang.toArray(arguments, 1);
+	switch(type.toLowerCase()){
+		case "xml":
+		case "html":
+		case "xhtml":
+			return dojo.string.escapeXml.apply(this, args); // string
+		case "sql":
+			return dojo.string.escapeSql.apply(this, args); // string
+		case "regexp":
+		case "regex":
+			return dojo.string.escapeRegExp.apply(this, args); // string
+		case "javascript":
+		case "jscript":
+		case "js":
+			return dojo.string.escapeJavaScript.apply(this, args); // string
+		case "ascii":
+			// so it's encode, but it seems useful
+			return dojo.string.encodeAscii.apply(this, args); // string
+		default:
+			return str; // string
+	}
+}
+
+dojo.string.escapeXml = function(/*string*/str, /*boolean*/noSingleQuotes){
+//summary:
+//	Adds escape sequences for special characters in XML: &<>"'
+//  Optionally skips escapes for single quotes
+
+	str = str.replace(/&/gm, "&amp;").replace(/</gm, "&lt;")
+		.replace(/>/gm, "&gt;").replace(/"/gm, "&quot;");
+	if(!noSingleQuotes){ str = str.replace(/'/gm, "&#39;"); }
+	return str; // string
+}
+
+dojo.string.escapeSql = function(/*string*/str){
+//summary:
+//	Adds escape sequences for single quotes in SQL expressions
+
+	return str.replace(/'/gm, "''"); //string
+}
+
+dojo.string.escapeRegExp = function(/*string*/str){
+//summary:
+//	Adds escape sequences for special characters in regular expressions
+
+	return str.replace(/\\/gm, "\\\\").replace(/([\f\b\n\t\r[\^$|?*+(){}])/gm, "\\$1"); // string
+}
+
+//FIXME: should this one also escape backslash?
+dojo.string.escapeJavaScript = function(/*string*/str){
+//summary:
+//	Adds escape sequences for single and double quotes as well
+//	as non-visible characters in JavaScript string literal expressions
+
+	return str.replace(/(["'\f\b\n\t\r])/gm, "\\$1"); // string
+}
+
+//FIXME: looks a lot like escapeJavaScript, just adds quotes? deprecate one?
+dojo.string.escapeString = function(/*string*/str){
+//summary:
+//	Adds escape sequences for non-visual characters, double quote and backslash
+//	and surrounds with double quotes to form a valid string literal.
+	return ('"' + str.replace(/(["\\])/g, '\\$1') + '"'
+		).replace(/[\f]/g, "\\f"
+		).replace(/[\b]/g, "\\b"
+		).replace(/[\n]/g, "\\n"
+		).replace(/[\t]/g, "\\t"
+		).replace(/[\r]/g, "\\r"); // string
+}
+
+// TODO: make an HTML version
+dojo.string.summary = function(/*string*/str, /*number*/len){
+// summary:
+//	Truncates 'str' after 'len' characters and appends periods as necessary so that it ends with "..."
+
+	if(!len || str.length <= len){
+		return str; // string
+	}
+
+	return str.substring(0, len).replace(/\.+$/, "") + "..."; // string
+}
+
+dojo.string.endsWith = function(/*string*/str, /*string*/end, /*boolean*/ignoreCase){
+// summary:
+//	Returns true if 'str' ends with 'end'
+
+	if(ignoreCase){
+		str = str.toLowerCase();
+		end = end.toLowerCase();
+	}
+	if((str.length - end.length) < 0){
+		return false; // boolean
+	}
+	return str.lastIndexOf(end) == str.length - end.length; // boolean
+}
+
+dojo.string.endsWithAny = function(/*string*/str /* , ... */){
+// summary:
+//	Returns true if 'str' ends with any of the arguments[2 -> n]
+
+	for(var i = 1; i < arguments.length; i++) {
+		if(dojo.string.endsWith(str, arguments[i])) {
+			return true; // boolean
+		}
+	}
+	return false; // boolean
+}
+
+dojo.string.startsWith = function(/*string*/str, /*string*/start, /*boolean*/ignoreCase){
+// summary:
+//	Returns true if 'str' starts with 'start'
+
+	if(ignoreCase) {
+		str = str.toLowerCase();
+		start = start.toLowerCase();
+	}
+	return str.indexOf(start) == 0; // boolean
+}
+
+dojo.string.startsWithAny = function(/*string*/str /* , ... */){
+// summary:
+//	Returns true if 'str' starts with any of the arguments[2 -> n]
+
+	for(var i = 1; i < arguments.length; i++) {
+		if(dojo.string.startsWith(str, arguments[i])) {
+			return true; // boolean
+		}
+	}
+	return false; // boolean
+}
+
+dojo.string.has = function(/*string*/str /* , ... */) {
+// summary:
+//	Returns true if 'str' contains any of the arguments 2 -> n
+
+	for(var i = 1; i < arguments.length; i++) {
+		if(str.indexOf(arguments[i]) > -1){
+			return true; // boolean
+		}
+	}
+	return false; // boolean
+}
+
+dojo.string.normalizeNewlines = function(/*string*/text, /*string? (\n or \r)*/newlineChar){
+// summary:
+//	Changes occurences of CR and LF in text to CRLF, or if newlineChar is provided as '\n' or '\r',
+//	substitutes newlineChar for occurrences of CR/LF and CRLF
+
+	if (newlineChar == "\n"){
+		text = text.replace(/\r\n/g, "\n");
+		text = text.replace(/\r/g, "\n");
+	} else if (newlineChar == "\r"){
+		text = text.replace(/\r\n/g, "\r");
+		text = text.replace(/\n/g, "\r");
+	}else{
+		text = text.replace(/([^\r])\n/g, "$1\r\n").replace(/\r([^\n])/g, "\r\n$1");
+	}
+	return text; // string
+}
+
+dojo.string.splitEscaped = function(/*string*/str, /*string of length=1*/charac){
+// summary:
+//	Splits 'str' into an array separated by 'charac', but skips characters escaped with a backslash
+
+	var components = [];
+	for (var i = 0, prevcomma = 0; i < str.length; i++){
+		if (str.charAt(i) == '\\'){ i++; continue; }
+		if (str.charAt(i) == charac){
+			components.push(str.substring(prevcomma, i));
+			prevcomma = i + 1;
+		}
+	}
+	components.push(str.substr(prevcomma));
+	return components; // array
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/string/extras.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,18 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.kwCompoundRequire({
+	common: [
+		"dojo.text.String",
+		"dojo.text.Builder"
+	]
+});
+
+dojo.deprecated("dojo.text", "textDirectory moved to cal, text.String and text.Builder havne't been here for awhile", "0.5");

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/__package__.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,12 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.cal.textDirectory");
+dojo.deprecate("dojo.text.textDirectory", "use dojo.cal.textDirectory", "0.5");

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/text/textDirectory.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,12 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate");
+dojo.require("dojo.validate.common");

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,21 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.validate");
+dojo.kwCompoundRequire({
+	common:		["dojo.validate.check", 
+						"dojo.validate.datetime", 
+						"dojo.validate.de", 
+						"dojo.validate.jp", 
+						"dojo.validate.us", 
+						"dojo.validate.web" 
+	]
+});
+dojo.provide("dojo.validate.*");

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/__package__.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,263 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.check");
+dojo.require("dojo.validate.common");
+dojo.require("dojo.lang.common");
+
+dojo.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;
+		}
+	};
+
+	// 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(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(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(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(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(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.lang.isString(profile.required[i])){ continue; }
+			var elem = form[profile.required[i]];
+			// Are textbox, textarea, or password fields blank.
+			if((elem.type == "text" || elem.type == "textarea" || elem.type == "password") && /^\s*$/.test(elem.value)){	
+				missing[missing.length] = elem.name;
+			}
+			// Does drop-down box have option selected.
+			else if((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.lang.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(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.lang.isObject(profile.dependencies) || dojo.lang.isObject(profile.dependancies)){
+		if(profile["dependancies"]){
+			dojo.deprecated("dojo.validate.check", "profile 'dependancies' is deprecated, please use "
+							+ "'dependencies'", "0.5");
+			profile.dependencies=profile.dependancies;
+		}
+		// 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(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.lang.isObject(profile.constraints)){
+		// constraint properties are the names of fields to bevalidated
+		for(name in profile.constraints){
+			var elem = form[name];
+			if(	(elem.type != "text")&&
+				(elem.type != "textarea")&&
+				(elem.type != "password")){
+				continue;
+			}
+			// skip if blank - its optional unless required, in which case it
+			// is already listed as missing.
+			if(/^\s*$/.test(elem.value)){ continue; }
+
+			var isValid = true;
+			// case 1: constraint value is validation function
+			if(dojo.lang.isFunction(profile.constraints[name])){
+				isValid = profile.constraints[name](elem.value);
+			}else if(dojo.lang.isArray(profile.constraints[name])){
+				// handle nested arrays for multiple constraints
+				if(dojo.lang.isArray(profile.constraints[name][0])){
+					for (var i=0; i<profile.constraints[name].length; i++){
+						isValid = dojo.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 = dojo.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.lang.isObject(profile.confirm)){
+		for(name in profile.confirm){
+			var elem = form[name];	// the confirm element
+			var target = form[profile.confirm[name]];
+			if ( (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?
+dojo.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
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/check.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,248 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.common");
+
+dojo.require("dojo.regexp");
+
+
+dojo.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
+}
+
+dojo.validate.isInteger = function(/*String*/value, /*Object?*/flags){
+// summary:
+//	Validates whether a string is in an integer format
+//
+// value  A string
+// flags  {signed: Boolean|[true,false], separator: String}
+//    flags.signed  The leading plus-or-minus sign.  Can be true, false, or [true, false].
+//      Default is [true, false], (i.e. sign is optional).
+//    flags.separator  The character used as the thousands separator.  Default is no separator.
+//      For more than one symbol use an array, e.g. [",", ""], makes ',' optional.
+
+	var re = new RegExp("^" + dojo.regexp.integer(flags) + "$");
+	return re.test(value); // Boolean
+}
+
+dojo.validate.isRealNumber = function(/*String*/value, /*Object?*/flags){
+// summary:
+//	Validates whether a string is a real valued number. 
+//	Format is the usual exponential notation.
+//
+// value: A string
+// flags: {places: Number, decimal: String, exponent: Boolean|[true,false], eSigned: Boolean|[true,false], ...}
+//    flags.places  The integer number of decimal places.
+//      If not given, the decimal part is optional and the number of places is unlimited.
+//    flags.decimal  The character used for the decimal point.  Default is ".".
+//    flags.exponent  Express in exponential notation.  Can be true, false, or [true, false].
+//      Default is [true, false], (i.e. the exponential part is optional).
+//    flags.eSigned  The leading plus-or-minus sign on the exponent.  Can be true, false, 
+//      or [true, false].  Default is [true, false], (i.e. sign is optional).
+//    flags in regexp.integer can be applied.
+
+	var re = new RegExp("^" + dojo.regexp.realNumber(flags) + "$");
+	return re.test(value); // Boolean
+}
+
+dojo.validate.isCurrency = function(/*String*/value, /*Object?*/flags){
+// summary:
+//	Validates whether a string denotes a monetary value. 
+// value: A string
+// flags: {signed:Boolean|[true,false], symbol:String, placement:String, separator:String,
+//	fractional:Boolean|[true,false], decimal:String}
+//    flags.signed  The leading plus-or-minus sign.  Can be true, false, or [true, false].
+//      Default is [true, false], (i.e. sign is optional).
+//    flags.symbol  A currency symbol such as Yen "�", Pound "�", or the Euro sign "�".  
+//      Default is "$".  For more than one symbol use an array, e.g. ["$", ""], makes $ optional.
+//    flags.placement  The symbol can come "before" the number or "after".  Default is "before".
+//    flags.separator  The character used as the thousands separator. The default is ",".
+//    flags.fractional  The appropriate number of decimal places for fractional currency (e.g. cents)
+//      Can be true, false, or [true, false].  Default is [true, false], (i.e. cents are optional).
+//    flags.decimal  The character used for the decimal point.  Default is ".".
+
+	var re = new RegExp("^" + dojo.regexp.currency(flags) + "$");
+	return re.test(value); // Boolean
+}
+
+dojo.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 ".".
+
+	//stripping the seperator allows NaN to perform as expected, if no separator, we assume ','
+	//once i18n support is ready for this, instead of assuming, we default to i18n's recommended value
+	value = value.replace((dojo.lang.has(flags,'separator'))?flags.separator:',','');
+	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 : ".";
+	
+	// splice out anything not part of a number
+	var pattern = "[^" + dec + "\\deE+-]";
+	value = value.replace(RegExp(pattern, "g"), "");
+
+	// trim ends of things like e, E, or the decimal character
+	value = value.replace(/^([+-]?)(\D*)/, "$1");
+	value = value.replace(/(\D*)$/, "");
+
+	// replace decimal with ".". The minus sign '-' could be the decimal!
+	pattern = "(\\d)[" + dec + "](\\d)";
+	value = value.replace(RegExp(pattern, "g"), "$1.$2");
+
+	value = Number(value);
+	if ( value < min || value > max ) { return false; } // Boolean
+
+	return true; // Boolean
+}
+
+dojo.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("^" + dojo.regexp.numberFormat(flags) + "$", "i");
+	return re.test(value); // Boolean
+}
+
+dojo.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);
+}
+
+/**
+	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.
+
+*/

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/common.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,90 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide('dojo.validate.creditCard');
+
+dojo.require("dojo.lang.common");
+dojo.require("dojo.validate.common");
+
+/*
+	Validates Credit Cards using account number rules in conjunction with the Luhn algorightm
+	
+ */
+
+dojo.validate.isValidCreditCard = function(value,ccType){
+	//checks if type matches the # scheme, and if Luhn checksum is accurate (unless its an Enroute card, the checkSum is skipped)
+	if(value&&ccType&&((ccType.toLowerCase()=='er'||dojo.validate.isValidLuhn(value))&&(dojo.validate.isValidCreditCardNumber(value,ccType.toLowerCase())))){
+			return true;
+	}
+	return false;
+}
+dojo.validate.isValidCreditCardNumber = function(value,ccType) {
+	//only checks if the # matches the pattern for that card or any card types if none is specified
+	//value == CC #, white spaces and dashes are ignored
+	//ccType is of the values in cardinfo -- if Omitted it it returns a | delimited string of matching card types, or false if no matches found
+	if(typeof value!='string'){
+		value = String(value);
+	}
+	value = 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 results=[];
+	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&&dojo.lang.has(cardinfo,ccType.toLowerCase())){
+		return Boolean(value.match(cardinfo[ccType.toLowerCase()])); // boolean
+	}else{
+		for(var p in cardinfo){
+			if(value.match('^'+cardinfo[p]+'$')!=null){
+				results.push(p);
+			}
+		}
+		return (results.length)?results.join('|'):false; // string | boolean
+	}	
+}
+
+dojo.validate.isValidCvv = function(value, ccType) {
+	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;
+	}
+	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?
+	if ((value.length == format.length)&&(dojo.validate.isNumberFormat(value, flags))){
+		return true;
+	}
+	return false;
+}
\ No newline at end of file

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/creditCard.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,172 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.datetime");
+dojo.require("dojo.validate.common");
+
+/**
+  Validates a time value in any International format.
+  The value can be validated against one format or one of multiple formats.
+
+  Format
+  h        12 hour, no zero padding.
+  hh       12 hour, has leading zero.
+  H        24 hour, no zero padding.
+  HH       24 hour, has leading zero.
+  m        minutes, no zero padding.
+  mm       minutes, has leading zero.
+  s        seconds, no zero padding.
+  ss       seconds, has leading zero.
+  All other characters must appear literally in the expression.
+
+  Example
+    "h:m:s t"  ->   2:5:33 PM
+    "HH:mm:ss" ->  14:05:33
+
+  @param value  A string.
+  @param flags  An object.
+    flags.format  A string or an array of strings.  Default is "h:mm:ss t".
+    flags.amSymbol  The symbol used for AM.  Default is "AM".
+    flags.pmSymbol  The symbol used for PM.  Default is "PM".
+  @return  true or false
+*/
+dojo.validate.isValidTime = function(value, flags) {
+	dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
+	var re = new RegExp("^" + dojo.regexp.time(flags) + "$", "i");
+	return re.test(value);
+}
+
+/**
+  Validates 12-hour time format.
+  Zero-padding is not allowed for hours, required for minutes and seconds.
+  Seconds are optional.
+
+  @param value  A string.
+  @return  true or false
+*/
+dojo.validate.is12HourTime = function(value) {
+	dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
+	return dojo.validate.isValidTime(value, {format: ["h:mm:ss t", "h:mm t"]});
+}
+
+/**
+  Validates 24-hour military time format.
+  Zero-padding is required for hours, minutes, and seconds.
+  Seconds are optional.
+
+  @param value  A string.
+  @return  true or false
+*/
+dojo.validate.is24HourTime = function(value) {
+	dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
+	return dojo.validate.isValidTime(value, {format: ["HH:mm:ss", "HH:mm"]} );
+}
+
+/**
+  Returns true if the date conforms to the format given and is a valid date. Otherwise returns false.
+
+  @param dateValue  A string for the date.
+  @param format  A string, default is  "MM/DD/YYYY".
+  @return  true or false
+
+  Accepts any type of format, including ISO8601.
+  All characters in the format string are treated literally except the following tokens:
+
+  YYYY - matches a 4 digit year
+  M - matches a non zero-padded month
+  MM - matches a zero-padded month
+  D -  matches a non zero-padded date
+  DD -  matches a zero-padded date
+  DDD -  matches an ordinal date, 001-365, and 366 on leapyear
+  ww - matches week of year, 01-53
+  d - matches day of week, 1-7
+
+  Examples: These are all today's date.
+
+  Date          Format
+  2005-W42-3    YYYY-Www-d
+  2005-292      YYYY-DDD
+  20051019      YYYYMMDD
+  10/19/2005    M/D/YYYY
+  19.10.2005    D.M.YYYY
+*/
+dojo.validate.isValidDate = function(dateValue, format) {
+	dojo.deprecated("dojo.validate.datetime", "use dojo.date.parse instead", "0.5");
+	// Default is the American format
+	if (typeof format == "object" && typeof format.format == "string"){ format = format.format; }
+	if (typeof format != "string") { format = "MM/DD/YYYY"; }
+
+	// Create a literal regular expression based on format
+	var reLiteral = format.replace(/([$^.*+?=!:|\/\\\(\)\[\]\{\}])/g, "\\$1");
+
+	// Convert all the tokens to RE elements
+	reLiteral = reLiteral.replace( "YYYY", "([0-9]{4})" );
+	reLiteral = reLiteral.replace( "MM", "(0[1-9]|10|11|12)" );
+	reLiteral = reLiteral.replace( "M", "([1-9]|10|11|12)" );
+	reLiteral = reLiteral.replace( "DDD", "(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])" );
+	reLiteral = reLiteral.replace( "DD", "(0[1-9]|[12][0-9]|30|31)" );
+	reLiteral = reLiteral.replace( "D", "([1-9]|[12][0-9]|30|31)" );
+	reLiteral = reLiteral.replace( "ww", "(0[1-9]|[1-4][0-9]|5[0-3])" );
+	reLiteral = reLiteral.replace( "d", "([1-7])" );
+
+	// Anchor pattern to begining and end of string
+	reLiteral = "^" + reLiteral + "$";
+
+	// Dynamic RE that parses the original format given
+	var re = new RegExp(reLiteral);
+	
+	// Test if date is in a valid format
+	if (!re.test(dateValue))  return false;
+
+	// Parse date to get elements and check if date is valid
+	// Assume valid values for date elements not given.
+	var year = 0, month = 1, date = 1, dayofyear = 1, week = 1, day = 1;
+
+	// Capture tokens
+	var tokens = format.match( /(YYYY|MM|M|DDD|DD|D|ww|d)/g );
+
+	// Capture date values
+	var values = re.exec(dateValue);
+
+	// Match up tokens with date values
+	for (var i = 0; i < tokens.length; i++) {
+		switch (tokens[i]) {
+		case "YYYY":
+			year = Number(values[i+1]); break;
+		case "M":
+		case "MM":
+			month = Number(values[i+1]); break;
+		case "D":
+		case "DD":
+			date = Number(values[i+1]); break;
+		case "DDD":
+			dayofyear = Number(values[i+1]); break;
+		case "ww":
+			week = Number(values[i+1]); break;
+		case "d":
+			day = Number(values[i+1]); break;
+		}
+	}
+
+	// Leap years are divisible by 4, but not by 100, unless by 400
+	var leapyear = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
+
+	// 31st of a month with 30 days
+	if (date == 31 && (month == 4 || month == 6 || month == 9 || month == 11)) return false; 
+
+	// February 30th or 31st
+	if (date >= 30 && month == 2) return false; 
+
+	// February 29th outside a leap year
+	if (date == 29 && month == 2 && !leapyear) return false; 
+	if (dayofyear == 366 && !leapyear)  return false;
+
+	return true;
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/datetime.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,26 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.de");
+dojo.require("dojo.validate.common");
+
+dojo.validate.isGermanCurrency = function(/*String*/value) {
+	//summary: checks to see if 'value' is a valid representation of German currency (Euros)
+	var flags = {
+		symbol: "\u20AC",
+		placement: "after",
+		signPlacement: "begin", //TODO: this is really locale-dependent.  Will get fixed in v0.5 currency rewrite. 
+		decimal: ",",
+		separator: "."
+	};
+	return dojo.validate.isCurrency(value, flags); // Boolean
+}
+
+

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/de.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,23 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.jp");
+dojo.require("dojo.validate.common");
+
+dojo.validate.isJapaneseCurrency = function(/*String*/value) {
+	//summary: checks to see if 'value' is a valid representation of Japanese currency
+	var flags = {
+		symbol: "\u00a5",
+		fractional: false
+	};
+	return dojo.validate.isCurrency(value, flags); // Boolean
+}
+
+

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/jp.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,84 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.us");
+dojo.require("dojo.validate.common");
+
+dojo.validate.us.isCurrency = function(/*String*/value, /*Object?*/flags){
+	// summary: Validates U.S. currency
+	// value: the representation to check
+	// flags: flags in validate.isCurrency can be applied.
+	return dojo.validate.isCurrency(value, flags); // Boolean
+}
+
+
+dojo.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("^" + dojo.regexp.us.state(flags) + "$", "i");
+	return re.test(value); // Boolean
+}
+
+dojo.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 dojo.validate.isNumberFormat(value, flags); // Boolean
+}
+
+dojo.validate.us.isSocialSecurityNumber = function(/*String*/value){
+// summary: Validates social security number
+	var flags = {
+		format: [
+			"###-##-####",
+			"### ## ####",
+			"#########"
+		]
+	};
+
+	return dojo.validate.isNumberFormat(value, flags); // Boolean
+}
+
+dojo.validate.us.isZipCode = function(/*String*/value){
+// summary: Validates U.S. zip-code
+	var flags = {
+		format: [
+			"#####-####",
+			"##### ####",
+			"#########",
+			"#####"
+		]
+	};
+
+	return dojo.validate.isNumberFormat(value, flags); // Boolean
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/us.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,95 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.validate.web");
+dojo.require("dojo.validate.common");
+
+dojo.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("^" + dojo.regexp.ipAddress(flags) + "$", "i");
+	return re.test(value); // Boolean
+}
+
+
+dojo.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("^" + dojo.regexp.url(flags) + "$", "i");
+	return re.test(value); // Boolean
+}
+
+dojo.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 <ma...@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("^" + dojo.regexp.emailAddress(flags) + "$", "i");
+	return re.test(value); // Boolean
+}
+
+dojo.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("^" + dojo.regexp.emailAddressList(flags) + "$", "i");
+	return re.test(value); // Boolean
+}
+
+dojo.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 ( dojo.validate.isEmailAddressList(value, flags) ) {
+		return value.split(new RegExp("\\s*[" + flags.listSeparator + "]\\s*")); // Array
+	}
+	return []; // Array
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojo/validate/web.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,21 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+dojo.hostenv.writeIncludes(); // not needed, but allows the Venkman debugger to work with the includes
\ No newline at end of file

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/dojoRequire.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,183 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function moveSelectedOptions(objSourceElement, objTargetElement, toSort, notMove1, notMove2) {
+    var test1 = compile(notMove1);
+    var test2 = compile(notMove2);
+    moveOptions(objSourceElement, objTargetElement, toSort, 
+        function(opt) {
+            return (opt.selected && !test1(opt.value) && !test2(opt.value));
+        }
+    );
+}
+
+function moveAllOptions(objSourceElement, objTargetElement, toSort, notMove1, notMove2) {
+    var test1 = compile(notMove1);
+    var test2 = compile(notMove2);
+    moveOptions(objSourceElement, objTargetElement, toSort, 
+        function(opt) {
+            return (!test1(opt.value) && !test2(opt.value));
+        }
+    );
+}
+
+function compile(ptn) {
+    if (ptn != undefined) {
+    	if (ptn == '' || !window.RegExp) {
+            return function(val) { return val == ptn; }
+        } else {
+            var reg = new RegExp(ptn);
+            return function (val) { 
+                if (val == '') { // ignore empty option added by template 
+                	return true;
+                }
+            	return reg.test(val); }
+        }
+    }
+    return function(val) { return false; }
+}    
+
+function moveOptions(objSourceElement, objTargetElement, toSort, chooseFunc) {
+    var aryTempSourceOptions = new Array();
+    var aryTempTargetOptions = new Array();
+    var x = 0;
+
+    //looping through source element to find selected options
+    for (var i = 0; i < objSourceElement.length; i++) {
+        if (chooseFunc(objSourceElement.options[i])) {
+            //need to move this option to target element
+            var intTargetLen = objTargetElement.length++;
+            objTargetElement.options[intTargetLen].text =   objSourceElement.options[i].text;
+            objTargetElement.options[intTargetLen].value =  objSourceElement.options[i].value;
+        }
+        else {
+            //storing options that stay to recreate select element
+            var objTempValues = new Object();
+            objTempValues.text = objSourceElement.options[i].text;
+            objTempValues.value = objSourceElement.options[i].value;
+            aryTempSourceOptions[x] = objTempValues;
+            x++;
+        }
+    }
+
+    //sorting and refilling target list
+    for (var i = 0; i < objTargetElement.length; i++) {
+        var objTempValues = new Object();
+        objTempValues.text = objTargetElement.options[i].text;
+        objTempValues.value = objTargetElement.options[i].value;
+        aryTempTargetOptions[i] = objTempValues;
+    }
+    
+    if (toSort) {
+        aryTempTargetOptions.sort(sortByText);
+    }    
+    
+    for (var i = 0; i < objTargetElement.length; i++) {
+        objTargetElement.options[i].text = aryTempTargetOptions[i].text;
+        objTargetElement.options[i].value = aryTempTargetOptions[i].value;
+        objTargetElement.options[i].selected = false;
+    }   
+    
+    //resetting length of source
+    objSourceElement.length = aryTempSourceOptions.length;
+    //looping through temp array to recreate source select element
+    for (var i = 0; i < aryTempSourceOptions.length; i++) {
+        objSourceElement.options[i].text = aryTempSourceOptions[i].text;
+        objSourceElement.options[i].value = aryTempSourceOptions[i].value;
+        objSourceElement.options[i].selected = false;
+    }
+}
+
+function sortByText(a, b) {
+    if (a.text < b.text) {return -1}
+    if (a.text > b.text) {return 1}
+    return 0;
+}
+
+function selectAllOptionsExceptSome(objTargetElement, type, ptn) {
+    var test = compile(ptn);
+    for (var i = 0; i < objTargetElement.length; i++) {
+        var opt = objTargetElement.options[i];
+        if ((type == 'key' && !test(opt.value)) ||
+              (type == 'text' && !test(opt.text))) {
+            opt.selected = true;
+        } else {
+            opt.selected = false;
+        }    
+    }
+    return false;
+}
+
+function selectAllOptions(objTargetElement) {
+    for (var i = 0; i < objTargetElement.length; i++) {
+        if (objTargetElement.options[i].value != '') {
+            objTargetElement.options[i].selected = true;    
+        }    
+    }
+    return false;
+}
+
+function moveOptionUp(objTargetElement, type, ptn) {
+	var test = compile(ptn);
+	for (i=0; i<objTargetElement.length; i++) {
+		if (objTargetElement[i].selected) {
+			var v;
+			if (i != 0 && !objTargetElement[i-1].selected) {
+		    	if (type == 'key') {
+		    		v = objTargetElement[i-1].value
+		    	}
+		    	else {
+		    		v = objTargetElement[i-1].text;
+		    	}
+				if (!test(v)) {
+					swapOptions(objTargetElement,i,i-1);
+				}
+		    }
+		}
+	}
+}
+
+function moveOptionDown(objTargetElement, type, ptn) {
+	var test = compile(ptn);
+	for (i=(objTargetElement.length-1); i>= 0; i--) {
+		if (objTargetElement[i].selected) {
+			var v;
+			if ((i != (objTargetElement.length-1)) && !objTargetElement[i+1].selected) {
+		    	if (type == 'key') {
+		    		v = objTargetElement[i].value
+		    	}
+		    	else {
+		    		v = objTargetElement[i].text;
+		    	}
+				if (!test(v)) {
+					swapOptions(objTargetElement,i,i+1);
+				}
+		    }
+		}
+	}
+}
+
+function swapOptions(objTargetElement, first, second) {
+	var opt = objTargetElement.options;
+	var temp = new Option(opt[first].text, opt[first].value, opt[first].defaultSelected, opt[first].selected);
+	var temp2= new Option(opt[second].text, opt[second].value, opt[second].defaultSelected, opt[second].selected);
+	opt[first] = temp2;
+	opt[second] = temp;
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/optiontransferselect.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js?rev=726819&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js (added)
+++ continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js Mon Dec 15 13:50:59 2008
@@ -0,0 +1,135 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+function clearErrorMessages(form) {
+    clearErrorMessagesXHTML(form);
+}
+
+function clearErrorMessagesXHTML(form) {
+
+    // get field table
+    var table;
+    for (var i = 0; i < form.childNodes.length; i++) {
+        if (form.childNodes[i].tagName != null && form.childNodes[i].tagName.toLowerCase() == 'table') {
+            table = form.childNodes[i];
+            break;
+        }
+    }
+
+    if (table == null) {
+        return;
+    }
+
+    // clear out any rows with an "errorFor" attribute
+    var rows = table.rows;
+    if (rows == null){
+        return;
+    }
+
+    var rowsToDelete = new Array();
+    for(var i = 0; i < rows.length; i++) {
+        var r = rows[i];
+        // allow blank errorFor values on dojo markup
+        if (r.getAttribute("errorFor") != null) {
+            rowsToDelete.push(r);
+        }
+    }
+
+    // now delete the rows
+    for (var i = 0; i < rowsToDelete.length; i++) {
+        var r = rowsToDelete[i];
+        table.deleteRow(r.rowIndex);
+        //table.removeChild(rowsToDelete[i]); 
+    }
+}
+
+function clearErrorLabels(form) {
+    clearErrorLabelsXHTML(form);
+}
+
+function clearErrorLabelsXHTML(form) {
+    // set all labels back to the normal class
+    var elements = form.elements;
+    for (var i = 0; i < elements.length; i++) {
+
+        var parentEl = elements[i];
+        // search for the parent table row, abort if the form is reached
+        // the form may contain "non-wrapped" inputs inserted by Dojo
+        while (parentEl.nodeName.toUpperCase() != "TR" && parentEl.nodeName.toUpperCase() != "FORM") {
+            parentEl = parentEl.parentNode;
+        }
+        if (parentEl.nodeName.toUpperCase() == "FORM") {
+            parentEl = null;
+        }
+
+         //if labelposition is 'top' the label is on the row above
+        if(parentEl && parentEl.cells) {
+          var labelRow = parentEl.cells.length > 1 ? parentEl : StrutsUtils.previousElement(parentEl, "tr");
+          if (labelRow) {
+              var cells = labelRow.cells;
+              if (cells && cells.length >= 1) {
+                  var label = cells[0].getElementsByTagName("label")[0];
+                  if (label) {
+                      label.setAttribute("class", "label");
+                      label.setAttribute("className", "label"); //ie hack cause ie does not support setAttribute
+                  }
+              }
+          }
+        }
+    }
+
+}
+
+function addError(e, errorText) {
+    addErrorXHTML(e, errorText);
+}
+
+function addErrorXHTML(e, errorText) {
+    try {
+        var row = (e.type ? e : e[0]);
+        while(row.nodeName.toUpperCase() != "TR") {
+            row = row.parentNode;
+        }
+        var table = row.parentNode;
+        var error = document.createTextNode(errorText);
+        var tr = document.createElement("tr");
+        var td = document.createElement("td");
+        var span = document.createElement("span");
+        td.align = "center";
+        td.valign = "top";
+        td.colSpan = 2;
+        span.setAttribute("class", "errorMessage");
+        span.setAttribute("className", "errorMessage"); //ie hack cause ie does not support setAttribute
+        span.appendChild(error);
+        td.appendChild(span);
+        tr.appendChild(td);
+        tr.setAttribute("errorFor", e.id);
+        table.insertBefore(tr, row);
+
+        // update the label too
+        //if labelposition is 'top' the label is on the row above
+        var labelRow = row.cells.length > 1 ? row : StrutsUtils.previousElement(tr, "tr");
+        var label = labelRow.cells[0].getElementsByTagName("label")[0];
+        label.setAttribute("class", "errorLabel");
+        label.setAttribute("className", "errorLabel"); //ie hack cause ie does not support setAttribute
+    } catch (e) {
+        alert(e);
+    }
+}

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js
------------------------------------------------------------------------------
    svn:executable = *

Propchange: continuum/trunk/continuum-webapp/src/main/webapp/struts/validation.js
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision