summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes4
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/ActiveHyperLink.page15
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Home.page2
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page70
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php26
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/hello_world.gifbin0 -> 1602 bytes
-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
11 files changed, 164 insertions, 2 deletions
diff --git a/.gitattributes b/.gitattributes
index f40827f9..f7221a5d 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -769,6 +769,7 @@ demos/quickstart/protected/index/quickstart/segments -text
demos/quickstart/protected/pages/ActiveControls/ActiveButton.page -text
demos/quickstart/protected/pages/ActiveControls/ActiveCheckBox.page -text
demos/quickstart/protected/pages/ActiveControls/ActiveCustomValidator.page -text
+demos/quickstart/protected/pages/ActiveControls/ActiveHyperLink.page -text
demos/quickstart/protected/pages/ActiveControls/Home.page -text
demos/quickstart/protected/pages/ActiveControls/Introduction.page -text
demos/quickstart/protected/pages/ActiveControls/Samples/TActiveButton/Home.page -text
@@ -777,6 +778,9 @@ demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.pag
demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCheckBox/Home.php -text
demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.page -text
demos/quickstart/protected/pages/ActiveControls/Samples/TActiveCustomValidator/Home.php -text
+demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page -text
+demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php -text
+demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/hello_world.gif -text
demos/quickstart/protected/pages/ActiveControls/Samples/config.xml -text
demos/quickstart/protected/pages/ActiveControls/TActiveButtonClass.png -text
demos/quickstart/protected/pages/ActiveControls/TActiveButtonClass.vsd -text
diff --git a/demos/quickstart/protected/pages/ActiveControls/ActiveHyperLink.page b/demos/quickstart/protected/pages/ActiveControls/ActiveHyperLink.page
new file mode 100644
index 00000000..e8298ee1
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/ActiveHyperLink.page
@@ -0,0 +1,15 @@
+<com:TContent ID="body">
+<!-- $Id: ActiveCheckBox.page 1405 2006-09-10 01:03:56Z wei $ -->
+<h1 id="ActiveHyperLink">TActiveHyperLink</h1>
+<com:DocLink ClassPath="System.Web.UI.ActiveControls.TActiveHyperLink" />
+
+<p>
+The active control counterpart of <a href=?page=Controls.HyperLink">THyperLink</a>
+component. During a callback request, changes to the <tt>Text</tt>, <tt>ImageUrl</tt>,
+<tt>NavigateUrl</tt> and <tt>Target</tt> properties on the server side will also
+change the corresponding attributes and content on the client-side.
+</p>
+
+<com:RunBar PagePath="ActiveControls.Samples.TActiveHyperLink.Home" />
+
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Home.page b/demos/quickstart/protected/pages/ActiveControls/Home.page
index eabb62c9..38fee25d 100644
--- a/demos/quickstart/protected/pages/ActiveControls/Home.page
+++ b/demos/quickstart/protected/pages/ActiveControls/Home.page
@@ -37,7 +37,7 @@ TActiveButton</a> control.</p>
</li>
<li>
- * <a href="?page=ActiveControls.ActiveHyperLink">TActiveHyperLink</a>
+ <a href="?page=ActiveControls.ActiveHyperLink">TActiveHyperLink</a>
represents a hyperlink on a Web page.
</li>
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page
new file mode 100644
index 00000000..9a314493
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.page
@@ -0,0 +1,70 @@
+<com:TContent ID="body">
+
+<h1>TActiveHyperLink Samples</h1>
+
+<table class="sampletable">
+
+<tr><td class="samplenote">
+A regular hyperlink:
+</td><td class="sampleaction">
+Welcome to
+<com:TActiveHyperLink
+ ID="link1"
+ NavigateUrl="http://www.pradosoft.com/"
+ Text="PradoSoft.com"
+ Target="_blank" />.
+</td>
+<td class="sampleaction">
+<com:TActiveButton ID="button1" Text="Change to Navigate Url" OnClick="button1_clicked" />
+</td>
+</tr>
+
+<tr><td class="samplenote">
+A text hyperlink with css style:
+</td><td class="sampleaction">
+Welcome to
+<com:TActiveHyperLink
+ ID="link2"
+ NavigateUrl="http://www.pradosoft.com/"
+ Text="PradoSoft.com"
+ Target="_blank"
+ BackColor="silver"
+ Font.Italic="true" />.
+</td>
+<td class="sampleaction">
+<com:TActiveButton ID="button2" Text="Change to Target" OnClick="button2_clicked" />
+</td>
+</tr>
+
+<tr><td class="samplenote">
+An image hyperlink:
+</td><td class="sampleaction">
+<com:TActiveHyperLink
+ ID="link3"
+ NavigateUrl="http://www.pradosoft.com/"
+ ImageUrl=<%~hello_world.gif%>
+ Text="Hello World" />.
+</td>
+<td class="sampleaction">
+<com:TActiveButton ID="button3" Text="Change to Text" OnClick="button3_clicked" />
+</td>
+</tr>
+
+<tr><td class="samplenote">
+A hyerplink with body contents as link text:
+</td><td class="sampleaction">
+<com:TActiveHyperLink
+ ID="link4"
+ NavigateUrl="http://www.pradosoft.com/"
+ Target="_blank">
+Body contents
+</com:TActiveHyperLink>
+</td>
+<td class="sampleaction">
+<com:TActiveButton ID="button4" Text="Change to Image" OnClick="button4_clicked" />
+</td>
+</tr>
+
+</table>
+<com:TJavascriptLogger />
+</com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php
new file mode 100644
index 00000000..c125d902
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/Home.php
@@ -0,0 +1,26 @@
+<?php
+
+class Home extends TPage
+{
+ function button1_clicked($sender, $param)
+ {
+ $this->link1->NavigateUrl = 'http://www.google.com';
+ }
+
+ function button2_clicked($sender, $param)
+ {
+ $this->link2->Target = '_self';
+ }
+
+ function button3_clicked($sender, $param)
+ {
+ $this->link3->Text = 'PradoSoft.com';
+ }
+
+ function button4_clicked($sender, $param)
+ {
+ $img = $this->publishFilePath(dirname(__FILE__).'/hello_world.gif');
+ $this->link4->ImageUrl = $img;
+ }
+}
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/hello_world.gif b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/hello_world.gif
new file mode 100644
index 00000000..bc81443c
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveHyperLink/hello_world.gif
Binary files differ
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();
}
/**