diff options
Diffstat (limited to 'framework/Web/Javascripts/prado/activecontrols')
-rw-r--r-- | framework/Web/Javascripts/prado/activecontrols/ajax3.js | 88 | ||||
-rw-r--r-- | framework/Web/Javascripts/prado/activecontrols/inlineeditor.js | 8 |
2 files changed, 52 insertions, 44 deletions
diff --git a/framework/Web/Javascripts/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/prado/activecontrols/ajax3.js index a8906a78..dbf768a6 100644 --- a/framework/Web/Javascripts/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/prado/activecontrols/ajax3.js @@ -8,6 +8,14 @@ Prado.AjaxRequest.prototype = Ajax.Request.prototype; */
Object.extend(Prado.AjaxRequest.prototype,
{
+ /*initialize: function(request)
+ {
+ this.CallbackRequest = request;
+ this.transport = Ajax.getTransport();
+ this.setOptions(request.options);
+ this.request(request.url);
+ },*/
+
/**
* Customize the response, dispatch onXXX response code events, and
* tries to execute response actions (javascript statements).
@@ -312,7 +320,8 @@ Object.extend(Prado.CallbackRequest, dispatchNormalRequest : function(callback)
{
//Logger.info("dispatching normal request");
- new Prado.AjaxRequest(callback.url, callback.options);
+ //new Prado.AjaxRequest(callback);
+ callback.request(callback.url);
return true;
},
@@ -342,7 +351,7 @@ Object.extend(Prado.CallbackRequest, {
var self = Prado.CallbackRequest;
var pagestate = $(self.FIELD_CALLBACK_PAGESTATE);
- var enabled = request.options.EnablePageStateUpdate && request.options.HasPriority;
+ var enabled = request.ActiveControl.EnablePageStateUpdate && request.ActiveControl.HasPriority;
var aborted = self.currentRequest == null;
if(enabled && !aborted && pagestate)
{
@@ -383,12 +392,13 @@ Object.extend(Prado.CallbackRequest, //get data
callback.options.postBody = callback._getPostData(),
- callback.request = new Prado.AjaxRequest(callback.url, callback.options);
+ //callback.request = new Prado.AjaxRequest(callback);
+ callback.request(callback.url);
callback.timeout = setTimeout(function()
{
//Logger.warn("priority timeout");
self.abortRequest(callback.id);
- },callback.options.RequestTimeOut);
+ },callback.ActiveControl.RequestTimeOut);
//Logger.debug("dispatched "+self.currentRequest.id + " ...")
},
@@ -406,7 +416,7 @@ Object.extend(Prado.CallbackRequest, if(typeof(self.currentRequest) != 'undefined'
&& self.currentRequest != null && self.currentRequest.id == id)
{
- var request = self.currentRequest.request;
+ var request = self.currentRequest;
if(request.transport.readyState < 4)
request.transport.abort();
//Logger.warn('## aborted: setting current request to null');
@@ -421,7 +431,7 @@ Object.extend(Prado.CallbackRequest, */
Ajax.Responders.register({onComplete : function(request)
{
- if(request.options.HasPriority)
+ if(request.ActiveControl.HasPriority)
Prado.CallbackRequest.tryNextRequest();
}});
@@ -440,7 +450,7 @@ Event.OnLoad(function() * request.dispatch();
* </code>
*/
-Prado.CallbackRequest.prototype =
+Prado.CallbackRequest.prototype = Object.extend(Prado.AjaxRequest.prototype,
{
/**
@@ -453,10 +463,13 @@ Prado.CallbackRequest.prototype = */
this.url = this.getCallbackUrl();
+ this.transport = Ajax.getTransport();
+// this.setOptions(request.options);
+// this.request(request.url);
/**
* Current callback request.
*/
- this.request = null;
+ //this.request = null;
this.Enabled = true;
@@ -464,7 +477,7 @@ Prado.CallbackRequest.prototype = if(typeof(id)=="string")
Prado.CallbackRequest.requests[id] = this;
- this.options = Object.extend(
+ this.setOptions(Object.extend(
{
RequestTimeOut : 30000, // 30 second timeout.
EnablePageStateUpdate : true,
@@ -472,7 +485,9 @@ Prado.CallbackRequest.prototype = CausesValidation : true,
ValidationGroup : null,
PostInputs : true
- }, options || {});
+ }, options || {}));
+
+ this.ActiveControl = this.options;
},
/**
@@ -490,7 +505,7 @@ Prado.CallbackRequest.prototype = */
setCallbackParameter : function(value)
{
- this.options['params'] = value;
+ this.ActiveControl['CallbackParameter'] = value;
},
/**
@@ -498,7 +513,7 @@ Prado.CallbackRequest.prototype = */
getCallbackParameter : function()
{
- return this.options['params'];
+ return this.ActiveControl['CallbackParameter'];
},
/**
@@ -507,7 +522,7 @@ Prado.CallbackRequest.prototype = */
setRequestTimeOut : function(timeout)
{
- this.options['RequestTimeOut'] = timeout;
+ this.ActiveControl['RequestTimeOut'] = timeout;
},
/**
@@ -515,7 +530,7 @@ Prado.CallbackRequest.prototype = */
getRequestTimeOut : function()
{
- return this.options['RequestTimeOut'];
+ return this.ActiveControl['RequestTimeOut'];
},
/**
@@ -524,7 +539,7 @@ Prado.CallbackRequest.prototype = */
setCausesValidation : function(validate)
{
- this.options['CausesValidation'] = validate;
+ this.ActiveControl['CausesValidation'] = validate;
},
/**
@@ -532,7 +547,7 @@ Prado.CallbackRequest.prototype = */
getCausesValidation : function()
{
- return this.options['CausesValidation'];
+ return this.ActiveControl['CausesValidation'];
},
/**
@@ -541,7 +556,7 @@ Prado.CallbackRequest.prototype = */
setValidationGroup : function(group)
{
- this.options['ValidationGroup'] = group;
+ this.ActiveControl['ValidationGroup'] = group;
},
/**
@@ -549,7 +564,7 @@ Prado.CallbackRequest.prototype = */
getValidationGroup : function()
{
- return this.options['ValidationGroup'];
+ return this.ActiveControl['ValidationGroup'];
},
/**
@@ -562,27 +577,20 @@ Prado.CallbackRequest.prototype = if(typeof tinyMCE != "undefined")
tinyMCE.triggerSave();
- //override parameter and postBody options.
- Object.extend(this.options,
- {
-// postBody : this._getPostData(),
- parameters : ''
- });
-
- if(this.options.CausesValidation && typeof(Prado.Validation) != "undefined")
+ if(this.ActiveControl.CausesValidation && typeof(Prado.Validation) != "undefined")
{
- var form = this.options.Form || Prado.Validation.getForm();
- if(Prado.Validation.validate(form,this.options.ValidationGroup,this) == false)
+ var form = this.ActiveControl.Form || Prado.Validation.getForm();
+ if(Prado.Validation.validate(form,this.ActiveControl.ValidationGroup,this) == false)
return false;
}
- if(this.options.onPreDispatch)
- this.options.onPreDispatch(this,null);
+ if(this.ActiveControl.onPreDispatch)
+ this.ActiveControl.onPreDispatch(this,null);
if(!this.Enabled)
return;
- if(this.options.HasPriority)
+ if(this.ActiveControl.HasPriority)
{
return Prado.CallbackRequest.enqueue(this);
//return Prado.CallbackRequest.dispatchPriorityRequest(this);
@@ -605,7 +613,7 @@ Prado.CallbackRequest.prototype = {
var data = {};
var callback = Prado.CallbackRequest;
- if(this.options.PostInputs != false)
+ if(this.ActiveControl.PostInputs != false)
{
callback.PostDataLoaders.each(function(name)
{
@@ -621,19 +629,19 @@ Prado.CallbackRequest.prototype = })
})
}
- if(typeof(this.options.params) != "undefined")
- data[callback.FIELD_CALLBACK_PARAMETER] = callback.encode(this.options.params);
+ if(typeof(this.ActiveControl.CallbackParameter) != "undefined")
+ data[callback.FIELD_CALLBACK_PARAMETER] = callback.encode(this.ActiveControl.CallbackParameter);
var pageState = $F(callback.FIELD_CALLBACK_PAGESTATE);
if(typeof(pageState) != "undefined")
data[callback.FIELD_CALLBACK_PAGESTATE] = pageState;
data[callback.FIELD_CALLBACK_TARGET] = this.id;
- if(this.options.EventTarget)
- data[callback.FIELD_POSTBACK_TARGET] = this.options.EventTarget;
- if(this.options.EventParameter)
- data[callback.FIELD_POSTBACK_PARAMETER] = this.options.EventParameter;
+ if(this.ActiveControl.EventTarget)
+ data[callback.FIELD_POSTBACK_TARGET] = this.ActiveControl.EventTarget;
+ if(this.ActiveControl.EventParameter)
+ data[callback.FIELD_POSTBACK_PARAMETER] = this.ActiveControl.EventParameter;
return $H(data).toQueryString();
}
-}
+});
/**
* Create a new callback request using default settings.
@@ -647,7 +655,7 @@ Prado.Callback = function(UniqueID, parameter, onSuccess, options) {
var callback =
{
- 'params' : parameter || '',
+ 'CallbackParameter' : parameter || '',
'onSuccess' : onSuccess || Prototype.emptyFunction
};
diff --git a/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js b/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js index c73985f7..fdf0e9f5 100644 --- a/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js +++ b/framework/Web/Javascripts/prado/activecontrols/inlineeditor.js @@ -89,8 +89,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.setCausesValidation(false);
request.setCallbackParameter(options);
- request.options.onSuccess = this.onloadExternalTextSuccess.bind(this);
- request.options.onFailure = this.onloadExternalTextFailure.bind(this);
+ request.ActiveControl.onSuccess = this.onloadExternalTextSuccess.bind(this);
+ request.ActiveControl.onFailure = this.onloadExternalTextFailure.bind(this);
request.dispatch();
},
@@ -181,8 +181,8 @@ Prado.WebUI.TInPlaceTextBox = Base.extend( {
request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.setCallbackParameter(text);
- request.options.onSuccess = this.onTextChangedSuccess.bind(this);
- request.options.onFailure = this.onTextChangedFailure.bind(this);
+ request.ActiveControl.onSuccess = this.onTextChangedSuccess.bind(this);
+ request.ActiveControl.onFailure = this.onTextChangedFailure.bind(this);
if(request.dispatch())
{
this.isSaving = true;
|