1 <?xml version=
"1.0" encoding=
"utf-8"?>
8 The primary goals of this format is to allow a simple XML format
9 that is mostly human readable. The generation and parsing of the
10 various data types are done through the TypeConverter classes
11 associated with the data types.
15 ... ado.net/XML headers & schema ...
16 <resheader name="resmimetype">text/microsoft-resx</resheader>
17 <resheader name="version">2.0</resheader>
18 <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19 <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20 <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21 <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22 <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23 <value>[base64 mime encoded serialized .NET Framework object]</value>
25 <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26 <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27 <comment>This is a comment</comment>
30 There are any number of "resheader" rows that contain simple
33 Each data row contains a name, and value. The row also contains a
34 type or mimetype. Type corresponds to a .NET class that support
35 text/value conversion through the TypeConverter architecture.
36 Classes that don't support this are serialized and stored with the
39 The mimetype is used for serialized objects, and tells the
40 ResXResourceReader how to depersist the object. This is currently not
41 extensible. For a given mimetype the value must be set accordingly:
43 Note - application/x-microsoft.net.object.binary.base64 is the format
44 that the ResXResourceWriter will generate, however the reader can
45 read any of the formats listed below.
47 mimetype: application/x-microsoft.net.object.binary.base64
48 value : The object must be serialized with
49 : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50 : and then encoded with base64 encoding.
52 mimetype: application/x-microsoft.net.object.soap.base64
53 value : The object must be serialized with
54 : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55 : and then encoded with base64 encoding.
57 mimetype: application/x-microsoft.net.object.bytearray.base64
58 value : The object must be serialized into a byte array
59 : using a System.ComponentModel.TypeConverter
60 : and then encoded with base64 encoding.
62 <xsd:schema id=
"root" xmlns=
"" xmlns:
xsd=
"http://www.w3.org/2001/XMLSchema" xmlns:
msdata=
"urn:schemas-microsoft-com:xml-msdata">
63 <xsd:import namespace=
"http://www.w3.org/XML/1998/namespace" />
64 <xsd:element name=
"root" msdata:
IsDataSet=
"true">
66 <xsd:choice maxOccurs=
"unbounded">
67 <xsd:element name=
"metadata">
70 <xsd:element name=
"value" type=
"xsd:string" minOccurs=
"0" />
72 <xsd:attribute name=
"name" use=
"required" type=
"xsd:string" />
73 <xsd:attribute name=
"type" type=
"xsd:string" />
74 <xsd:attribute name=
"mimetype" type=
"xsd:string" />
75 <xsd:attribute ref=
"xml:space" />
78 <xsd:element name=
"assembly">
80 <xsd:attribute name=
"alias" type=
"xsd:string" />
81 <xsd:attribute name=
"name" type=
"xsd:string" />
84 <xsd:element name=
"data">
87 <xsd:element name=
"value" type=
"xsd:string" minOccurs=
"0" msdata:
Ordinal=
"1" />
88 <xsd:element name=
"comment" type=
"xsd:string" minOccurs=
"0" msdata:
Ordinal=
"2" />
90 <xsd:attribute name=
"name" type=
"xsd:string" use=
"required" msdata:
Ordinal=
"1" />
91 <xsd:attribute name=
"type" type=
"xsd:string" msdata:
Ordinal=
"3" />
92 <xsd:attribute name=
"mimetype" type=
"xsd:string" msdata:
Ordinal=
"4" />
93 <xsd:attribute ref=
"xml:space" />
96 <xsd:element name=
"resheader">
99 <xsd:element name=
"value" type=
"xsd:string" minOccurs=
"0" msdata:
Ordinal=
"1" />
101 <xsd:attribute name=
"name" type=
"xsd:string" use=
"required" />
108 <resheader name=
"resmimetype">
109 <value>text/microsoft-resx
</value>
111 <resheader name=
"version">
114 <resheader name=
"reader">
115 <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
117 <resheader name=
"writer">
118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=
2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
120 <data name=
"jsfunctions" xml:
space=
"preserve">
124 function monorail_formhelper_numberonly(e, exceptions, forbidalso)
126 exceptions = exceptions.concat([
8,
9,
13,
38,
39,
40,
46]);
127 var code = e.charCode;
128 if (!code) code = e.keyCode;
129 if ((e.ctrlKey && code ==
118) || (e.ctrlKey && code ==
122))
133 if (e.ctrlKey || e.altKey) return true;
134 for(var i=
0; i < forbidalso.length; i++) if (forbidalso[i] == code) return false;
135 for(var i=
0; i < exceptions.length; i++) if (exceptions[i] == code) return true;
136 if (code <=
47 || code
> 57) return false;
140 function monorail_formhelper_inputfilter(e, forbid)
142 var code = e.charCode;
143 if (!code) code = e.keyCode;
144 for(var i=
0; i < forbid.length; i++) if (forbid[i] == code) return false;
148 The scripts on this page was produced by mordechai Sandhaus -
52action.com,
149 and is copyrighted . If you like this script, we encourage you to use it,
150 provided that include this note, and link to
52action.com.
153 function monorail_formhelper_getkeycode(e)
155 if( typeof( e.keyCode ) == 'number' )
159 else if( typeof( e.which ) == 'number' )
163 else if( typeof( e.charCode ) == 'number' )
173 function monorail_formhelper_getevent(e)
192 function monorail_formhelper_mask(e, elem,loc,delim)
194 e = monorail_formhelper_getevent(e);
195 var keycode = monorail_formhelper_getkeycode(e);
197 var locs = loc.split(',');
198 var str = elem.value;
200 for (var i =
0; i <= locs.length; i++)
202 for (var k =
0; k <= str.length; k++)
206 if (str.substring(k, k+
1) != delim)
210 str = str.substring(
0,k) + delim + str.substring(k,str.length);
220 * Really easy field validation with Prototype
221 * http://tetlaw.id.au/view/javascript/really-easy-field-validation
223 * Version
1.5.4.1 (
2007-
01-
05)
225 * Copyright (c)
2007 Andrew Tetlaw
226 * Permission is hereby granted, free of charge, to any person
227 * obtaining a copy of this software and associated documentation
228 * files (the
"Software"), to deal in the Software without
229 * restriction, including without limitation the rights to use, copy,
230 * modify, merge, publish, distribute, sublicense, and/or sell copies
231 * of the Software, and to permit persons to whom the Software is
232 * furnished to do so, subject to the following conditions:
234 * The above copyright notice and this permission notice shall be
235 * included in all copies or substantial portions of the Software.
237 * THE SOFTWARE IS PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND,
238 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
239 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
240 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
241 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
242 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
243 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
247 var Validator = Class.create();
249 Validator.prototype = {
250 initialize : function(className, error, test, options) {
251 if(typeof test == 'function'){
252 this.options = $H(options);
255 this.options = $H(test);
256 this._test = function(){return true};
258 this.error = error || 'Validation failed.';
259 this.className = className;
261 test : function(v, elm) {
262 return (this._test(v,elm) && this.options.all(function(p){
263 return Validator.methods[p.key] ? Validator.methods[p.key](v,elm,p.value) : true;
267 Validator.methods = {
268 pattern : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || opt.test(v)},
269 minLength : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || v.length
>= opt},
270 maxLength : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || v.length <= opt},
271 min : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || v
>= parseFloat(opt)},
272 max : function(v,elm,opt) {return Validation.get('IsEmpty').test(v) || v <= parseFloat(opt)},
273 notOneOf : function(v,elm,opt) {return $A(opt).all(function(value) {
276 oneOf : function(v,elm,opt) {return $A(opt).any(function(value) {
279 is : function(v,elm,opt) {return v == opt},
280 isNot : function(v,elm,opt) {return v != opt},
281 equalToField : function(v,elm,opt) {return v == $F(opt)},
282 notEqualToField : function(v,elm,opt) {return v != $F(opt)},
283 include : function(v,elm,opt) {return $A(opt).all(function(value) {
284 return Validation.get(value).test(v,elm);
288 var Validation = Class.create();
290 Validation.prototype = {
291 initialize : function(form, options){
292 this.options = Object.extend({
298 onFormValidate : function(result, form) {},
299 onElementValidate : function(result, elm) {}
302 if(this.options.onSubmit) Event.observe(this.form,'submit',this.onSubmit.bind(this),false);
303 if(this.options.immediate) {
304 var useTitles = this.options.useTitles;
305 var callback = this.options.onElementValidate;
306 Form.getElements(this.form).each(function(input) { // Thanks Mike!
307 Event.observe(input, 'blur', function(ev) { Validation.validate(Event.element(ev),{useTitle : useTitles, onElementValidate : callback}); });
311 onSubmit : function(ev){
312 if(!this.validate()) Event.stop(ev);
314 validate : function() {
316 var useTitles = this.options.useTitles;
317 var callback = this.options.onElementValidate;
318 if(this.options.stopOnFirst) {
319 result = Form.getElements(this.form).all(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); });
321 result = Form.getElements(this.form).collect(function(elm) { return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback}); }).all();
323 if(!result && this.options.focusOnError) {
324 Form.getElements(this.form).findAll(function(elm){return $(elm).hasClassName('validation-failed')}).first().focus()
326 this.options.onFormValidate(result, this.form);
330 Form.getElements(this.form).each(Validation.reset);
334 Object.extend(Validation, {
335 validate : function(elm, options){
336 options = Object.extend({
338 onElementValidate : function(result, elm) {}
341 var cn = elm.classNames();
342 return result = cn.all(function(value) {
343 var test = Validation.test(value,elm,options.useTitle);
344 options.onElementValidate(test, elm);
348 test : function(name, elm, useTitle) {
349 var v = Validation.get(name);
350 var prop = '__advice'+name.camelize();
352 if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
354 var advice = Validation.getAdvice(name, elm);
356 var errorMsg = useTitle ? ((elm && elm.title) ? elm.title : v.error) : v.error;
357 advice = '
<div class=
"validation-advice" id=
"advice-' + name + '-' + Validation.getElmID(elm) +'" style=
"display:none">' + errorMsg + '
</div>'
358 switch (elm.type.toLowerCase()) {
361 var p = elm.parentNode;
363 new Insertion.Bottom(p, advice);
365 new Insertion.After(elm, advice);
369 new Insertion.After(elm, advice);
371 advice = Validation.getAdvice(name, elm);
373 if(typeof Effect == 'undefined') {
374 advice.style.display = 'block';
376 new Effect.Appear(advice, {duration :
1 });
380 elm.removeClassName('validation-passed');
381 elm.addClassName('validation-failed');
384 var advice = Validation.getAdvice(name, elm);
385 if(advice != null) advice.hide();
387 elm.removeClassName('validation-failed');
388 elm.addClassName('validation-passed');
395 isVisible : function(elm) {
396 while(elm.tagName != 'BODY') {
397 if(!$(elm).visible()) return false;
398 elm = elm.parentNode;
402 getAdvice : function(name, elm) {
403 return $('advice-' + name + '-' + Validation.getElmID(elm)) || $('advice-' + Validation.getElmID(elm));
405 getElmID : function(elm) {
406 return elm.id ? elm.id : elm.name;
408 reset : function(elm) {
410 var cn = elm.classNames();
411 cn.each(function(value) {
412 var prop = '__advice'+value.camelize();
414 var advice = Validation.getAdvice(value, elm);
418 elm.removeClassName('validation-failed');
419 elm.removeClassName('validation-passed');
422 add : function(className, error, test, options) {
424 nv[className] = new Validator(className, error, test, options);
425 Object.extend(Validation.methods, nv);
427 addAllThese : function(validators) {
429 $A(validators).each(function(value) {
430 nv[value[
0]] = new Validator(value[
0], value[
1], value[
2], (value.length
> 3 ? value[
3] : {}));
432 Object.extend(Validation.methods, nv);
434 get : function(name) {
435 return Validation.methods[name] ? Validation.methods[name] : Validation.methods['_LikeNoIDIEverSaw_'];
438 '_LikeNoIDIEverSaw_' : new Validator('_LikeNoIDIEverSaw_','',{})
442 Validation.add('IsEmpty', '', function(v) {
443 return ((v == null) || (v.length ==
0)); // || /^\s+$/.test(v));
446 Validation.addAllThese([
447 ['required', 'This is a required field.', function(v) {
448 return !Validation.get('IsEmpty').test(v);
450 ['validate-number', 'Please enter a valid number in this field.', function(v) {
451 return Validation.get('IsEmpty').test(v) || (!isNaN(v) && !/^\s+$/.test(v));
453 ['validate-digits', 'Please use numbers only in this field. please avoid spaces or other characters such as dots or commas.', function(v) {
454 return Validation.get('IsEmpty').test(v) || !/[^\d]/.test(v);
456 ['validate-alpha', 'Please use letters only (a-z) in this field.', function (v) {
457 return Validation.get('IsEmpty').test(v) || /^[a-zA-Z]+$/.test(v)
459 ['validate-alphanum', 'Please use only letters (a-z) or numbers (
0-
9) only in this field. No spaces or other characters are allowed.', function(v) {
460 return Validation.get('IsEmpty').test(v) || !/\W/.test(v)
462 ['validate-date', 'Please enter a valid date.', function(v) {
463 var test = new Date(v);
464 return Validation.get('IsEmpty').test(v) || !isNaN(test);
466 ['validate-email', 'Please enter a valid email address. For example fred@domain.com .', function (v) {
467 return Validation.get('IsEmpty').test(v) || /\w{
1,}[@][\w\-]{
1,}([.]([\w\-]{
1,})){
1,
3}$/.test(v)
469 ['validate-url', 'Please enter a valid URL.', function (v) {
470 return Validation.get('IsEmpty').test(v) || /^(http|https|ftp):\/\/(([A-Z0-
9][A-Z0-
9_-]*)(\.[A-Z0-
9][A-Z0-
9_-]*)+)(:(\d+))?\/?/i.test(v)
472 ['validate-date-au', 'Please use this date format: dd/mm/yyyy. For example
17/
03/
2006 for the
17th of March,
2006.', function(v) {
473 if(Validation.get('IsEmpty').test(v)) return true;
474 var regex = /^(\d{
2})\/(\d{
2})\/(\d{
4})$/;
475 if(!regex.test(v)) return false;
476 var d = new Date(v.replace(regex, '$
2/$
1/$
3'));
477 return ( parseInt(RegExp.$
2,
10) == (
1+d.getMonth()) ) &&
478 (parseInt(RegExp.$
1,
10) == d.getDate()) &&
479 (parseInt(RegExp.$
3,
10) == d.getFullYear() );
481 ['validate-currency-dollar', 'Please enter a valid $ amount. For example $
100.00 .', function(v) {
482 // [$]
1[##][,###]+[.##]
486 return Validation.get('IsEmpty').test(v) || /^\$?\-?([
1-
9]{
1}[
0-
9]{
0,
2}(\,[
0-
9]{
3})*(\.[
0-
9]{
0,
2})?|[
1-
9]{
1}\d*(\.[
0-
9]{
0,
2})?|
0(\.[
0-
9]{
0,
2})?|(\.[
0-
9]{
1,
2})?)$/.test(v)
488 ['validate-selection', 'Please make a selection', function(v,elm){
489 return elm.options ? elm.selectedIndex
> 0 : !Validation.get('IsEmpty').test(v);
491 ['validate-one-required', 'Please select one of the above options.', function (v,elm) {
492 var p = elm.parentNode;
493 var options = p.getElementsByTagName('INPUT');
494 return $A(options).any(function(elm) {