summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-12-13 10:07:37 +0000
committerwei <>2006-12-13 10:07:37 +0000
commit3c24d31c69dffb6f65214b6d383d446ac122ff14 (patch)
tree971267876c36893930f84d9663031b154799b10b
parent840854be7886236d46d3408de5a084983373b4c7 (diff)
Fixed #488.
-rw-r--r--.gitattributes9
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js5
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js4
-rw-r--r--framework/Web/Javascripts/prado/activecontrols3.js4
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.page37
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.php37
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/MyControl.php8
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/MyControl.tpl9
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.page41
-rw-r--r--tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.php42
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket484.page10
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket484.php30
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket488TestCase.php37
13 files changed, 269 insertions, 4 deletions
diff --git a/.gitattributes b/.gitattributes
index 546aeeb2..a4aa0858 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2116,6 +2116,8 @@ tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.ph
tests/FunctionalTests/active-controls/protected/pages/CustomTemplateComponent.tpl -text
tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.page -text
tests/FunctionalTests/active-controls/protected/pages/CustomTemplateControlTest.php -text
+tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.page -text
+tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.php -text
tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.page -text
tests/FunctionalTests/active-controls/protected/pages/DelayedCallback.php -text
tests/FunctionalTests/active-controls/protected/pages/EventTriggeredCallback.page -text
@@ -2130,6 +2132,10 @@ tests/FunctionalTests/active-controls/protected/pages/LTemplate.tpl -text
tests/FunctionalTests/active-controls/protected/pages/Master1.php -text
tests/FunctionalTests/active-controls/protected/pages/Master1.tpl -text
tests/FunctionalTests/active-controls/protected/pages/MasterTest1.page -text
+tests/FunctionalTests/active-controls/protected/pages/MyControl.php -text
+tests/FunctionalTests/active-controls/protected/pages/MyControl.tpl -text
+tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.page -text
+tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.php -text
tests/FunctionalTests/active-controls/protected/pages/NullStateTest.page -text
tests/FunctionalTests/active-controls/protected/pages/NullStateTest.php -text
tests/FunctionalTests/active-controls/protected/pages/PopulateActiveList.page -text
@@ -2294,6 +2300,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket470.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket470.php -text
tests/FunctionalTests/tickets/protected/pages/Ticket477.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket477.php -text
+tests/FunctionalTests/tickets/protected/pages/Ticket484.page -text
+tests/FunctionalTests/tickets/protected/pages/Ticket484.php -text
tests/FunctionalTests/tickets/protected/pages/Ticket54.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket54Master.php -text
tests/FunctionalTests/tickets/protected/pages/Ticket54Master.tpl -text
@@ -2321,6 +2329,7 @@ tests/FunctionalTests/tickets/tests/Ticket439TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket463TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket470TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket477TestCase.php -text
+tests/FunctionalTests/tickets/tests/Ticket488TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket54TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket72TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket93TestCase.php -text
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index 3c23b1d9..e4756b94 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -225,8 +225,9 @@ this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExtern
Event.stop(event);}});Prado.WebUI.TActiveRadioButton=Class.extend(Prado.WebUI.TActiveCheckBox);Prado.WebUI.TActiveCheckBoxList=Base.extend({constructor:function(options)
{for(var i=0;i<options.ItemCount;i++)
{var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TActiveCheckBox(checkBoxOptions);}}});Prado.WebUI.TActiveRadioButtonList=Prado.WebUI.TActiveCheckBoxList;Prado.WebUI.TActiveTextBox=Class.extend(Prado.WebUI.TTextBox,{onInit:function(options)
-{if(options['TextMode']!='MultiLine')
-Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));Event.observe(this.element,"change",this.doCallback.bindEvent(this,options));},doCallback:function(event,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",this.doCallback.bindEvent(this,options));},doCallback:function(event,options)
{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TAutoComplete=Class.extend(Autocompleter.Base,Prado.WebUI.TActiveTextBox.prototype);Prado.WebUI.TAutoComplete=Class.extend(Prado.WebUI.TAutoComplete,{initialize:function(options)
{this.options=options;this.baseInitialize(options.ID,options.ResultPanel,options);Object.extend(this.options,{onSuccess:this.onComplete.bind(this)});if(options.AutoPostBack)
this.onInit(options);},doCallback:function(event,options)
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index 9b5fe1ef..ed5694cf 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -2132,9 +2132,11 @@ Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox,
{
onInit : function(options)
{
+ this.options=options;
if(options['TextMode'] != 'MultiLine')
Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
- Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
},
doCallback : function(event, options)
diff --git a/framework/Web/Javascripts/prado/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols3.js
index e30fb702..ecdc94cb 100644
--- a/framework/Web/Javascripts/prado/activecontrols3.js
+++ b/framework/Web/Javascripts/prado/activecontrols3.js
@@ -74,9 +74,11 @@ Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox,
{
onInit : function(options)
{
+ this.options=options;
if(options['TextMode'] != 'MultiLine')
Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
- Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
},
doCallback : function(event, options)
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.page b/tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.page
new file mode 100644
index 00000000..5cacf2ef
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.page
@@ -0,0 +1,37 @@
+<com:TForm>
+
+<h1>Custom Login</h1>
+
+<com:TActiveLinkButton ID="showLogin" Attributes.OnClick="new Effect.Appear('loginBox')" Text="Login" />
+<div id="loginBox" style="display: none;">
+
+ <div id="loginLoader" style="display: none;">Please Wait...</div>
+
+ <span>Username:</span><br />
+ <com:TActiveTextBox ID="Username" />
+ <com:TRequiredFieldValidator
+ ID="validator1"
+ ControlToValidate="Username"
+ ValidationGroup="login"
+ Text="...is required" Display="Dynamic"/>
+
+ <br />
+
+ <span>Password:</span><br />
+ <com:TActiveTextBox TextMode="Password" ID="Password" />
+ <com:TActiveCustomValidator
+ ID="validator2"
+ ControlToValidate="Password"
+ Text="*"
+ OnServerValidate="validateUser" ValidationGroup="login" />
+
+ <br />
+
+ <com:TActiveLinkButton ID="checkLogin" OnCallback="doLogin" Text="Login" ValidationGroup="login" />
+ <com:TActiveLinkButton Attributes.OnClick="new Effect.Fade('loginBox')" Text="Close" />
+
+</div>
+
+<com:TJavascriptLogger />
+
+</com:TForm> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.php b/tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.php
new file mode 100644
index 00000000..e88f10de
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/CustomValidatorByPass.php
@@ -0,0 +1,37 @@
+<?php
+
+class CustomValidatorByPass extends TPage
+{
+ public function onLoad($param)
+ {
+
+ parent::onLoad($param);
+
+ $Client = $this->validator2->getActiveControl()->getClientSide();
+
+ $Client->setOnLoading('$(\'loginLoader\').show();');
+ $Client->setOnComplete('$(\'loginLoader\').hide();');
+
+ //$Client->setOnValidationError('alert(\'Authentication Failed\');');
+ $Client->setOnValidationSuccess('new Effect.Fade(\'loginBox\')');
+
+ }
+
+ public function validateUser($sender,$param)
+ {
+ $param->IsValid = $this->Password->Text=='test';
+ }
+
+ public function doLogin($sender,$param)
+ {
+
+ /* This isnt even getting called */
+ if($this->Page->IsValid)
+ {
+ // Re-Render the active panel
+ }
+
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/MyControl.php b/tests/FunctionalTests/active-controls/protected/pages/MyControl.php
new file mode 100644
index 00000000..2c6b7f5b
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/MyControl.php
@@ -0,0 +1,8 @@
+<?php
+
+class MyControl extends TTemplateControl
+{
+
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/active-controls/protected/pages/MyControl.tpl b/tests/FunctionalTests/active-controls/protected/pages/MyControl.tpl
new file mode 100644
index 00000000..5cc17772
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/MyControl.tpl
@@ -0,0 +1,9 @@
+<div id="mycontrol">
+ <com:TActivePanel ID="pnlHeader" ActiveControl.EnableUpdate="false">
+ <h2><com:TLabel ID="Heading" Text="Title"/></h2>
+ </com:TActivePanel>
+ <com:TActivePanel ID="pnlContents" ActiveControl.EnableUpdate="false">
+ This is just some text.<br/>
+ This is just some text.<br/>
+ </com:TActivePanel>
+</div>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.page b/tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.page
new file mode 100644
index 00000000..7371086a
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.page
@@ -0,0 +1,41 @@
+<com:TForm ID="form1">
+
+<h1>My Tab Panel Test</h1>
+
+<div id="loading" style="display: none; z-index: 10; width: 16px; height: 16px; position: absolute; left: 5px; top: 5px;">
+ LLoading...
+</div>
+<ul>
+<li>
+ <com:TActiveLinkButton OnCallback="onShowPanelA" Text="Panel A">
+ <prop:ClientSide OnLoading="$('loading').show()" OnComplete="$('loading').hide()"/>
+ </com:TActiveLinkButton>
+</li>
+<li>
+ <com:TActiveLinkButton OnCallback="onShowPanelB" Text="Panel B">
+ <prop:ClientSide OnLoading="$('loading').show()" OnComplete="$('loading').hide()"/>
+ </com:TActiveLinkButton>
+</li>
+<li>
+ <com:TActiveLinkButton OnCallback="onShowPanelC" Text="Panel C">
+ <prop:ClientSide OnLoading="$('loading').show()" OnComplete="$('loading').hide()"/>
+ </com:TActiveLinkButton>
+</li>
+</ul>
+
+<com:TActivePanel ID="pnlContentsA" Attributes.style="display: none;">
+ This is the contents of panel A
+ <com:Application.pages.MyControl/>
+</com:TActivePanel>
+
+<com:TActivePanel ID="pnlContentsB" Attributes.style="display: none;">
+ This is the contents of panel B
+</com:TActivePanel>
+
+<com:TActivePanel ID="pnlContentsC" Attributes.style="display: none;">
+ This is the contents of panel C
+</com:TActivePanel>
+
+<com:TJavascriptLogger />
+
+</com:TForm>
diff --git a/tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.php b/tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.php
new file mode 100644
index 00000000..723af42d
--- /dev/null
+++ b/tests/FunctionalTests/active-controls/protected/pages/MyTabPanelTest.php
@@ -0,0 +1,42 @@
+<?php
+
+class MyTabPanelTest extends TPage
+{
+ private $panels = array('pnlContentsA', 'pnlContentsB', 'pnlContentsC', );
+
+ private function showPanel($id, $param)
+ {
+ foreach($this->panels as $panel)
+ {
+ if($id == $panel)
+ {
+ $this->$panel->setAttribute('style', 'display: block;');
+ $this->$panel->setVisible(true);
+ $this->$panel->render($param->NewWriter);
+ }
+ else
+ {
+ $this->$panel->setVisible(false);
+ }
+ }
+ }
+
+ public function onShowPanelA($sender, $param)
+ {
+ $this->showPanel('pnlContentsA', $param);
+ }
+
+ public function onShowPanelB($sender, $param)
+ {
+ $this->showPanel('pnlContentsB', $param);
+ }
+
+ public function onShowPanelC($sender, $param)
+ {
+ $this->showPanel('pnlContentsC', $param);
+ }
+}
+
+
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket484.page b/tests/FunctionalTests/tickets/protected/pages/Ticket484.page
new file mode 100644
index 00000000..0b1b2c5f
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket484.page
@@ -0,0 +1,10 @@
+<com:TContent ID="Content">
+
+ <h1>TActiveButton Functional Test</h1>
+ <com:TActiveButton ID="button2" Text="Button 1"
+ OnClick="button2_onclick" OnCallback="button2_oncallback" />
+
+ <com:TActiveLabel ID="label1" Text="Label 1" />
+
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket484.php b/tests/FunctionalTests/tickets/protected/pages/Ticket484.php
new file mode 100644
index 00000000..813ccc23
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket484.php
@@ -0,0 +1,30 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket484 extends TPage
+{
+
+ function onLoad($param)
+ {
+ new TActiveButton;
+ for ($i = 0; $i<1500; $i++)
+ {
+ $ctl = Prado::createComponent("TLabel");
+ $ctl->Text = "Label ".$i;
+ $this->Controls[] = $ctl;
+ }
+ }
+
+ function button2_onclick($sender, $param)
+ {
+ $this->label1->Text = "Button 1 was clicked ";
+ }
+
+ function button2_oncallback($sender, $param)
+ {
+ $this->label1->Text .= "using callback!";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket488TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket488TestCase.php
new file mode 100644
index 00000000..c54b4170
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket488TestCase.php
@@ -0,0 +1,37 @@
+<?php
+
+class Ticket488TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('active-controls/index.php?page=CustomValidatorByPass');
+ $this->assertTextPresent('Custom Login');
+ $this->assertNotVisible('loginBox');
+ $this->click("showLogin");
+ $this->assertVisible("loginBox");
+ $this->assertNotVisible("validator1");
+ $this->assertNotVisible("validator2");
+
+ $this->click("checkLogin");
+ $this->pause(800);
+ $this->assertVisible("validator1");
+ $this->assertVisible("validator2");
+
+ $this->type('Username', 'tea');
+ $this->type('Password', 'mmama');
+
+ $this->click("checkLogin");
+ $this->pause(800);
+ $this->assertNotVisible("validator1");
+ $this->assertVisible("validator2");
+
+ $this->type('Password', 'test');
+ $this->pause(800);
+ $this->assertNotVisible("validator1");
+ $this->assertNotVisible("validator2");
+ $this->assertNotVisible('loginBox');
+ }
+
+}
+
+?> \ No newline at end of file