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/compressed/prado.js10
-rw-r--r--framework/Web/Javascripts/js/compressed/validator.js8
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js7
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js14
-rw-r--r--framework/Web/Javascripts/js/debug/validator.js18
-rw-r--r--framework/Web/Javascripts/prado/activecontrols3.js7
-rw-r--r--framework/Web/Javascripts/prado/controls.js14
-rw-r--r--framework/Web/Javascripts/prado/validation3.js18
-rw-r--r--framework/Web/UI/ActiveControls/TActivePageAdapter.php5
10 files changed, 70 insertions, 34 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index ffc57483..5bf062d9 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -257,7 +257,8 @@ this.timer=setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
{Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID]=timer;},start:function(id)
{Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();},stop:function(id)
{Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();}});Prado.WebUI.ActiveListControl=Base.extend({constructor:function(options)
-{this.element=$(options.ID);this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));},doCallback:function(event)
+{this.element=$(options.ID);if(this.element)
+{this.options=options;Event.observe(this.element,"change",this.doCallback.bind(this));}},doCallback:function(event)
{var request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveDropDownList=Prado.WebUI.ActiveListControl;Prado.WebUI.TActiveListBox=Prado.WebUI.ActiveListControl;Prado.WebUI.TEventTriggeredCallback=Base.extend({constructor:function(options)
{this.options=options;var element=$(options['ControlID']);if(element)
Event.observe(element,this.getEventName(element),this.doCallback.bind(this));},getEventName:function(element)
diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js
index e1c566e0..74e19278 100644
--- a/framework/Web/Javascripts/js/compressed/prado.js
+++ b/framework/Web/Javascripts/js/compressed/prado.js
@@ -346,8 +346,9 @@ elements[i].checked=true;}},checkIndices:function(elements,indices)
{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={initialize:function(options)
-{this._elementOnClick=null,this.element=$(options.ID);if(this.onInit)
-this.onInit(options);},onInit:function(options)
+{this._elementOnClick=null,this.element=$(options.ID);if(this.element)
+{if(this.onInit)
+this.onInit(options);}},onInit:function(options)
{if(typeof(this.element.onclick)=="function")
{this._elementOnClick=this.element.onclick;this.element.onclick=null;}
Event.observe(this.element,"click",this.elementClicked.bindEvent(this,options));},elementClicked:function(event,options)
@@ -369,8 +370,9 @@ if(y_input)
{y_input.value=y;}
else
{y_input=INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});this.element.parentNode.appendChild(y_input);}}});Prado.WebUI.TRadioButton=Class.extend(Prado.WebUI.PostBackControl);Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(options)
-{this.element=$(options['ID']);if(!this.element.checked)
-this.onRadioButtonInitialize(options);}});Prado.WebUI.TTextBox=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options)
+{this.element=$(options['ID']);if(this.element)
+{if(!this.element.checked)
+this.onRadioButtonInitialize(options);}}});Prado.WebUI.TTextBox=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(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",Prado.PostBack.bindEvent(this,options));},handleReturnKey:function(e)
diff --git a/framework/Web/Javascripts/js/compressed/validator.js b/framework/Web/Javascripts/js/compressed/validator.js
index 95081d50..a3b3f1cd 100644
--- a/framework/Web/Javascripts/js/compressed/validator.js
+++ b/framework/Web/Javascripts/js/compressed/validator.js
@@ -51,8 +51,9 @@ this.groups.push(validator.group);},addSummary: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={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)
+{this.options=options;this.group=options.ValidationGroup;this.messages=$(options.ID);if(this.messages)
+{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)
{if(update||this.options.Refresh!=false)
{return this.hideSummary(validators);}
@@ -86,7 +87,8 @@ this.messages.show();this.visible=true;},formats:function(type)
{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={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()
+{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);if(this.control&&this.message)
+{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 9b1046ba..def73994 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -2308,8 +2308,11 @@ Prado.WebUI.ActiveListControl = Base.extend(
constructor : function(options)
{
this.element = $(options.ID);
- this.options = options;
- Event.observe(this.element, "change", this.doCallback.bind(this));
+ if(this.element)
+ {
+ this.options = options;
+ Event.observe(this.element, "change", this.doCallback.bind(this));
+ }
},
doCallback : function(event)
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js
index a1a224b9..08c7e428 100644
--- a/framework/Web/Javascripts/js/debug/prado.js
+++ b/framework/Web/Javascripts/js/debug/prado.js
@@ -3264,8 +3264,11 @@ Prado.WebUI.PostBackControl.prototype =
this._elementOnClick = null, //capture the element's onclick function
this.element = $(options.ID);
- if(this.onInit)
- this.onInit(options);
+ if(this.element)
+ {
+ if(this.onInit)
+ this.onInit(options);
+ }
},
onInit : function(options)
@@ -3382,8 +3385,11 @@ Object.extend(Prado.WebUI.TRadioButton.prototype,
initialize : function(options)
{
this.element = $(options['ID']);
- if(!this.element.checked)
- this.onRadioButtonInitialize(options);
+ if(this.element)
+ {
+ if(!this.element.checked)
+ this.onRadioButtonInitialize(options);
+ }
}
});
diff --git a/framework/Web/Javascripts/js/debug/validator.js b/framework/Web/Javascripts/js/debug/validator.js
index f3a37d0f..39ef9d63 100644
--- a/framework/Web/Javascripts/js/debug/validator.js
+++ b/framework/Web/Javascripts/js/debug/validator.js
@@ -376,9 +376,12 @@ Prado.WebUI.TValidationSummary.prototype =
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);
+ if(this.messages)
+ {
+ this.visible = this.messages.style.visibility != "hidden"
+ this.visible = this.visible && this.messages.style.display != "none";
+ Prado.Validation.addSummary(options.FormID, this);
+ }
},
/**
@@ -589,13 +592,16 @@ Prado.WebUI.TBaseValidator.prototype =
this._isObserving = {};
this.group = null;
this.requestDispatched = false;
-
+
this.options = options;
this.control = $(options.ControlToValidate);
this.message = $(options.ID);
- this.group = options.ValidationGroup;
+ if(this.control && this.message)
+ {
+ this.group = options.ValidationGroup;
- this.manager = Prado.Validation.addValidator(options.FormID, this);
+ this.manager = Prado.Validation.addValidator(options.FormID, this);
+ }
},
/**
diff --git a/framework/Web/Javascripts/prado/activecontrols3.js b/framework/Web/Javascripts/prado/activecontrols3.js
index ecdc94cb..bb61d8ea 100644
--- a/framework/Web/Javascripts/prado/activecontrols3.js
+++ b/framework/Web/Javascripts/prado/activecontrols3.js
@@ -200,8 +200,11 @@ Prado.WebUI.ActiveListControl = Base.extend(
constructor : function(options)
{
this.element = $(options.ID);
- this.options = options;
- Event.observe(this.element, "change", this.doCallback.bind(this));
+ if(this.element)
+ {
+ this.options = options;
+ Event.observe(this.element, "change", this.doCallback.bind(this));
+ }
},
doCallback : function(event)
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls.js
index 390b1a25..2127732d 100644
--- a/framework/Web/Javascripts/prado/controls.js
+++ b/framework/Web/Javascripts/prado/controls.js
@@ -9,8 +9,11 @@ Prado.WebUI.PostBackControl.prototype =
this._elementOnClick = null, //capture the element's onclick function
this.element = $(options.ID);
- if(this.onInit)
- this.onInit(options);
+ if(this.element)
+ {
+ if(this.onInit)
+ this.onInit(options);
+ }
},
onInit : function(options)
@@ -127,8 +130,11 @@ Object.extend(Prado.WebUI.TRadioButton.prototype,
initialize : function(options)
{
this.element = $(options['ID']);
- if(!this.element.checked)
- this.onRadioButtonInitialize(options);
+ if(this.element)
+ {
+ if(!this.element.checked)
+ this.onRadioButtonInitialize(options);
+ }
}
});
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validation3.js
index b1734452..4158369f 100644
--- a/framework/Web/Javascripts/prado/validation3.js
+++ b/framework/Web/Javascripts/prado/validation3.js
@@ -376,9 +376,12 @@ Prado.WebUI.TValidationSummary.prototype =
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);
+ if(this.messages)
+ {
+ this.visible = this.messages.style.visibility != "hidden"
+ this.visible = this.visible && this.messages.style.display != "none";
+ Prado.Validation.addSummary(options.FormID, this);
+ }
},
/**
@@ -589,13 +592,16 @@ Prado.WebUI.TBaseValidator.prototype =
this._isObserving = {};
this.group = null;
this.requestDispatched = false;
-
+
this.options = options;
this.control = $(options.ControlToValidate);
this.message = $(options.ID);
- this.group = options.ValidationGroup;
+ if(this.control && this.message)
+ {
+ this.group = options.ValidationGroup;
- this.manager = Prado.Validation.addValidator(options.FormID, this);
+ this.manager = Prado.Validation.addValidator(options.FormID, this);
+ }
},
/**
diff --git a/framework/Web/UI/ActiveControls/TActivePageAdapter.php b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
index 8ea196f9..af3cdd4d 100644
--- a/framework/Web/UI/ActiveControls/TActivePageAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
@@ -15,6 +15,7 @@
* Load callback response adapter class.
*/
Prado::using('System.Web.UI.ActiveControls.TCallbackResponseAdapter');
+Prado::using('System.Web.UI.ActiveControls.TCallbackClientScript');
/**
* TActivePageAdapter class.
@@ -155,7 +156,7 @@ class TActivePageAdapter extends TControlAdapter
if(!is_null($responseData))
{
$data = TJavascript::jsonEncode($responseData);
-
+
$this->appendContentPart($response, self::CALLBACK_DATA_HEADER, $data);
//$response->appendHeader(self::CALLBACK_DATA_HEADER.': '.$data);
}
@@ -192,7 +193,7 @@ class TActivePageAdapter extends TControlAdapter
/**
* Appends data or javascript code to the body content surrounded with delimiters
- */
+ */
private function appendContentPart($response, $delimiter, $data)
{
$content = $response->createHtmlWriter();