Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1372 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
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:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.widget.DateTextbox");
13
dojo.provide("dojo.widget.DateTextbox");
12
dojo.require("dojo.widget.ValidationTextbox");
14
dojo.require("dojo.widget.ValidationTextbox");
13
dojo.require("dojo.date.format");
15
dojo.require("dojo.date.format");
14
dojo.require("dojo.validate.datetime");
16
dojo.require("dojo.validate.datetime");
15
dojo.widget.defineWidget("dojo.widget.DateTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
17
dojo.widget.defineWidget("dojo.widget.DateTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
16
	dojo.widget.DateTextbox.superclass.mixInProperties.apply(this, arguments);
18
	dojo.widget.DateTextbox.superclass.mixInProperties.apply(this, arguments);
17
	if (localProperties.format) {
19
	if (localProperties.format) {
18
		this.flags.format = localProperties.format;
20
		this.flags.format = localProperties.format;
19
	}
21
	}
20
}, isValid:function () {
22
}, isValid:function () {
21
	if (this.flags.format) {
23
	if (this.flags.format) {
22
		dojo.deprecated("dojo.widget.DateTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5");
24
		dojo.deprecated("dojo.widget.DateTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5");
23
		return dojo.validate.isValidDate(this.textbox.value, this.flags.format);
25
		return dojo.validate.isValidDate(this.textbox.value, this.flags.format);
24
	}
26
	}
25
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"dateOnly", locale:this.lang, datePattern:this.displayFormat});
27
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"dateOnly", locale:this.lang, datePattern:this.displayFormat});
26
}});
28
}});
27
dojo.widget.defineWidget("dojo.widget.TimeTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
29
dojo.widget.defineWidget("dojo.widget.TimeTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
28
	dojo.widget.TimeTextbox.superclass.mixInProperties.apply(this, arguments);
30
	dojo.widget.TimeTextbox.superclass.mixInProperties.apply(this, arguments);
29
	if (localProperties.format) {
31
	if (localProperties.format) {
30
		this.flags.format = localProperties.format;
32
		this.flags.format = localProperties.format;
31
	}
33
	}
32
	if (localProperties.amsymbol) {
34
	if (localProperties.amsymbol) {
33
		this.flags.amSymbol = localProperties.amsymbol;
35
		this.flags.amSymbol = localProperties.amsymbol;
34
	}
36
	}
35
	if (localProperties.pmsymbol) {
37
	if (localProperties.pmsymbol) {
36
		this.flags.pmSymbol = localProperties.pmsymbol;
38
		this.flags.pmSymbol = localProperties.pmsymbol;
37
	}
39
	}
38
}, isValid:function () {
40
}, isValid:function () {
39
	if (this.flags.format) {
41
	if (this.flags.format) {
40
		dojo.deprecated("dojo.widget.TimeTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5");
42
		dojo.deprecated("dojo.widget.TimeTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5");
41
		return dojo.validate.isValidTime(this.textbox.value, this.flags);
43
		return dojo.validate.isValidTime(this.textbox.value, this.flags);
42
	}
44
	}
43
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"timeOnly", locale:this.lang, timePattern:this.displayFormat});
45
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"timeOnly", locale:this.lang, timePattern:this.displayFormat});
44
}});
46
}});
45
 
47