summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwei <>2006-12-10 23:55:49 +0000
committerwei <>2006-12-10 23:55:49 +0000
commit840854be7886236d46d3408de5a084983373b4c7 (patch)
tree8a8c22463bc3ac7f556633e790818d724bc52ed0
parent3c03a42d1edb0ec26110ace00f42e156cabff67b (diff)
Fixed #470
-rw-r--r--.gitattributes3
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js4
-rw-r--r--framework/Web/Javascripts/js/compressed/prado.js4
-rw-r--r--framework/Web/Javascripts/js/compressed/validator.js10
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js29
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js4
-rw-r--r--framework/Web/Javascripts/js/debug/validator.js33
-rw-r--r--framework/Web/Javascripts/prado/ajax3.js29
-rw-r--r--framework/Web/Javascripts/prado/controls.js4
-rw-r--r--framework/Web/Javascripts/prado/validation3.js33
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket470.page27
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket470.php24
-rw-r--r--tests/FunctionalTests/tickets/tests/Ticket470TestCase.php51
13 files changed, 164 insertions, 91 deletions
diff --git a/.gitattributes b/.gitattributes
index 260c07e1..546aeeb2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2290,6 +2290,8 @@ tests/FunctionalTests/tickets/protected/pages/Ticket439.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket439.php -text
tests/FunctionalTests/tickets/protected/pages/Ticket453.page -text
tests/FunctionalTests/tickets/protected/pages/Ticket463.page -text
+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/Ticket54.page -text
@@ -2317,6 +2319,7 @@ tests/FunctionalTests/tickets/tests/Ticket28TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket433TestCase.php -text
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/Ticket54TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket72TestCase.php -text
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index 593b4c15..3c23b1d9 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -89,8 +89,8 @@ Ajax.Responders.register({onComplete:function(request)
{if(request.options.HasPriority)
Prado.CallbackRequest.tryNextRequest();}});Event.OnLoad(function()
{if(typeof Logger!="undefined")
-Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype={url:window.location.href,options:{},id:null,request:null,Enabled:true,initialize:function(id,options)
-{this.id=id;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},setCallbackParameter:function(value)
+Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype={initialize:function(id,options)
+{this.url=window.location.href;this.request=null;this.Enabled=true;this.id=id;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},setCallbackParameter:function(value)
{this.options['params']=value;},getCallbackParameter:function()
{return this.options['params'];},setRequestTimeOut:function(timeout)
{this.options['RequestTimeOut']=timeout;},getRequestTimeOut:function()
diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js
index 9e0b9ba8..f369a5f3 100644
--- a/framework/Web/Javascripts/js/compressed/prado.js
+++ b/framework/Web/Javascripts/js/compressed/prado.js
@@ -345,8 +345,8 @@ elements[i].checked=true;}},checkIndices:function(elements,indices)
{new Insertion.Top(element,content);},after:function(element,content)
{new Insertion.After(element,content);},before:function(element,content)
{new Insertion.Before(element,content);}}
-Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={_elementOnClick:null,initialize:function(options)
-{this.element=$(options.ID);if(this.onInit)
+Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={initialize:function(options)
+{this._elementOnClick=null,this.element=$(options.ID);if(this.onInit)
this.onInit(options);},onInit:function(options)
{if(typeof(this.element.onclick)=="function")
{this._elementOnClick=this.element.onclick;this.element.onclick=null;}
diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js
index 7b89084b..95081d50 100644
--- a/framework/Web/Javascripts/js/compressed/validator.js
+++ b/framework/Web/Javascripts/js/compressed/validator.js
@@ -16,8 +16,8 @@ throw new Error("A validation manager for form '"+formID+"' needs to be created
{$H(Prado.Validation.managers).each(function(manager)
{manager[1].validators.each(function(validator)
{if(validator.options.ID==validatorID)
-{validator.options.ErrorMessage=message;$(validatorID).innerHTML=message;}});});}});Prado.ValidationManager=Class.create();Prado.ValidationManager.prototype={validators:[],summaries:[],groups:[],options:{},initialize:function(options)
-{this.options=options;Prado.Validation.managers[options.FormID]=this;},validate:function(group,invoker)
+{validator.options.ErrorMessage=message;$(validatorID).innerHTML=message;}});});}});Prado.ValidationManager=Class.create();Prado.ValidationManager.prototype={initialize:function(options)
+{this.validators=[];this.summaries=[];this.groups=[];this.options={};this.options=options;Prado.Validation.managers[options.FormID]=this;},validate:function(group,invoker)
{if(group)
return this._validateGroup(group,invoker);else
return this._validateNonGroup(invoker);},_validateGroup:function(groupID,invoker)
@@ -50,7 +50,7 @@ this.groups.push(validator.group);},addSummary:function(summary)
{var validators=this.getValidatorsWithError(group);this.summaries.each(function(summary)
{var inGroup=group&&summary.group==group;var noGroup=!group&&!summary.group;if(inGroup||noGroup)
summary.updateSummary(validators,refresh);else
-summary.hideSummary(true);});}};Prado.WebUI.TValidationSummary=Class.create();Prado.WebUI.TValidationSummary.prototype={group:null,options:{},visible:false,messages:null,initialize:function(options)
+summary.hideSummary(true);});}};Prado.WebUI.TValidationSummary=Class.create();Prado.WebUI.TValidationSummary.prototype={initialize:function(options)
{this.options=options;this.group=options.ValidationGroup;this.messages=$(options.ID);this.visible=this.messages.style.visibility!="hidden"
this.visible=this.visible&&this.messages.style.display!="none";Prado.Validation.addSummary(options.FormID,this);},updateSummary:function(validators,update)
{if(validators.length<=0)
@@ -85,8 +85,8 @@ this.messages.show();this.visible=true;},formats:function(type)
{var output=this.options.HeaderText?this.options.HeaderText+"\n":"";for(var i=0;i<messages.length;i++)
{switch(this.options.DisplayMode)
{case"List":output+=messages[i]+"\n";break;case"BulletList":default:output+=" - "+messages[i]+"\n";break;case"SingleParagraph":output+=messages[i]+" ";break;}}
-return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={enabled:true,visible:false,isValid:true,options:{},_isObserving:{},group:null,manager:null,message:null,requestDispatched:false,initialize:function(options)
-{this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);},getErrorMessage:function()
+return output;}};Prado.WebUI.TBaseValidator=Class.create();Prado.WebUI.TBaseValidator.prototype={initialize:function(options)
+{this.enabled=true;this.visible=false;this.isValid=true;this._isObserving={};this.group=null;this.requestDispatched=false;this.options=options;this.control=$(options.ControlToValidate);this.message=$(options.ID);this.group=options.ValidationGroup;this.manager=Prado.Validation.addValidator(options.FormID,this);},getErrorMessage:function()
{return this.options.ErrorMessage;},updateControl:function(focus)
{this.refreshControlAndMessage();if(this.options.FocusOnError&&!this.isValid)
Prado.Element.focus(this.options.FocusElementID);this.visible=true;},refreshControlAndMessage:function()
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index e5c05510..9b5fe1ef 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -687,33 +687,24 @@ Event.OnLoad(function()
*/
Prado.CallbackRequest.prototype =
{
- /**
- * Callback URL, same url as the current page.
- */
- url : window.location.href,
/**
- * Callback options, including onXXX events.
+ * Prepare and inititate a callback request.
*/
- options : { },
-
+ initialize : function(id, options)
+ {
/**
- * Callback target ID. E.g. $control->getUniqueID();
+ * Callback URL, same url as the current page.
*/
- id : null,
+ this.url = window.location.href;
- /**
- * Current callback request.
- */
- request : null,
+ /**
+ * Current callback request.
+ */
+ this.request = null;
- Enabled : true,
+ this.Enabled = true;
- /**
- * Prepare and inititate a callback request.
- */
- initialize : function(id, options)
- {
this.id = id;
this.options = Object.extend(
{
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js
index 4ab0a415..61b7f880 100644
--- a/framework/Web/Javascripts/js/debug/prado.js
+++ b/framework/Web/Javascripts/js/debug/prado.js
@@ -3256,10 +3256,10 @@ Prado.WebUI.PostBackControl = Class.create();
Prado.WebUI.PostBackControl.prototype =
{
- _elementOnClick : null, //capture the element's onclick function
-
initialize : function(options)
{
+ this._elementOnClick = null, //capture the element's onclick function
+
this.element = $(options.ID);
if(this.onInit)
this.onInit(options);
diff --git a/framework/Web/Javascripts/js/debug/validator.js b/framework/Web/Javascripts/js/debug/validator.js
index 64ac10e3..f3a37d0f 100644
--- a/framework/Web/Javascripts/js/debug/validator.js
+++ b/framework/Web/Javascripts/js/debug/validator.js
@@ -168,11 +168,6 @@ Prado.ValidationManager = Class.create();
*/
Prado.ValidationManager.prototype =
{
- validators : [], // list of validators
- summaries : [], // validation summaries
- groups : [], // validation groups
- options : {},
-
/**
* <code>
* options['FormID']* The ID of HTML form to manage.
@@ -180,6 +175,11 @@ Prado.ValidationManager.prototype =
*/
initialize : function(options)
{
+ this.validators = []; // list of validators
+ this.summaries = []; // validation summaries
+ this.groups = []; // validation groups
+ this.options = {};
+
this.options = options;
Prado.Validation.managers[options.FormID] = this;
},
@@ -357,11 +357,6 @@ Prado.ValidationManager.prototype =
Prado.WebUI.TValidationSummary = Class.create();
Prado.WebUI.TValidationSummary.prototype =
{
- group : null,
- options : {},
- visible : false,
- messages : null,
-
/**
* <code>
* options['ID']* Validation summary ID, i.e., an HTML element ID
@@ -564,16 +559,6 @@ Prado.WebUI.TValidationSummary.prototype =
Prado.WebUI.TBaseValidator = Class.create();
Prado.WebUI.TBaseValidator.prototype =
{
- enabled : true,
- visible : false,
- isValid : true,
- options : {},
- _isObserving : {},
- group : null,
- manager : null,
- message : null,
- requestDispatched : false,
-
/**
* <code>
* options['ID']* Validator ID, e.g. span with message
@@ -597,6 +582,14 @@ Prado.WebUI.TBaseValidator.prototype =
options.OnSuccess = options.OnSuccess || Prototype.emptyFunction;
options.OnError = options.OnError || Prototype.emptyFunction;
*/
+
+ this.enabled = true;
+ this.visible = false;
+ this.isValid = true;
+ this._isObserving = {};
+ this.group = null;
+ this.requestDispatched = false;
+
this.options = options;
this.control = $(options.ControlToValidate);
this.message = $(options.ID);
diff --git a/framework/Web/Javascripts/prado/ajax3.js b/framework/Web/Javascripts/prado/ajax3.js
index f540813c..e176aa8a 100644
--- a/framework/Web/Javascripts/prado/ajax3.js
+++ b/framework/Web/Javascripts/prado/ajax3.js
@@ -399,33 +399,24 @@ Event.OnLoad(function()
*/
Prado.CallbackRequest.prototype =
{
- /**
- * Callback URL, same url as the current page.
- */
- url : window.location.href,
/**
- * Callback options, including onXXX events.
+ * Prepare and inititate a callback request.
*/
- options : { },
-
+ initialize : function(id, options)
+ {
/**
- * Callback target ID. E.g. $control->getUniqueID();
+ * Callback URL, same url as the current page.
*/
- id : null,
+ this.url = window.location.href;
- /**
- * Current callback request.
- */
- request : null,
+ /**
+ * Current callback request.
+ */
+ this.request = null;
- Enabled : true,
+ this.Enabled = true;
- /**
- * Prepare and inititate a callback request.
- */
- initialize : function(id, options)
- {
this.id = id;
this.options = Object.extend(
{
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js
index 97969f87..390b1a25 100644
--- a/framework/Web/Javascripts/prado/controls.js
+++ b/framework/Web/Javascripts/prado/controls.js
@@ -4,10 +4,10 @@ Prado.WebUI.PostBackControl = Class.create();
Prado.WebUI.PostBackControl.prototype =
{
- _elementOnClick : null, //capture the element's onclick function
-
initialize : function(options)
{
+ this._elementOnClick = null, //capture the element's onclick function
+
this.element = $(options.ID);
if(this.onInit)
this.onInit(options);
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js
index aa4c726b..b1734452 100644
--- a/framework/Web/Javascripts/prado/validation3.js
+++ b/framework/Web/Javascripts/prado/validation3.js
@@ -168,11 +168,6 @@ Prado.ValidationManager = Class.create();
*/
Prado.ValidationManager.prototype =
{
- validators : [], // list of validators
- summaries : [], // validation summaries
- groups : [], // validation groups
- options : {},
-
/**
* <code>
* options['FormID']* The ID of HTML form to manage.
@@ -180,6 +175,11 @@ Prado.ValidationManager.prototype =
*/
initialize : function(options)
{
+ this.validators = []; // list of validators
+ this.summaries = []; // validation summaries
+ this.groups = []; // validation groups
+ this.options = {};
+
this.options = options;
Prado.Validation.managers[options.FormID] = this;
},
@@ -357,11 +357,6 @@ Prado.ValidationManager.prototype =
Prado.WebUI.TValidationSummary = Class.create();
Prado.WebUI.TValidationSummary.prototype =
{
- group : null,
- options : {},
- visible : false,
- messages : null,
-
/**
* <code>
* options['ID']* Validation summary ID, i.e., an HTML element ID
@@ -564,16 +559,6 @@ Prado.WebUI.TValidationSummary.prototype =
Prado.WebUI.TBaseValidator = Class.create();
Prado.WebUI.TBaseValidator.prototype =
{
- enabled : true,
- visible : false,
- isValid : true,
- options : {},
- _isObserving : {},
- group : null,
- manager : null,
- message : null,
- requestDispatched : false,
-
/**
* <code>
* options['ID']* Validator ID, e.g. span with message
@@ -597,6 +582,14 @@ Prado.WebUI.TBaseValidator.prototype =
options.OnSuccess = options.OnSuccess || Prototype.emptyFunction;
options.OnError = options.OnError || Prototype.emptyFunction;
*/
+
+ this.enabled = true;
+ this.visible = false;
+ this.isValid = true;
+ this._isObserving = {};
+ this.group = null;
+ this.requestDispatched = false;
+
this.options = options;
this.control = $(options.ControlToValidate);
this.message = $(options.ID);
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket470.page b/tests/FunctionalTests/tickets/protected/pages/Ticket470.page
new file mode 100644
index 00000000..c0ad23e6
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket470.page
@@ -0,0 +1,27 @@
+<com:TContent ID="Content">
+ <com:TActivePanel ID="activePanelTest" >
+ <!-- RELOAD -->
+ nbReload :
+ <com:TLabel ID="counter" Text="0" />
+ <com:TActiveLinkButton ID="reloadButton" OnCallback="Reload" > Reload </com:TActiveLinkButton>
+ <br/>
+
+ <!-- TEST -->
+ <com:TTextBox ID="TextBox" />
+ <com:TActiveLinkButton ID="button1" OnCallback="Valid" ValidationGroup="v1" > Valid </com:TActiveLinkButton>
+ <com:TRequiredFieldValidator
+ ID="validator1"
+ ValidationGroup="v1"
+ ControlToValidate="TextBox"
+ Text="ERROR, input 'TextBox' is empty" />
+ <!-- RESULTS -->
+ <div style="border:1px solid red">
+ <com:TActiveLabel ID="Results" />
+ </div>
+ </com:TActivePanel>
+
+
+ BUG :
+ click on 'Reload' with no text in the TextBox at anytime, and then, clicking on 'Valid' won't work...
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket470.php b/tests/FunctionalTests/tickets/protected/pages/Ticket470.php
new file mode 100644
index 00000000..45741176
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket470.php
@@ -0,0 +1,24 @@
+<?php
+
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Ticket470 extends TPage
+{
+ /**
+ * Increase the reload counter and render the activepanel content
+ */
+ public function Reload($sender, $param){
+ $this->Results->Text = "";
+ $this->counter->Text = $this->counter->Text +1;
+ $this->activePanelTest->renderControl($param->getNewWriter());
+ }
+
+ /**
+ *function to call when the form is valid (and the linkbutton fired his callback event)
+ */
+ public function Valid($sender, $param){
+ $this->Results->Text = "OK!!!";
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Ticket470TestCase.php b/tests/FunctionalTests/tickets/tests/Ticket470TestCase.php
new file mode 100644
index 00000000..05ad6fb6
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Ticket470TestCase.php
@@ -0,0 +1,51 @@
+<?php
+
+class Ticket470TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $base = 'ctl0_Content_';
+ $this->open('tickets/index.php?page=Ticket470');
+ $this->verifyTitle("Verifying Ticket 470");
+ $this->assertText("{$base}counter", "0");
+ $this->assertText("{$base}Results", "");
+ $this->assertNotVisible("{$base}validator1");
+
+ $this->click("{$base}button1");
+ $this->pause(800);
+ $this->assertText("{$base}counter", "0");
+ $this->assertText("{$base}Results", "");
+ $this->assertVisible("{$base}validator1");
+
+ $this->type("{$base}TextBox", "hello");
+ $this->click("{$base}button1");
+ $this->pause(800);
+ $this->assertText("{$base}counter", "0");
+ $this->assertText("{$base}Results", "OK!!!");
+ $this->assertNotVisible("{$base}validator1");
+
+ //reload
+ $this->click("{$base}reloadButton");
+ $this->pause(800);
+ $this->assertValue("{$base}TextBox", "hello");
+ $this->assertText("{$base}counter", "1");
+ $this->assertText("{$base}Results", "");
+ $this->assertNotVisible("{$base}validator1");
+
+ $this->type("{$base}TextBox", "");
+ $this->click("{$base}button1");
+ $this->pause(800);
+ $this->assertText("{$base}counter", "1");
+ $this->assertText("{$base}Results", "");
+ $this->assertVisible("{$base}validator1");
+
+ $this->type("{$base}TextBox", "test");
+ $this->click("{$base}button1");
+ $this->pause(800);
+ $this->assertText("{$base}counter", "1");
+ $this->assertText("{$base}Results", "OK!!!");
+ $this->assertNotVisible("{$base}validator1");
+ }
+}
+
+?> \ No newline at end of file