diff options
author | wei <> | 2006-09-16 03:43:02 +0000 |
---|---|---|
committer | wei <> | 2006-09-16 03:43:02 +0000 |
commit | 2d8fc0f1818aa896bebedf8cbeedffb17d048600 (patch) | |
tree | 2ef6ea939d5f018598ec2983086354000750fb70 /framework/Web/Javascripts/js/compressed | |
parent | d148330f1fe3cb6116a69e56ecd44c37bfb2a44e (diff) |
Fixed #340
Diffstat (limited to 'framework/Web/Javascripts/js/compressed')
-rw-r--r-- | framework/Web/Javascripts/js/compressed/ajax.js | 8 | ||||
-rw-r--r-- | framework/Web/Javascripts/js/compressed/logger.js | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/framework/Web/Javascripts/js/compressed/ajax.js b/framework/Web/Javascripts/js/compressed/ajax.js index cc7348cd..7e9cf3ec 100644 --- a/framework/Web/Javascripts/js/compressed/ajax.js +++ b/framework/Web/Javascripts/js/compressed/ajax.js @@ -50,7 +50,7 @@ Prado.CallbackRequest.Exception.onException(null,e);}}},Exception:{"on500":funct {var msg='HTTP '+transport.status+" with response : \n";msg+=transport.responseText+"\n";msg+="Data : \n"+inspect(data)+"\n";msg+="Actions : \n";data=request.getHeaderData(Prado.CallbackRequest.ACTION_HEADER);if(data&&data.length>0) {data.each(function(action) {msg+=inspect(action)+"\n";});} -Logger.warn(msg);}},onException:function(request,e) +Logger.info(msg);}},onException:function(request,e) {msg="";$H(e).each(function(item) {msg+=item.key+": "+item.value+"\n";}) Logger.error('Uncaught Callback Client Exception:',msg);},formatException:function(e) @@ -65,13 +65,15 @@ return null;},dispatchPriorityRequest:function(callback) {Prado.CallbackRequest.abortRequestInProgress();},callback.options.RequestTimeOut);this.requestInProgress=callback;return true;},dispatchNormalRequest:function(callback) {new Ajax.Request(callback.url,callback.options);return true;},abortRequestInProgress:function() {inProgress=Prado.CallbackRequest.requestInProgress;if(inProgress) -{inProgress.request.transport.abort();clearTimeout(inProgress.timeout);Prado.CallbackRequest.requestInProgress=null;return true;} +{if(inProgress.request.transport.readyState<4) +inProgress.request.transport.abort();clearTimeout(inProgress.timeout);Prado.CallbackRequest.requestInProgress=null;return true;} return false;},updatePageState:function(request,transport) {pagestate=$(this.FIELD_CALLBACK_PAGESTATE);if(request.options.EnablePageStateUpdate&&request.options.HasPriority&&pagestate) {data=request.header(this.PAGESTATE_HEADER);if(typeof(data)=="string"&&data.length>0) pagestate.value=data;else {if(typeof(Logger)!="undefined") -Logger.debug("Bad page state:"+data);}}}}) +Logger.warn("Missing page state:"+data);return false;}} +return true;}}) Ajax.Responders.register({onComplete:function(request) {if(request.options.HasPriority) Prado.CallbackRequest.abortRequestInProgress();}});Event.OnLoad(function() diff --git a/framework/Web/Javascripts/js/compressed/logger.js b/framework/Web/Javascripts/js/compressed/logger.js index aaef1482..728c81e5 100644 --- a/framework/Web/Javascripts/js/compressed/logger.js +++ b/framework/Web/Javascripts/js/compressed/logger.js @@ -26,7 +26,15 @@ return cookieArray},clear:function(name){this.set(name,"",-1)},clearAll:function for(var i=0;i<cookies.length;i++){this.clear(cookies[i].name)}}} Logger={logEntries:[],onupdate:new CustomEvent(),onclear:new CustomEvent(),log:function(message,tag){var logEntry=new LogEntry(message,tag||"info") this.logEntries.push(logEntry) -this.onupdate.dispatch(logEntry)},info:function(message){this.log(message,'info')},debug:function(message){this.log(message,'debug')},warn:function(message){this.log(message,'warning')},error:function(message,error){this.log(message+": \n"+error,'error')},clear:function(){this.logEntries=[] +this.onupdate.dispatch(logEntry)},info:function(message){this.log(message,'info') +if(typeof(console)!="undefined") +console.info(message);},debug:function(message){this.log(message,'debug') +if(typeof(console)!="undefined") +console.debug(message);},warn:function(message){this.log(message,'warning') +if(typeof(console)!="undefined") +console.warn(message);},error:function(message,error){this.log(message+": \n"+error,'error') +if(typeof(console)!="undefined") +console.error(message);},clear:function(){this.logEntries=[] this.onclear.dispatch()}} LogEntry=Class.create() LogEntry.prototype={initialize:function(message,tag){this.message=message |