From e306989c6d03aac37e2557465b4812ea21970065 Mon Sep 17 00:00:00 2001 From: wei <> Date: Wed, 24 Jan 2007 05:52:22 +0000 Subject: Fixed #517, #519, #521 --- framework/Web/Javascripts/js/compressed/ajax.js | 3 ++- framework/Web/Javascripts/js/compressed/prado.js | 10 ++++++---- framework/Web/Javascripts/js/compressed/validator.js | 8 +++++--- 3 files changed, 13 insertions(+), 8 deletions(-) (limited to 'framework/Web/Javascripts/js/compressed') diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index ffc57483..5bf062d9 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -257,7 +257,8 @@ this.timer=setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000); {Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID]=timer;},start:function(id) {Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();},stop:function(id) {Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options) -{this.element=$(options.ID);this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));},doCallback:function(event) +{this.element=$(options.ID);if(this.element) +{this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));}},doCallback:function(event) {var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options) {this.options=options;var element=$(options['ControlID']);if(element) Event.observe(element,this.getEventName(element),this.doCallback.bind(this));},getEventName:function(element) diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js index e1c566e0..74e19278 100644 --- a/framework/Web/Javascripts/js/compressed/prado.js +++ b/framework/Web/Javascripts/js/compressed/prado.js @@ -346,8 +346,9 @@ elements[i].checked=true;}},checkIndices:function(elements,indices) {new Insertion.After(element,content);},before:function(element,content) {new Insertion.Before(element,content);}} Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={initialize:function(options) -{this._elementOnClick=null,this.element=$(options.ID);if(this.onInit) -this.onInit(options);},onInit:function(options) +{this._elementOnClick=null,this.element=$(options.ID);if(this.element) +{if(this.onInit) +this.onInit(options);}},onInit:function(options) {if(typeof(this.element.onclick)=="function") {this._elementOnClick=this.element.onclick;this.element.onclick=null;} Event.observe(this.element,"click",this.elementClicked.bindEvent(this,options));},elementClicked:function(event,options) @@ -369,8 +370,9 @@ if(y_input) {y_input.value=y;} else {y_input=INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});this.element.parentNode.appendChild(y_input);}}});Prado.WebUI.TRadioButton=Class.extend(Prado.WebUI.PostBackControl);Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(options) -{this.element=$(options['ID']);if(!this.element.checked) -this.onRadioButtonInitialize(options);}});Prado.WebUI.TTextBox=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options) +{this.element=$(options['ID']);if(this.element) +{if(!this.element.checked) +this.onRadioButtonInitialize(options);}}});Prado.WebUI.TTextBox=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options) {this.options=options;if(options['TextMode']!='MultiLine') Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));if(this.options['AutoPostBack']==true) Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,options));},handleReturnKey:function(e) diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js index 95081d50..a3b3f1cd 100644 --- a/framework/Web/Javascripts/js/compressed/validator.js +++ b/framework/Web/Javascripts/js/compressed/validator.js @@ -51,8 +51,9 @@ this.groups.push(validator.group);},addSummary:function(summary) {var inGroup=group&&summary.group==group;var noGroup=!group&&!summary.group;if(inGroup||noGroup) summary.updateSummary(validators,refresh);else summary.hideSummary(true);});}};Prado.WebUI.TValidationSummary=Class.create();Prado.WebUI.TValidationSummary.prototype={initialize:function(options) -{this.options=options;this.group=options.ValidationGroup;this.messages=$(options.ID);this.visible=this.messages.style.visibility!="hidden" -this.visible=this.visible&&this.messages.style.display!="none";Prado.Validation.addSummary(options.FormID,this);},updateSummary:function(validators,update) +{this.options=options;this.group=options.ValidationGroup;this.messages=$(options.ID);if(this.messages) +{this.visible=this.messages.style.visibility!="hidden" +this.visible=this.visible&&this.messages.style.display!="none";Prado.Validation.addSummary(options.FormID,this);}},updateSummary:function(validators,update) {if(validators.length<=0) {if(update||this.options.Refresh!=false) {return this.hideSummary(validators);} @@ -86,7 +87,8 @@ this.messages.show();this.visible=true;},formats:function(type) {switch(this.options.DisplayMode) {case"List":output+=messages[i]+"\n";break;case"BulletList":default:output+=" - "+messages[i]+"\n";break;case"SingleParagraph":output+=messages[i]+" ";break;}} return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={initialize:function(options) -{this.enabled=true;this.visible=false;this.isValid=true;this._isObserving={};this.group=null;this.requestDispatched=false;this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);},getErrorMessage:function() +{this.enabled=true;this.visible=false;this.isValid=true;this._isObserving={};this.group=null;this.requestDispatched=false;this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);if(this.control&&this.message) +{this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);}},getErrorMessage:function() {return this.options.ErrorMessage;},updateControl:function(focus) {this.refreshControlAndMessage();if(this.options.FocusOnError&&!this.isValid) Prado.Element.focus(this.options.FocusElementID);this.visible=true;},refreshControlAndMessage:function() -- cgit v1.2.3