]> git.wh0rd.org - tt-rss.git/blob - lib/dijit/form/CheckBox.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dijit / form / CheckBox.js
1 /*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5 */
6
7
8 if(!dojo._hasResource["dijit.form.CheckBox"]){
9 dojo._hasResource["dijit.form.CheckBox"]=true;
10 dojo.provide("dijit.form.CheckBox");
11 dojo.require("dijit.form.ToggleButton");
12 dojo.declare("dijit.form.CheckBox",dijit.form.ToggleButton,{templateString:dojo.cache("dijit.form","templates/CheckBox.html","<div class=\"dijit dijitReset dijitInline\" waiRole=\"presentation\"\n\t><input\n\t \t${!nameAttrSetting} type=\"${type}\" ${checkedAttrSetting}\n\t\tclass=\"dijitReset dijitCheckBoxInput\"\n\t\tdojoAttachPoint=\"focusNode\"\n\t \tdojoAttachEvent=\"onclick:_onClick\"\n/></div>\n"),baseClass:"dijitCheckBox",type:"checkbox",value:"on",readOnly:false,attributeMap:dojo.delegate(dijit.form._FormWidget.prototype.attributeMap,{readOnly:"focusNode"}),_setReadOnlyAttr:function(_1){
13 this.readOnly=_1;
14 dojo.attr(this.focusNode,"readOnly",_1);
15 dijit.setWaiState(this.focusNode,"readonly",_1);
16 },_setValueAttr:function(_2,_3){
17 if(typeof _2=="string"){
18 this.value=_2;
19 dojo.attr(this.focusNode,"value",_2);
20 _2=true;
21 }
22 if(this._created){
23 this.set("checked",_2,_3);
24 }
25 },_getValueAttr:function(){
26 return (this.checked?this.value:false);
27 },_setLabelAttr:undefined,postMixInProperties:function(){
28 if(this.value==""){
29 this.value="on";
30 }
31 this.checkedAttrSetting=this.checked?"checked":"";
32 this.inherited(arguments);
33 },_fillContent:function(_4){
34 },reset:function(){
35 this._hasBeenBlurred=false;
36 this.set("checked",this.params.checked||false);
37 this.value=this.params.value||"on";
38 dojo.attr(this.focusNode,"value",this.value);
39 },_onFocus:function(){
40 if(this.id){
41 dojo.query("label[for='"+this.id+"']").addClass("dijitFocusedLabel");
42 }
43 this.inherited(arguments);
44 },_onBlur:function(){
45 if(this.id){
46 dojo.query("label[for='"+this.id+"']").removeClass("dijitFocusedLabel");
47 }
48 this.inherited(arguments);
49 },_onClick:function(e){
50 if(this.readOnly){
51 return false;
52 }
53 return this.inherited(arguments);
54 }});
55 dojo.declare("dijit.form.RadioButton",dijit.form.CheckBox,{type:"radio",baseClass:"dijitRadio",_setCheckedAttr:function(_5){
56 this.inherited(arguments);
57 if(!this._created){
58 return;
59 }
60 if(_5){
61 var _6=this;
62 dojo.query("INPUT[type=radio]",this.focusNode.form||dojo.doc).forEach(function(_7){
63 if(_7.name==_6.name&&_7!=_6.focusNode&&_7.form==_6.focusNode.form){
64 var _8=dijit.getEnclosingWidget(_7);
65 if(_8&&_8.checked){
66 _8.set("checked",false);
67 }
68 }
69 });
70 }
71 },_clicked:function(e){
72 if(!this.checked){
73 this.set("checked",true);
74 }
75 }});
76 }