diff options
author | wei <> | 2006-09-06 23:45:32 +0000 |
---|---|---|
committer | wei <> | 2006-09-06 23:45:32 +0000 |
commit | 8c45dcea7a12dac3b717478cc07010f5f19ad6d2 (patch) | |
tree | e39515d20fd09bd77a219c88358a956e8311755e /framework | |
parent | 4018d3ef83b81c021308f1c529d55497b2b89cea (diff) |
update triggered callbacks.
Diffstat (limited to 'framework')
5 files changed, 14 insertions, 12 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index 645df359..69652e6a 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -219,7 +219,7 @@ this.updateChoices(result);}});Prado.WebUI.TTimeTriggeredCallback=Base.extend({c this.onComplete=this.options.onComplete;Prado.WebUI.TTimeTriggeredCallback.register(this);},startTimer:function() {this.options.onComplete=this.onRequestComplete.bind(this);setTimeout(this.onTimerEvent.bind(this),200);},stopTimer:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.options.onComplete=undefined;clearTimeout(this.timer);this.timer=undefined;this.count=0;},onTimerEvent:function() -{this.options.params=this.timeout/1000;request=new Prado.CallbackRequest(this.options.ID,this.options);request.dispatch();},onRequestComplete:function() +{this.options.params=this.timeout/1000;request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();},onRequestComplete:function() {(this.onComplete||Prototype.emptyFunction).apply(this,arguments);this.timer=setTimeout(this.onTimerEvent.bind(this),this.getNewTimeout())},getNewTimeout:function() {switch(this.options.DecayType) {case'Exponential':t=(Math.exp(this.options.DecayRate*this.count*this.options.Interval))-1;break;case'Linear':t=this.options.DecayRate*this.count*this.options.Interval;break;case'Quadratic':t=this.options.DecayRate*this.count*this.count*this.options.Interval;break;case'Cubic':t=this.options.DecayRate*this.count*this.count*this.count*this.options.Interval;break;default:t=0;} @@ -237,7 +237,7 @@ Event.observe(element,this.getEventName(element),this.doCallback.bind(this));},g {switch(element.type.toLowerCase()) {case'password':case'text':case'textarea':case'select-one':case'select-multiple':return'change';}} return typeof(name)=="undefined"||name=="undefined"?'click':name;},doCallback:function(event) -{request=new Prado.CallbackRequest(this.options.ID,this.options);request.dispatch();if(this.options.StopEvent==true) +{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();if(this.options.StopEvent==true) Event.stop(event);}});Prado.WebUI.TValueTriggeredCallback=Base.extend({count:1,observing:true,constructor:function(options) {this.options=options;this.options.PropertyName=this.options.PropertyName||'value';element=$(options['ControlID']);this.value=element?element[this.options.PropertyName]:undefined;Prado.WebUI.TValueTriggeredCallback.register(this);this.startObserving();},stopObserving:function() {clearTimeout(this.timer);this.observing=false;},startObserving:function() @@ -248,7 +248,7 @@ Event.stop(event);}});Prado.WebUI.TValueTriggeredCallback=Base.extend({count:1,o else this.count=this.count+this.options.Decay;if(this.observing) this.time=setTimeout(this.checkChanges.bind(this),parseInt(this.options.Interval*1000*this.count));}},doCallback:function(oldValue,newValue) -{request=new Prado.CallbackRequest(this.options.ID,this.options);param={'OldValue':oldValue,'NewValue':newValue};request.setParameter(param);request.dispatch();}},{timers:{},register:function(timer) +{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);param={'OldValue':oldValue,'NewValue':newValue};request.setParameter(param);request.dispatch();}},{timers:{},register:function(timer) {this.timers[timer.options.ID]=timer;},stop:function(id) {if(this.timers[id]) this.timers[id].stopObserving();}});Prado.WebUI.TInPlaceTextBox=Base.extend({isSaving:false,isEditing:false,editField:null,constructor:function(options) diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js index 3ea8acce..7d99cb57 100644 --- a/framework/Web/Javascripts/js/debug/ajax.js +++ b/framework/Web/Javascripts/js/debug/ajax.js @@ -2147,7 +2147,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( onTimerEvent : function()
{
this.options.params = this.timeout/1000;
- request = new Prado.CallbackRequest(this.options.ID, this.options);
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
},
@@ -2255,7 +2255,7 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( doCallback : function(event)
{
- request = new Prado.CallbackRequest(this.options.ID, this.options);
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
if(this.options.StopEvent == true)
Event.stop(event);
@@ -2314,7 +2314,7 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( doCallback : function(oldValue, newValue)
{
- request = new Prado.CallbackRequest(this.options.ID, this.options);
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
param = {'OldValue' : oldValue, 'NewValue' : newValue};
request.setParameter(param);
request.dispatch();
diff --git a/framework/Web/Javascripts/prado/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols3.js index 01d8a41e..80c5fc67 100644 --- a/framework/Web/Javascripts/prado/activecontrols3.js +++ b/framework/Web/Javascripts/prado/activecontrols3.js @@ -159,7 +159,7 @@ Prado.WebUI.TTimeTriggeredCallback = Base.extend( onTimerEvent : function()
{
this.options.params = this.timeout/1000;
- request = new Prado.CallbackRequest(this.options.ID, this.options);
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
},
@@ -267,7 +267,7 @@ Prado.WebUI.TEventTriggeredCallback = Base.extend( doCallback : function(event)
{
- request = new Prado.CallbackRequest(this.options.ID, this.options);
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
if(this.options.StopEvent == true)
Event.stop(event);
@@ -326,7 +326,7 @@ Prado.WebUI.TValueTriggeredCallback = Base.extend( doCallback : function(oldValue, newValue)
{
- request = new Prado.CallbackRequest(this.options.ID, this.options);
+ request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
param = {'OldValue' : oldValue, 'NewValue' : newValue};
request.setParameter(param);
request.dispatch();
diff --git a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php index 176539b4..52106f1e 100644 --- a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php +++ b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php @@ -115,9 +115,10 @@ class TTimeTriggeredCallback extends TCallback /** * @return array list of timer options for client-side. */ - protected function getTimerOptions() + protected function getTriggerOptions() { $options['ID'] = $this->getClientID(); + $options['EventTarget']= $this->getUniqueID(); $options['Interval'] = $this->getInterval(); $options['DecayRate'] = $this->getDecayRate(); $options['DecayType'] = $this->getDecayType(); @@ -132,7 +133,7 @@ class TTimeTriggeredCallback extends TCallback { parent::render($writer); $this->getActiveControl()->registerCallbackClientScript( - $this->getClientClassName(), $this->getTimerOptions()); + $this->getClientClassName(), $this->getTriggerOptions()); } /** diff --git a/framework/Web/UI/ActiveControls/TTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTriggeredCallback.php index dc0ea869..b75d5fa9 100644 --- a/framework/Web/UI/ActiveControls/TTriggeredCallback.php +++ b/framework/Web/UI/ActiveControls/TTriggeredCallback.php @@ -61,7 +61,8 @@ abstract class TTriggeredCallback extends TCallback */
protected function getTriggerOptions()
{
- $options['ID'] = $this->getUniqueID();
+ $options['ID'] = $this->getClientID();
+ $options['EventTarget'] = $this->getUniqueID();
$options['ControlID'] = $this->getTargetControl();
return $options;
}
|