summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/compressed/ajax.js
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/Javascripts/js/compressed/ajax.js')
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js63
1 files changed, 31 insertions, 32 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index d67d6adb..c1ce7504 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -156,64 +156,63 @@ msg+=e.version+" "+e.time+"\n";return msg;}},encode:function(data)
{if(typeof(data)=="string"&&data.trim().length>0)
return Prado.JSON.parse(data);else
return null;},dispatchNormalRequest:function(callback)
-{new Prado.AjaxRequest(callback.url,callback.options);return true;},tryNextRequest:function()
+{callback.request(callback.url);return true;},tryNextRequest:function()
{var self=Prado.CallbackRequest;if(typeof(self.currentRequest)=='undefined'||self.currentRequest==null)
{if(self.requestQueue.length>0)
return self.dispatchQueue();}},updatePageState:function(request,transport)
-{var self=Prado.CallbackRequest;var pagestate=$(self.FIELD_CALLBACK_PAGESTATE);var enabled=request.options.EnablePageStateUpdate&&request.options.HasPriority;var aborted=self.currentRequest==null;if(enabled&&!aborted&&pagestate)
+{var self=Prado.CallbackRequest;var pagestate=$(self.FIELD_CALLBACK_PAGESTATE);var enabled=request.ActiveControl.EnablePageStateUpdate&&request.ActiveControl.HasPriority;var aborted=self.currentRequest==null;if(enabled&&!aborted&&pagestate)
{var data=request.getBodyContentPart(self.PAGESTATE_HEADER);if(typeof(data)=="string"&&data.length>0)
pagestate.value=data;else
{if(typeof(Logger)!="undefined")
Logger.warn("Missing page state:"+data);self.endCurrentRequest();return false;}}
self.endCurrentRequest();return true;},enqueue:function(callback)
{var self=Prado.CallbackRequest;self.requestQueue.push(callback);self.tryNextRequest();},dispatchQueue:function()
-{var self=Prado.CallbackRequest;var callback=self.requestQueue.shift();self.currentRequest=callback;callback.options.postBody=callback._getPostData(),callback.request=new Prado.AjaxRequest(callback.url,callback.options);callback.timeout=setTimeout(function()
-{self.abortRequest(callback.id);},callback.options.RequestTimeOut);},endCurrentRequest:function()
+{var self=Prado.CallbackRequest;var callback=self.requestQueue.shift();self.currentRequest=callback;callback.options.postBody=callback._getPostData(),callback.request(callback.url);callback.timeout=setTimeout(function()
+{self.abortRequest(callback.id);},callback.ActiveControl.RequestTimeOut);},endCurrentRequest:function()
{var self=Prado.CallbackRequest;clearTimeout(self.currentRequest.timeout);self.currentRequest=null;},abortRequest:function(id)
{var self=Prado.CallbackRequest;if(typeof(self.currentRequest)!='undefined'&&self.currentRequest!=null&&self.currentRequest.id==id)
-{var request=self.currentRequest.request;if(request.transport.readyState<4)
+{var request=self.currentRequest;if(request.transport.readyState<4)
request.transport.abort();self.endCurrentRequest();}
self.tryNextRequest();}})
Ajax.Responders.register({onComplete:function(request)
-{if(request.options.HasPriority)
+{if(request.ActiveControl.HasPriority)
Prado.CallbackRequest.tryNextRequest();}});Event.OnLoad(function()
{if(typeof Logger!="undefined")
-Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype={initialize:function(id,options)
-{this.url=this.getCallbackUrl();this.request=null;this.Enabled=true;this.id=id;if(typeof(id)=="string")
-Prado.CallbackRequest.requests[id]=this;this.options=Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{});},getCallbackUrl:function()
+Ajax.Responders.register(Prado.CallbackRequest.Exception);});Prado.CallbackRequest.prototype=Object.extend(Prado.AjaxRequest.prototype,{initialize:function(id,options)
+{this.url=this.getCallbackUrl();this.transport=Ajax.getTransport();this.Enabled=true;this.id=id;if(typeof(id)=="string")
+Prado.CallbackRequest.requests[id]=this;this.setOptions(Object.extend({RequestTimeOut:30000,EnablePageStateUpdate:true,HasPriority:true,CausesValidation:true,ValidationGroup:null,PostInputs:true},options||{}));this.ActiveControl=this.options;},getCallbackUrl:function()
{return $('PRADO_PAGESTATE').form.action;},setCallbackParameter:function(value)
-{this.options['params']=value;},getCallbackParameter:function()
-{return this.options['params'];},setRequestTimeOut:function(timeout)
-{this.options['RequestTimeOut']=timeout;},getRequestTimeOut:function()
-{return this.options['RequestTimeOut'];},setCausesValidation:function(validate)
-{this.options['CausesValidation']=validate;},getCausesValidation:function()
-{return this.options['CausesValidation'];},setValidationGroup:function(group)
-{this.options['ValidationGroup']=group;},getValidationGroup:function()
-{return this.options['ValidationGroup'];},dispatch:function()
+{this.ActiveControl['CallbackParameter']=value;},getCallbackParameter:function()
+{return this.ActiveControl['CallbackParameter'];},setRequestTimeOut:function(timeout)
+{this.ActiveControl['RequestTimeOut']=timeout;},getRequestTimeOut:function()
+{return this.ActiveControl['RequestTimeOut'];},setCausesValidation:function(validate)
+{this.ActiveControl['CausesValidation']=validate;},getCausesValidation:function()
+{return this.ActiveControl['CausesValidation'];},setValidationGroup:function(group)
+{this.ActiveControl['ValidationGroup']=group;},getValidationGroup:function()
+{return this.ActiveControl['ValidationGroup'];},dispatch:function()
{if(typeof tinyMCE!="undefined")
-tinyMCE.triggerSave();Object.extend(this.options,{parameters:''});if(this.options.CausesValidation&&typeof(Prado.Validation)!="undefined")
-{var form=this.options.Form||Prado.Validation.getForm();if(Prado.Validation.validate(form,this.options.ValidationGroup,this)==false)
+tinyMCE.triggerSave();if(this.ActiveControl.CausesValidation&&typeof(Prado.Validation)!="undefined")
+{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.Enabled)
-return;if(this.options.HasPriority)
+if(this.ActiveControl.onPreDispatch)
+this.ActiveControl.onPreDispatch(this,null);if(!this.Enabled)
+return;if(this.ActiveControl.HasPriority)
{return Prado.CallbackRequest.enqueue(this);}
else
return Prado.CallbackRequest.dispatchNormalRequest(this);},abort:function()
{return Prado.CallbackRequest.abortRequest(this.id);},_getPostData:function()
-{var data={};var callback=Prado.CallbackRequest;if(this.options.PostInputs!=false)
+{var data={};var callback=Prado.CallbackRequest;if(this.ActiveControl.PostInputs!=false)
{callback.PostDataLoaders.each(function(name)
{$A(document.getElementsByName(name)).each(function(element)
{if(element.type&&element.name==name)
{value=$F(element);if(typeof(value)!="undefined"&&value!=null)
data[name]=value;}})})}
-if(typeof(this.options.params)!="undefined")
-data[callback.FIELD_CALLBACK_PARAMETER]=callback.encode(this.options.params);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;return $H(data).toQueryString();}}
-Prado.Callback=function(UniqueID,parameter,onSuccess,options)
-{var callback={'params':parameter||'','onSuccess':onSuccess||Prototype.emptyFunction};Object.extend(callback,options||{});request=new Prado.CallbackRequest(UniqueID,callback);request.dispatch();return false;}
+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.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();}});Prado.Callback=function(UniqueID,parameter,onSuccess,options)
+{var callback={'CallbackParameter':parameter||'','onSuccess':onSuccess||Prototype.emptyFunction};Object.extend(callback,options||{});request=new Prado.CallbackRequest(UniqueID,callback);request.dispatch();return false;}
Prado.WebUI.CallbackControl=Class.extend(Prado.WebUI.PostBackControl,{onPostBack:function(event,options)
{var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveLinkButton=Class.extend(Prado.WebUI.CallbackControl);Prado.WebUI.TActiveImageButton=Class.extend(Prado.WebUI.TImageButton,{onPostBack:function(event,options)
{this.addXYInput(event,options);var request=new Prado.CallbackRequest(options.EventTarget,options);request.dispatch();Event.stop(event);}});Prado.WebUI.TActiveCheckBox=Class.extend(Prado.WebUI.CallbackControl,{onPostBack:function(event,options)
@@ -276,7 +275,7 @@ Event.stop(evt);return false;},exitEditMode:function(evt)
{Element.show(this.element);Element.hide(this.editField);},createEditorInput:function()
{if(this.editField==null)
this.createTextBox();this.editField.value=this.getText();},loadExternalText:function()
-{this.editField.disabled=true;this.onLoadingText();options=new Array('__InlineEditor_loadExternalText__',this.getText());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.dispatch();},createTextBox:function()
+{this.editField.disabled=true;this.onLoadingText();options=new Array('__InlineEditor_loadExternalText__',this.getText());request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCausesValidation(false);request.setCallbackParameter(options);request.ActiveControl.onSuccess=this.onloadExternalTextSuccess.bind(this);request.ActiveControl.onFailure=this.onloadExternalTextFailure.bind(this);request.dispatch();},createTextBox:function()
{cssClass=this.element.className||'';inputName=this.options.EventTarget;options={'className':cssClass,name:inputName,id:this.options.TextBoxID};if(this.options.TextMode=='SingleLine')
{if(this.options.MaxLength>0)
options['maxlength']=this.options.MaxLength;this.editField=INPUT(options);}
@@ -299,7 +298,7 @@ this.options.onEnterEditMode(this,null);},onTextBoxBlur:function(e)
this.onTextChanged(text);else
{this.element.innerHTML=this.editField.value;this.isEditing=false;if(this.options.AutoHide)
this.showLabel();}},onTextChanged:function(text)
-{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);if(request.dispatch())
+{request=new Prado.CallbackRequest(this.options.EventTarget,this.options);request.setCallbackParameter(text);request.ActiveControl.onSuccess=this.onTextChangedSuccess.bind(this);request.ActiveControl.onFailure=this.onTextChangedFailure.bind(this);if(request.dispatch())
{this.isSaving=true;this.editField.disabled=true;}},onLoadingText:function()
{},onloadExternalTextSuccess:function(request,parameter)
{this.isEditing=true;this.editField.disabled=false;this.editField.value=this.getText();Prado.Element.focus(this.editField);if(typeof(this.options.onSuccess)=="function")