summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js3
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js3
-rw-r--r--framework/Web/Javascripts/prado/ajax3.js3
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientSide.php17
-rw-r--r--framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php23
5 files changed, 48 insertions, 1 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index 32893e07..6bbb7a7c 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -94,7 +94,8 @@ Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackReque
tinyMCE.triggerSave();Object.extend(this.options,{postBody:this._getPostData(),parameters:''});if(this.options.CausesValidation&&typeof(Prado.Validation)!="undefined")
{var form=this.options.Form||Prado.Validation.getForm();if(Prado.Validation.validate(form,this.options.ValidationGroup,this)==false)
return false;}
-if(this.options.HasPriority)
+if(this.options.onPreDispatch)
+this.options.onPreDispatch(this,null);if(this.options.HasPriority)
return Prado.CallbackRequest.dispatchPriorityRequest(this);else
return Prado.CallbackRequest.dispatchNormalRequest(this);},_getPostData:function()
{var data={};var callback=Prado.CallbackRequest;if(this.options.PostInputs!=false)
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index 76c7e52a..a6c8db82 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -763,6 +763,9 @@ Prado.CallbackRequest.prototype =
return false;
}
+ if(this.options.onPreDispatch)
+ this.options.onPreDispatch(this,null);
+
if(this.options.HasPriority)
return Prado.CallbackRequest.dispatchPriorityRequest(this);
else
diff --git a/framework/Web/Javascripts/prado/ajax3.js b/framework/Web/Javascripts/prado/ajax3.js
index 3b6a1d31..6e1b7d38 100644
--- a/framework/Web/Javascripts/prado/ajax3.js
+++ b/framework/Web/Javascripts/prado/ajax3.js
@@ -475,6 +475,9 @@ Prado.CallbackRequest.prototype =
return false;
}
+ if(this.options.onPreDispatch)
+ this.options.onPreDispatch(this,null);
+
if(this.options.HasPriority)
return Prado.CallbackRequest.dispatchPriorityRequest(this);
else
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientSide.php b/framework/Web/UI/ActiveControls/TCallbackClientSide.php
index ac5e32c8..ff347659 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientSide.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientSide.php
@@ -16,6 +16,7 @@
* The following client side events are executing in order if the callback
* request and response are send and received successfuly.
*
+ * - <b>onPreDispatch</b> executed before a request is dispatched.
* - <b>onUninitialized</b> executed when callback request is uninitialized.
* - <b>onLoading</b> executed when callback request is initiated
* - <b>onLoaded</b> executed when callback request begins.
@@ -60,6 +61,22 @@ class TCallbackClientSide extends TClientSideOptions
}
/**
+ * @param string javascript code to be executed before a request is dispatched.
+ */
+ public function setOnPreDispatch($javascript)
+ {
+ $this->setFunction('onPreDispatch', $javascript);
+ }
+
+ /**
+ * @return string javascript code to be executed before a request is dispatched.
+ */
+ public function getOnPreDispatch()
+ {
+ return $this->getOption('onPreDispatch');
+ }
+
+ /**
* @return string javascript code for client-side onUninitialized event
*/
public function getOnUninitialized()
diff --git a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
index ea0c942c..10923d03 100644
--- a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
+++ b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
@@ -21,6 +21,10 @@ Prado::using('System.Web.UI.ActiveControls.TCallback');
* TTimeTriggeredCallback sends callback request every {@link setInterval Interval} seconds.
* Upon each callback request, the {@link onCallback OnCallback} event is raised.
*
+ * The timer can be started by calling {@link startTimer()} and stopped using
+ * {@link stopTimer()}. The timer can be automatically started when
+ * {@link setStartTimerOnLoad StartTimerOnLoad} is true.
+ *
* The intervals between each request can be increased when the browser is inactive
* by changing the {@link setDecayRate DecayRate} to a positive number. The
* default decay rate, {@link setDecayType DecayType}, is linear and can be changed to
@@ -113,6 +117,23 @@ class TTimeTriggeredCallback extends TCallback
}
/**
+ * @param boolean true to start the timer when page loads.
+ */
+ public function setStartTimerOnLoad($value)
+ {
+ $this->setViewState('StartTimerOnLoad',
+ TPropertyValue::ensureBoolean($value), false);
+ }
+
+ /**
+ * @return boolean true to start the timer when page loads.
+ */
+ public function getStartTimerOnLoad()
+ {
+ return $this->getViewState('StartTimerOnLoad', false);
+ }
+
+ /**
* @return array list of timer options for client-side.
*/
protected function getTriggerOptions()
@@ -134,6 +155,8 @@ class TTimeTriggeredCallback extends TCallback
parent::render($writer);
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getTriggerOptions());
+ if($this->getStartTimerOnLoad())
+ $this->startTimer();
}
/**