1318 |
alexandre_ |
1 |
/*
|
|
|
2 |
Copyright (c) 2004-2006, The Dojo Foundation
|
|
|
3 |
All Rights Reserved.
|
|
|
4 |
|
|
|
5 |
Licensed under the Academic Free License version 2.1 or above OR the
|
|
|
6 |
modified BSD license. For more information on Dojo licensing, see:
|
|
|
7 |
|
|
|
8 |
http://dojotoolkit.org/community/licensing.shtml
|
|
|
9 |
*/
|
|
|
10 |
|
1422 |
alexandre_ |
11 |
|
|
|
12 |
|
1318 |
alexandre_ |
13 |
dojo.provide("dojo.widget.InternetTextbox");
|
|
|
14 |
dojo.require("dojo.widget.ValidationTextbox");
|
|
|
15 |
dojo.require("dojo.validate.web");
|
|
|
16 |
dojo.widget.defineWidget("dojo.widget.IpAddressTextbox", dojo.widget.ValidationTextbox, {mixInProperties:function (localProperties) {
|
|
|
17 |
dojo.widget.IpAddressTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
18 |
if (localProperties.allowdotteddecimal) {
|
|
|
19 |
this.flags.allowDottedDecimal = (localProperties.allowdotteddecimal == "true");
|
|
|
20 |
}
|
|
|
21 |
if (localProperties.allowdottedhex) {
|
|
|
22 |
this.flags.allowDottedHex = (localProperties.allowdottedhex == "true");
|
|
|
23 |
}
|
|
|
24 |
if (localProperties.allowdottedoctal) {
|
|
|
25 |
this.flags.allowDottedOctal = (localProperties.allowdottedoctal == "true");
|
|
|
26 |
}
|
|
|
27 |
if (localProperties.allowdecimal) {
|
|
|
28 |
this.flags.allowDecimal = (localProperties.allowdecimal == "true");
|
|
|
29 |
}
|
|
|
30 |
if (localProperties.allowhex) {
|
|
|
31 |
this.flags.allowHex = (localProperties.allowhex == "true");
|
|
|
32 |
}
|
|
|
33 |
if (localProperties.allowipv6) {
|
|
|
34 |
this.flags.allowIPv6 = (localProperties.allowipv6 == "true");
|
|
|
35 |
}
|
|
|
36 |
if (localProperties.allowhybrid) {
|
|
|
37 |
this.flags.allowHybrid = (localProperties.allowhybrid == "true");
|
|
|
38 |
}
|
|
|
39 |
}, isValid:function () {
|
|
|
40 |
return dojo.validate.isIpAddress(this.textbox.value, this.flags);
|
|
|
41 |
}});
|
|
|
42 |
dojo.widget.defineWidget("dojo.widget.UrlTextbox", dojo.widget.IpAddressTextbox, {mixInProperties:function (localProperties) {
|
|
|
43 |
dojo.widget.UrlTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
44 |
if (localProperties.scheme) {
|
|
|
45 |
this.flags.scheme = (localProperties.scheme == "true");
|
|
|
46 |
}
|
|
|
47 |
if (localProperties.allowip) {
|
|
|
48 |
this.flags.allowIP = (localProperties.allowip == "true");
|
|
|
49 |
}
|
|
|
50 |
if (localProperties.allowlocal) {
|
|
|
51 |
this.flags.allowLocal = (localProperties.allowlocal == "true");
|
|
|
52 |
}
|
|
|
53 |
if (localProperties.allowcc) {
|
|
|
54 |
this.flags.allowCC = (localProperties.allowcc == "true");
|
|
|
55 |
}
|
|
|
56 |
if (localProperties.allowgeneric) {
|
|
|
57 |
this.flags.allowGeneric = (localProperties.allowgeneric == "true");
|
|
|
58 |
}
|
|
|
59 |
}, isValid:function () {
|
|
|
60 |
return dojo.validate.isUrl(this.textbox.value, this.flags);
|
|
|
61 |
}});
|
|
|
62 |
dojo.widget.defineWidget("dojo.widget.EmailTextbox", dojo.widget.UrlTextbox, {mixInProperties:function (localProperties) {
|
|
|
63 |
dojo.widget.EmailTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
64 |
if (localProperties.allowcruft) {
|
|
|
65 |
this.flags.allowCruft = (localProperties.allowcruft == "true");
|
|
|
66 |
}
|
|
|
67 |
}, isValid:function () {
|
|
|
68 |
return dojo.validate.isEmailAddress(this.textbox.value, this.flags);
|
|
|
69 |
}});
|
|
|
70 |
dojo.widget.defineWidget("dojo.widget.EmailListTextbox", dojo.widget.EmailTextbox, {mixInProperties:function (localProperties) {
|
|
|
71 |
dojo.widget.EmailListTextbox.superclass.mixInProperties.apply(this, arguments);
|
|
|
72 |
if (localProperties.listseparator) {
|
|
|
73 |
this.flags.listSeparator = localProperties.listseparator;
|
|
|
74 |
}
|
|
|
75 |
}, isValid:function () {
|
|
|
76 |
return dojo.validate.isEmailAddressList(this.textbox.value, this.flags);
|
|
|
77 |
}});
|
|
|
78 |
|