summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/js/debug
diff options
context:
space:
mode:
authorwei <>2006-12-09 09:17:22 +0000
committerwei <>2006-12-09 09:17:22 +0000
commit3c03a42d1edb0ec26110ace00f42e156cabff67b (patch)
tree66baa1cd4afca87668be07e62406e7d538dd1fbb /framework/Web/Javascripts/js/debug
parent33b2284955a8f0015922d4c69c5082141b584f27 (diff)
Fixed #433, #384, #439, #477, #435, #422, #401, #359. Add more class docs for sqlmap.
Diffstat (limited to 'framework/Web/Javascripts/js/debug')
-rw-r--r--framework/Web/Javascripts/js/debug/ajax.js169
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js23
2 files changed, 79 insertions, 113 deletions
diff --git a/framework/Web/Javascripts/js/debug/ajax.js b/framework/Web/Javascripts/js/debug/ajax.js
index d26ad640..e5c05510 100644
--- a/framework/Web/Javascripts/js/debug/ajax.js
+++ b/framework/Web/Javascripts/js/debug/ajax.js
@@ -302,6 +302,9 @@ Object.extend(Ajax.Request.prototype,
if (event == 'Complete')
{
+ if(this.header('X-PRADO-REDIRECT'))
+ document.location.href = this.header('X-PRADO-REDIRECT');
+
if ((this.header('Content-type') || '').match(/^text\/javascript/i))
{
try
@@ -407,10 +410,6 @@ Object.extend(Prado.CallbackRequest,
* Page state header name.
*/
PAGESTATE_HEADER : 'X-PRADO-PAGESTATE',
- /**
- * Current requests in progress.
- */
- currentRequest : null,
requestQueue : [],
@@ -553,25 +552,6 @@ Object.extend(Prado.CallbackRequest,
},
/**
- * Dispatch a priority request, it will call abortRequestInProgress first.
- */
- dispatchPriorityRequest : function(callback)
- {
- var self = Prado.CallbackRequest;
-
- callback.request = new Ajax.Request(callback.url, callback.options);
- callback.timeout = setTimeout(function()
- {
- //Logger.warn("priority timeout");
- self.abortCurrentRequest();
- },callback.options.RequestTimeOut);
-
- //Logger.info("dispatched "+this.currentRequest)
- self.currentRequest = callback;
- return true;
- },
-
- /**
* Dispatch a normal request, no timeouts or aborting of requests.
*/
dispatchNormalRequest : function(callback)
@@ -584,23 +564,19 @@ Object.extend(Prado.CallbackRequest,
/**
* Abort the current priority request in progress.
*/
- abortCurrentRequest : function()
+ tryNextRequest : function()
{
var self = Prado.CallbackRequest;
- var inProgress = self.currentRequest;
- //Logger.info("aborting ... "+inProgress);
- if(inProgress)
+ //Logger.debug('trying next request');
+ if(typeof(self.currentRequest) == 'undefined' || self.currentRequest==null)
{
- clearTimeout(inProgress.timeout);
- self.currentRequest = null;
- //Logger.info("aborted");
- //abort if not ready.
- if(inProgress.request.transport.readyState < 4)
- inProgress.request.transport.abort();
- return self.dispatchQueue();
+ if(self.requestQueue.length > 0)
+ return self.dispatchQueue();
+ //else
+ //Logger.warn('empty queque');
}
- else
- return self.dispatchQueue();
+// else
+ // Logger.warn('current request ' + self.currentRequest.id);
},
/**
@@ -622,51 +598,66 @@ Object.extend(Prado.CallbackRequest,
{
if(typeof(Logger) != "undefined")
Logger.warn("Missing page state:"+data);
+// Logger.warn('## bad state: setting current request to null');
+ self.endCurrentRequest();
+ //self.tryNextRequest();
return false;
}
}
+ self.endCurrentRequest();
+ // Logger.warn('## state updated: setting current request to null');
+ // self.tryNextRequest();
return true;
},
enqueue : function(callback)
{
var self = Prado.CallbackRequest;
- if(self.currentRequest==null)
- self.dispatchPriorityRequest(callback);
- else
- self.requestQueue.push(callback);
- //Logger.info("current queque length="+self.requestQueue.length);
+ self.requestQueue.push(callback);
+ //Logger.warn("equeued "+callback.id+", current queque length="+self.requestQueue.length);
+ self.tryNextRequest();
},
dispatchQueue : function()
{
var self = Prado.CallbackRequest;
- //Logger.info("dispatching queque, length="+self.requestQueue.length+" request="+self.currentRequest);
- if(self.requestQueue.length > 0)
+ //Logger.warn("dispatching queque, length="+self.requestQueue.length+" request="+self.currentRequest);
+ var callback = self.requestQueue.shift();
+ self.currentRequest = callback;
+
+ //get data
+ callback.options.postBody = callback._getPostData(),
+
+ callback.request = new Ajax.Request(callback.url, callback.options);
+ callback.timeout = setTimeout(function()
{
- var callback = self.requestQueue.shift();
- //Logger.info("do dispatch request");
- return self.dispatchPriorityRequest(callback);
- }
- return false;
+ //Logger.warn("priority timeout");
+ self.abortRequest(callback.id);
+ },callback.options.RequestTimeOut);
+ //Logger.debug("dispatched "+self.currentRequest.id + " ...")
+ },
+
+ endCurrentRequest : function()
+ {
+ var self = Prado.CallbackRequest;
+ clearTimeout(self.currentRequest.timeout);
+ self.currentRequest=null;
},
abortRequest : function(id)
{
- //Logger.info("abort id="+id);
+ //Logger.warn("abort id="+id);
var self = Prado.CallbackRequest;
- if(self.currentRequest != null && self.currentRequest.id == id)
- self.abortCurrentRequest();
- else
+ if(typeof(self.currentRequest) != 'undefined'
+ && self.currentRequest != null && self.currentRequest.id == id)
{
- var queque = [];
- self.requestQueue.each(function(callback)
- {
- if(callback.id != id)
- queque.push(callback);
- });
- self.requestQueue = queque;
+ var request = self.currentRequest.request;
+ if(request.transport.readyState < 4)
+ request.transport.abort();
+ //Logger.warn('## aborted: setting current request to null');
+ self.endCurrentRequest();
}
+ self.tryNextRequest();
}
})
@@ -676,7 +667,7 @@ Object.extend(Prado.CallbackRequest,
Ajax.Responders.register({onComplete : function(request)
{
if(request.options.HasPriority)
- Prado.CallbackRequest.abortCurrentRequest();
+ Prado.CallbackRequest.tryNextRequest();
}});
//Add HTTP exception respones when logger is enabled.
@@ -816,7 +807,7 @@ Prado.CallbackRequest.prototype =
//override parameter and postBody options.
Object.extend(this.options,
{
- postBody : this._getPostData(),
+// postBody : this._getPostData(),
parameters : ''
});
@@ -2221,70 +2212,32 @@ Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
*/
Prado.WebUI.TTimeTriggeredCallback = Base.extend(
{
- count : 0,
- timeout : 0,
-
constructor : function(options)
{
- this.options = Object.extend(
- {
- Interval : 1,
- DecayRate : 0
- }, options || {})
-
- this.onComplete = this.options.onComplete;
+ this.options = Object.extend({ Interval : 1 }, options || {});
Prado.WebUI.TTimeTriggeredCallback.register(this);
},
startTimer : function()
{
- this.options.onComplete = this.onRequestComplete.bind(this);
- this.timer = setTimeout(this.onTimerEvent.bind(this), 200);
+ setTimeout(this.onTimerEvent.bind(this), 100);
+ if(typeof(this.timer) == 'undefined' || this.timer == null)
+ this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
},
stopTimer : function()
{
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- this.options.onComplete = undefined;
- clearTimeout(this.timer);
- this.timer = undefined;
- this.count = 0;
+ if(typeof(this.timer) != 'undefined')
+ {
+ clearInterval(this.timer);
+ this.timer = null;
+ }
},
onTimerEvent : function()
{
- this.options.params = this.timeout/1000;
var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
request.dispatch();
- },
-
- onRequestComplete : function()
- {
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.getNewTimeout())
- },
-
- getNewTimeout : function()
- {
- switch(this.options.DecayType)
- {
- case 'Exponential':
- t = (Math.exp(this.options.DecayRate*this.count*this.options.Interval))-1;
- break;
- case 'Linear':
- t = this.options.DecayRate*this.count*this.options.Interval;
- break;
- case 'Quadratic':
- t = this.options.DecayRate*this.count*this.count*this.options.Interval;
- break;
- case 'Cubic':
- t = this.options.DecayRate*this.count*this.count*this.count*this.options.Interval;
- break;
- default : t = 0;
- }
- this.timeout = (t + this.options.Interval)*1000;
- this.count++;
- return parseInt(this.timeout);
}
},
//class methods
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js
index aaae6bad..4ab0a415 100644
--- a/framework/Web/Javascripts/js/debug/prado.js
+++ b/framework/Web/Javascripts/js/debug/prado.js
@@ -3389,9 +3389,11 @@ 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));
- Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
},
handleReturnKey : function(e)
@@ -3401,8 +3403,19 @@ Prado.WebUI.TTextBox = Class.extend(Prado.WebUI.PostBackControl,
var target = Event.element(e);
if(target)
{
- Event.fireEvent(target, "change");
- Event.stop(e);
+ if(this.options['AutoPostBack']==true)
+ {
+ Event.fireEvent(target, "change");
+ Event.stop(e);
+ }
+ else
+ {
+ if(this.options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
+ {
+ if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], $(this.options['ID'])))
+ return Event.stop(e);
+ }
+ }
}
}
}
@@ -3504,7 +3517,7 @@ Prado.WebUI.TCheckBoxList = Base.extend(
var checkBoxOptions = Object.extend(
{
ID : options.ListID+"_c"+i,
- EventTarget : options.ListID+"$c"+i
+ EventTarget : options.ListName+"$c"+i
}, options);
new Prado.WebUI.TCheckBox(checkBoxOptions);
}
@@ -3520,7 +3533,7 @@ Prado.WebUI.TRadioButtonList = Base.extend(
var radioButtonOptions = Object.extend(
{
ID : options.ListID+"_c"+i,
- EventTarget : options.ListID+"$c"+i
+ EventTarget : options.ListName+"$c"+i
}, options);
new Prado.WebUI.TRadioButton(radioButtonOptions);
}