summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/ActiveControls/Samples
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-06-02 16:03:13 +0000
committerctrlaltca@gmail.com <>2011-06-02 16:03:13 +0000
commit6818eb71061580a636831b8e6c0ba8aca2c3420b (patch)
tree696ad78fbf4607f50b570e835e55859f3b3a5d04 /demos/quickstart/protected/pages/ActiveControls/Samples
parentffc9318788952a879815cfa01a8b17b7ddae89b1 (diff)
documentation galore: TCallbackClientSide, TCallbackOptions and TCallbackClientScript
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples')
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page39
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php29
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page73
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php12
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page77
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php12
6 files changed, 242 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page
new file mode 100644
index 00000000..49baa47c
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.page
@@ -0,0 +1,39 @@
+<com:TContent ID="body">
+<h1>TCallbackClientScript Samples</h1>
+
+<p>
+ Choose an action from the list and click the button; the server-side php code will get the selected value and
+ force the execution of some clientside js code in the callback response.
+</p>
+
+<h2>Actions</h2>
+<com:TRadioButtonList ID="radio1">
+ <com:TListItem Value="1" Text="alert() me of something" />
+ <com:TListItem Value="2" Text="toggle Checkbox 1" />
+ <com:TListItem Value="3" Text="hide Label 1" />
+ <com:TListItem Value="4" Text="show Label 1" />
+ <com:TListItem Value="5" Text="focus TextBox 1" />
+</com:TRadioButtonList>
+
+<br/><com:TActiveButton ID="button1" OnCallback="buttonCallback" Text="callback!" />
+
+<h2>Results</h2>
+
+<table>
+ <tr>
+ <td>Checkbox 1:</td>
+ <td><com:TCheckBox ID="check1" Text="Checkbox 1" /></td>
+ </tr>
+ <tr>
+ <td>Label 1:</td>
+ <td><com:TLabel ID="label1" ForeColor="Red" Text="Text of Label 1" /></td>
+ </tr>
+ <tr>
+ <td>TextBox 1:</td>
+ <td><com:TTextBox ID="txt1" Text="Sample text" /></td>
+ </tr>
+</table>
+
+<com:TJavascriptLogger />
+
+<div class="last-modified">$Id: Home.page -1 $</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php
new file mode 100644
index 00000000..500d7987
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientScript/Home.php
@@ -0,0 +1,29 @@
+<?php
+
+// $Id: Home.php -1 $
+class Home extends TPage
+{
+ public function buttonCallback ($sender, $param)
+ {
+ switch($this->radio1->SelectedValue)
+ {
+ case 1:
+ $this->getCallbackClient()->evaluateScript("<script> alert('something'); </script>");
+ break;
+ case 2:
+ $this->getCallbackClient()->check($this->check1, !$this->check1->Checked);
+ break;
+ case 3:
+ $this->getCallbackClient()->hide($this->label1);
+ break;
+ case 4:
+ $this->getCallbackClient()->show($this->label1);
+ break;
+ case 5:
+ $this->getCallbackClient()->focus($this->txt1);
+ break;
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page
new file mode 100644
index 00000000..4540dd91
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.page
@@ -0,0 +1,73 @@
+<com:TContent ID="body">
+<h1>TCallbackClientSide Samples</h1>
+
+<table class="sampletable">
+
+<tr><td class="samplenote">
+A callback button with attached client side options:
+</td><td class="sampleaction">
+<com:TActiveButton
+ Text="click me"
+ OnCallback="buttonCallback"
+>
+ <prop:ClientSide
+ OnLoading="$('callback_status2').hide(); new Effect.BlindDown('callback_status', { duration: 1 });"
+ OnComplete="new Effect.BlindUp('callback_status', { duration: 1 }); $('callback_status2').show();"
+ />
+</com:TActiveButton>
+<div id="callback_status" style="display:none;">please wait 5 seconds for the callback to complete...</div>
+<div id="callback_status2" style="display:none;">callback completed!</div>
+</td></tr>
+
+<tr><td class="samplenote">
+A callback button logging all callback events (5 seconds delay):
+</td><td class="sampleaction">
+<com:TActiveButton
+ Text="click me"
+ OnCallback="buttonCallback"
+>
+ <prop:ClientSide
+ onPreDispatch = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onPreDispatch');"
+ onUninitialized = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onUninitialized');"
+ onLoading = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onLoading');"
+ onLoaded = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onLoaded');"
+ onInteractive = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onInteractive');"
+ onComplete = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onComplete');"
+ onSuccess = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onSuccess');"
+ onFailure = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onFailure');"
+ onException = "new Insertion.Bottom('<%= $this->label1->ClientID %>', '<br/>onException');"
+ />
+</com:TActiveButton>
+<br/><com:TLabel ID="label1" ForeColor="Red" Text="waiting for button click.." />
+</td></tr>
+
+<tr><td class="samplenote">
+A callback with RequestTimeout="3000" (3 seconds). Since the callback will take 5 seconds to complete, the clientside will timeout.
+This will cause a "missing page state" error; note that the callback is not considered failed, since no
+connection error has occured.
+</td><td class="sampleaction">
+<com:TActiveButton
+ Text="click me"
+ OnCallback="buttonCallback"
+>
+ <prop:ClientSide
+ onPreDispatch = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onPreDispatch');"
+ onUninitialized = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onUninitialized');"
+ onLoading = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onLoading');"
+ onLoaded = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onLoaded');"
+ onInteractive = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onInteractive');"
+ onComplete = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onComplete');"
+ onSuccess = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onSuccess');"
+ onFailure = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onFailure');"
+ onException = "new Insertion.Bottom('<%= $this->label2->ClientID %>', '<br/>onException');"
+ RequestTimeOut = "3000"
+ />
+</com:TActiveButton>
+<br/><com:TLabel ID="label2" ForeColor="Red" Text="waiting for button click.." />
+</td></tr>
+
+</table>
+
+<com:TJavascriptLogger />
+
+<div class="last-modified">$Id: Home.page -1 $</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php
new file mode 100644
index 00000000..8dd794fe
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackClientSide/Home.php
@@ -0,0 +1,12 @@
+<?php
+
+// $Id: Home.php -1 $
+class Home extends TPage
+{
+ public function buttonCallback ($sender, $param)
+ {
+ sleep(5);
+ }
+}
+
+?> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page
new file mode 100644
index 00000000..9cc2f155
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.page
@@ -0,0 +1,77 @@
+<com:TContent ID="body">
+<h1>TCallbackOptions Samples</h1>
+
+<table class="sampletable">
+
+<tr><td class="samplenote">
+A callback button with attached client side options:
+</td><td class="sampleaction">
+<com:TActiveButton
+ Text="click me"
+ OnCallback="buttonCallback"
+ ActiveControl.CallbackOptions="options"
+/>
+<com:TCallbackOptions
+ ID="options"
+ ClientSide.OnLoading="$('callback_status2').hide(); new Effect.BlindDown('callback_status', { duration: 1 });"
+ ClientSide.OnComplete="new Effect.BlindUp('callback_status', { duration: 1 }); $('callback_status2').show();"
+/>
+<div id="callback_status" style="display:none;">please wait 5 seconds for the callback to complete...</div>
+<div id="callback_status2" style="display:none;">callback completed!</div>
+</td></tr>
+
+<tr><td class="samplenote">
+Same example as before, but this time interacting with another Prado control:
+</td><td class="sampleaction">
+<com:TActiveButton
+ Text="click me"
+ OnCallback="buttonCallback"
+ ActiveControl.CallbackOptions="options2"
+/>
+<com:TCallbackOptions
+ ID="options2"
+ ClientSide.OnLoading="$('<%= $this->label1->ClientID %>').innerHTML='please wait 5 seconds for the callback to complete....';"
+ ClientSide.OnComplete="$('<%= $this->label1->ClientID %>').innerHTML='callback completed!';"
+/>
+<br/><com:TLabel ID="label1" ForeColor="Red" Text="waiting for button click.." />
+</td></tr>
+
+<tr><td class="samplenote">
+The same TCallbackOptions can be shared among different controls, even of different types:
+</td><td class="sampleaction">
+<com:TActiveButton
+ Text="simple button"
+ OnCallback="buttonCallback"
+ ActiveControl.CallbackOptions="options3"
+/>
+
+<br/><com:TActiveCheckBox
+ Text="simple checkbox"
+ OnCallback="buttonCallback"
+ ActiveControl.CallbackOptions="options3"
+/>
+
+<br/><com:TActiveDropDownList
+ OnCallback="buttonCallback"
+ ActiveControl.CallbackOptions="options3"
+>
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TActiveDropDownList>
+
+<br/><com:TLabel ID="label2" ForeColor="Red" Text="waiting for any control to callback.." />
+
+<com:TCallbackOptions
+ ID="options3"
+ ClientSide.OnLoading="$('<%= $this->label2->ClientID %>').innerHTML='please wait 5 seconds for the callback to complete....';"
+ ClientSide.OnComplete="$('<%= $this->label2->ClientID %>').innerHTML='callback completed!';"
+/>
+
+</td></tr>
+</table>
+
+<com:TJavascriptLogger />
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php
new file mode 100644
index 00000000..6f101107
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TCallbackOptions/Home.php
@@ -0,0 +1,12 @@
+<?php
+
+// $Id$
+class Home extends TPage
+{
+ public function buttonCallback ($sender, $param)
+ {
+ sleep(5);
+ }
+}
+
+?> \ No newline at end of file