Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | 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
 
11
dojo.provide("dojo.widget.DateTextbox");
12
dojo.require("dojo.widget.ValidationTextbox");
13
dojo.require("dojo.date.format");
14
dojo.require("dojo.validate.datetime");
15
dojo.widget.defineWidget("dojo.widget.DateTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
16
	dojo.widget.DateTextbox.superclass.mixInProperties.apply(this, arguments);
17
	if (localProperties.format) {
18
		this.flags.format = localProperties.format;
19
	}
20
}, isValid:function () {
21
	if (this.flags.format) {
22
		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);
24
	}
25
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"dateOnly", locale:this.lang, datePattern:this.displayFormat});
26
}});
27
dojo.widget.defineWidget("dojo.widget.TimeTextbox", dojo.widget.ValidationTextbox, {displayFormat:"", formatLength:"short", mixInProperties:function (localProperties) {
28
	dojo.widget.TimeTextbox.superclass.mixInProperties.apply(this, arguments);
29
	if (localProperties.format) {
30
		this.flags.format = localProperties.format;
31
	}
32
	if (localProperties.amsymbol) {
33
		this.flags.amSymbol = localProperties.amsymbol;
34
	}
35
	if (localProperties.pmsymbol) {
36
		this.flags.pmSymbol = localProperties.pmsymbol;
37
	}
38
}, isValid:function () {
39
	if (this.flags.format) {
40
		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);
42
	}
43
	return dojo.date.parse(this.textbox.value, {formatLength:this.formatLength, selector:"timeOnly", locale:this.lang, timePattern:this.displayFormat});
44
}});
45