summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorwei <>2007-01-03 10:09:30 +0000
committerwei <>2007-01-03 10:09:30 +0000
commit46484d91f49721a10b76e2c25071ad594f0b32d4 (patch)
treede5d6c501cf099a3570f9498e12c91013b55ae3c /framework
parentc0bd74c851096574714d9f340352f81314e56a01 (diff)
add Prado.CallbackRequest.getRequestById(id) and Prado.CallbackRequest.dispatch(id) javascript methods.
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/js/compressed/ajax.js9
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js20
-rw-r--r--framework/Web/Javascripts/prado/ajax3.js20
3 files changed, 47 insertions, 2 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js
index 1040070d..d1698aa5 100644
--- a/framework/Web/Javascripts/js/compressed/ajax.js
+++ b/framework/Web/Javascripts/js/compressed/ajax.js
@@ -41,7 +41,11 @@ return Prado.Element.extractContent(this.transport.responseText,name);},getJsonD
catch(e)
{if(typeof(json)=="string")
return Prado.CallbackRequest.decode(json);}},getBodyDataPart:function(name)
-{return this.getJsonData(this.getBodyContentPart(name));}});Prado.CallbackRequest=Class.create();Object.extend(Prado.CallbackRequest,{FIELD_CALLBACK_TARGET:'PRADO_CALLBACK_TARGET',FIELD_CALLBACK_PARAMETER:'PRADO_CALLBACK_PARAMETER',FIELD_CALLBACK_PAGESTATE:'PRADO_PAGESTATE',FIELD_POSTBACK_TARGET:'PRADO_POSTBACK_TARGET',FIELD_POSTBACK_PARAMETER:'PRADO_POSTBACK_PARAMETER',PostDataLoaders:[],DATA_HEADER:'X-PRADO-DATA',ACTION_HEADER:'X-PRADO-ACTIONS',ERROR_HEADER:'X-PRADO-ERROR',PAGESTATE_HEADER:'X-PRADO-PAGESTATE',REDIRECT_HEADER:'X-PRADO-REDIRECT',requestQueue:[],addPostLoaders:function(ids)
+{return this.getJsonData(this.getBodyContentPart(name));}});Prado.CallbackRequest=Class.create();Object.extend(Prado.CallbackRequest,{FIELD_CALLBACK_TARGET:'PRADO_CALLBACK_TARGET',FIELD_CALLBACK_PARAMETER:'PRADO_CALLBACK_PARAMETER',FIELD_CALLBACK_PAGESTATE:'PRADO_PAGESTATE',FIELD_POSTBACK_TARGET:'PRADO_POSTBACK_TARGET',FIELD_POSTBACK_PARAMETER:'PRADO_POSTBACK_PARAMETER',PostDataLoaders:[],DATA_HEADER:'X-PRADO-DATA',ACTION_HEADER:'X-PRADO-ACTIONS',ERROR_HEADER:'X-PRADO-ERROR',PAGESTATE_HEADER:'X-PRADO-PAGESTATE',REDIRECT_HEADER:'X-PRADO-REDIRECT',requestQueue:[],requests:{},getRequestById:function(id)
+{var requests=Prado.CallbackRequest.requests;if(typeof(requests[id])!="undefined")
+return requests[id];},dispatch:function(id)
+{var requests=Prado.CallbackRequest.requests;if(typeof(requests[id])!="undefined")
+requests[id].dispatch();},addPostLoaders:function(ids)
{var self=Prado.CallbackRequest;self.PostDataLoaders=self.PostDataLoaders.concat(ids);var list=[];self.PostDataLoaders.each(function(id)
{if(list.indexOf(id)<0)
list.push(id);});self.PostDataLoaders=list;},dispatchActions:function(transport,actions)
@@ -95,7 +99,8 @@ Ajax.Responders.register({onComplete:function(request)
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=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.url=window.location.href;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||{});},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/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index 452a9ef8..c2822f10 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -431,6 +431,23 @@ Object.extend(Prado.CallbackRequest,
requestQueue : [],
+ //all request objects
+ requests : {},
+
+ getRequestById : function(id)
+ {
+ var requests = Prado.CallbackRequest.requests;
+ if(typeof(requests[id]) != "undefined")
+ return requests[id];
+ },
+
+ dispatch : function(id)
+ {
+ var requests = Prado.CallbackRequest.requests;
+ if(typeof(requests[id]) != "undefined")
+ requests[id].dispatch();
+ },
+
/**
* Add ids of inputs element to post in the request.
*/
@@ -727,6 +744,9 @@ Prado.CallbackRequest.prototype =
this.Enabled = true;
this.id = id;
+ if(typeof(id)=="string")
+ Prado.CallbackRequest.requests[id] = this;
+
this.options = Object.extend(
{
RequestTimeOut : 30000, // 30 second timeout.
diff --git a/framework/Web/Javascripts/prado/ajax3.js b/framework/Web/Javascripts/prado/ajax3.js
index f6d0823c..4783800f 100644
--- a/framework/Web/Javascripts/prado/ajax3.js
+++ b/framework/Web/Javascripts/prado/ajax3.js
@@ -143,6 +143,23 @@ Object.extend(Prado.CallbackRequest,
requestQueue : [],
+ //all request objects
+ requests : {},
+
+ getRequestById : function(id)
+ {
+ var requests = Prado.CallbackRequest.requests;
+ if(typeof(requests[id]) != "undefined")
+ return requests[id];
+ },
+
+ dispatch : function(id)
+ {
+ var requests = Prado.CallbackRequest.requests;
+ if(typeof(requests[id]) != "undefined")
+ requests[id].dispatch();
+ },
+
/**
* Add ids of inputs element to post in the request.
*/
@@ -439,6 +456,9 @@ Prado.CallbackRequest.prototype =
this.Enabled = true;
this.id = id;
+ if(typeof(id)=="string")
+ Prado.CallbackRequest.requests[id] = this;
+
this.options = Object.extend(
{
RequestTimeOut : 30000, // 30 second timeout.