123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- if(!dojo._hasResource["dijit.form.CheckBox"]){
- dojo._hasResource["dijit.form.CheckBox"] = true;
- dojo.provide("dijit.form.CheckBox");
- dojo.require("dijit.form.ToggleButton");
- dojo.declare(
- "dijit.form.CheckBox",
- dijit.form.ToggleButton,
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- templateString: dojo.cache("dijit.form", "templates/CheckBox.html", "<div class=\"dijit dijitReset dijitInline\" role=\"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(/*Boolean*/ value){
- this._set("readOnly", value);
- dojo.attr(this.focusNode, 'readOnly', value);
- dijit.setWaiState(this.focusNode, "readonly", value);
- },
- _setValueAttr: function(/*String|Boolean*/ newValue, /*Boolean*/ priorityChange){
-
-
-
-
-
-
-
-
-
-
-
- if(typeof newValue == "string"){
- this._set("value", newValue);
- dojo.attr(this.focusNode, 'value', newValue);
- newValue = true;
- }
- if(this._created){
- this.set('checked', newValue, priorityChange);
- }
- },
- _getValueAttr: function(){
-
-
-
-
-
- return (this.checked ? this.value : false);
- },
-
-
- _setLabelAttr: undefined,
- postMixInProperties: function(){
- if(this.value == ""){
- this.value = "on";
- }
-
-
-
- this.checkedAttrSetting = this.checked ? "checked" : "";
- this.inherited(arguments);
- },
- _fillContent: function(/*DomNode*/ source){
-
-
- },
- reset: function(){
-
- this._hasBeenBlurred = false;
- this.set('checked', this.params.checked || false);
-
- this._set("value", this.params.value || "on");
- dojo.attr(this.focusNode, 'value', this.value);
- },
- _onFocus: function(){
- if(this.id){
- dojo.query("label[for='"+this.id+"']").addClass("dijitFocusedLabel");
- }
- this.inherited(arguments);
- },
- _onBlur: function(){
- if(this.id){
- dojo.query("label[for='"+this.id+"']").removeClass("dijitFocusedLabel");
- }
- this.inherited(arguments);
- },
- _onClick: function(/*Event*/ e){
-
-
-
- if(this.readOnly){
- dojo.stopEvent(e);
- return false;
- }
- return this.inherited(arguments);
- }
- }
- );
- dojo.declare(
- "dijit.form.RadioButton",
- dijit.form.CheckBox,
- {
-
-
- type: "radio",
- baseClass: "dijitRadio",
- _setCheckedAttr: function(/*Boolean*/ value){
-
- this.inherited(arguments);
- if(!this._created){ return; }
- if(value){
- var _this = this;
-
- dojo.query("INPUT[type=radio]", this.focusNode.form || dojo.doc).forEach(
- function(inputNode){
- if(inputNode.name == _this.name && inputNode != _this.focusNode && inputNode.form == _this.focusNode.form){
- var widget = dijit.getEnclosingWidget(inputNode);
- if(widget && widget.checked){
- widget.set('checked', false);
- }
- }
- }
- );
- }
- },
- _clicked: function(/*Event*/ e){
- if(!this.checked){
- this.set('checked', true);
- }
- }
- }
- );
- }
|