Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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.DateTextbox");
14
dojo.require("dojo.widget.ValidationTextbox");
15
dojo.require("dojo.date.format");
16
dojo.require("dojo.validate.datetime");
17
dojo.widget.defineWidget("dojo.widget.DateTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
18
	dojo.widget.DateTextbox.superclass.mixInProperties.apply(this, arguments);
19
	if (localProperties.format) {
20
		this.flags.format = localProperties.format;
21
	}
22
}, isValid:function () {
23
	if (this.flags.format) {
24
		dojo.deprecated("dojo.widget.DateTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5");
25
		return dojo.validate.isValidDate(this.textbox.value, this.flags.format);
26
	}
27
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"dateOnly", locale:this.lang, datePattern:this.displayFormat});
28
}});
29
dojo.widget.defineWidget("dojo.widget.TimeTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
30
	dojo.widget.TimeTextbox.superclass.mixInProperties.apply(this, arguments);
31
	if (localProperties.format) {
32
		this.flags.format = localProperties.format;
33
	}
34
	if (localProperties.amsymbol) {
35
		this.flags.amSymbol = localProperties.amsymbol;
36
	}
37
	if (localProperties.pmsymbol) {
38
		this.flags.pmSymbol = localProperties.pmsymbol;
39
	}
40
}, isValid:function () {
41
	if (this.flags.format) {
42
		dojo.deprecated("dojo.widget.TimeTextbox", "format attribute is deprecated; use displayFormat or formatLength instead", "0.5");
43
		return dojo.validate.isValidTime(this.textbox.value, this.flags);
44
	}
45
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"timeOnly", locale:this.lang, timePattern:this.displayFormat});
46
}});
47