From 2d8fc0f1818aa896bebedf8cbeedffb17d048600 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 16 Sep 2006 03:43:02 +0000 Subject: Fixed #340 --- framework/Web/Javascripts/js/compressed/ajax.js | 8 +- framework/Web/Javascripts/js/compressed/logger.js | 10 +- framework/Web/Javascripts/js/debug/ajax.js | 11 +- framework/Web/Javascripts/js/debug/logger.js | 253 +++++++++++----------- 4 files changed, 153 insertions(+), 129 deletions(-) (limited to 'framework/Web/Javascripts/js') 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= this.outputElement.scrollHeight - + this.outputCount++ - style = (style ? style += ';' : '') - style += 'padding:1px;margin:0 0 5px 0' - + style = (style ? style += ';' : '') + style += 'padding:1px;margin:0 0 5px 0' + if (this.outputCount % 2 == 0) style += ";background-color:#101010" - + message = message || "undefined" message = message.toString().escapeHTML() - + this.outputElement.innerHTML += "
" + message + "
" - - if (shouldScroll) { + + if (shouldScroll) { this.outputElement.scrollTop = this.outputElement.scrollHeight } }, - + updateTags : function() { var pattern = this.tagFilterElement.value - + if (this.tagPattern == pattern) return try { @@ -341,19 +350,19 @@ LogConsole.prototype = { catch (e) { return } - + this.tagPattern = pattern Cookie.set('tagPattern', this.tagPattern) this.outputElement.innerHTML = "" - + // Go through each log entry again this.outputCount = 0; for (var i = 0; i < Logger.logEntries.length; i++) { this.logUpdate(Logger.logEntries[i]) - } + } }, - + repositionWindow : function() { var offset = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop var pageHeight = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight @@ -380,35 +389,35 @@ LogConsole.prototype = { }, handleInput : function(e) { - if (e.keyCode == Event.KEY_RETURN ) { + if (e.keyCode == Event.KEY_RETURN ) { var command = this.inputElement.value - + switch(command) { case "clear": - Logger.clear() + Logger.clear() break - - default: - var consoleOutput = "" - + + default: + var consoleOutput = "" + try { - consoleOutput = eval(this.inputElement.value) + consoleOutput = eval(this.inputElement.value) } - catch (e) { - Logger.error("Problem parsing input <" + command + ">", e) + catch (e) { + Logger.error("Problem parsing input <" + command + ">", e) break } - - Logger.log(consoleOutput) + + Logger.log(consoleOutput) break - } - + } + if (this.inputElement.value != "" && this.inputElement.value != this.commandHistory[0]) { this.commandHistory.unshift(this.inputElement.value) } - - this.commandIndex = 0 - this.inputElement.value = "" + + this.commandIndex = 0 + this.inputElement.value = "" } else if (e.keyCode == Event.KEY_UP && this.commandHistory.length > 0) { this.inputElement.value = this.commandHistory[this.commandIndex] @@ -416,23 +425,23 @@ LogConsole.prototype = { if (this.commandIndex < this.commandHistory.length - 1) { this.commandIndex += 1 } - } + } else if (e.keyCode == Event.KEY_DOWN && this.commandHistory.length > 0) { - if (this.commandIndex > 0) { + if (this.commandIndex > 0) { this.commandIndex -= 1 - } + } this.inputElement.value = this.commandHistory[this.commandIndex] - } + } else { this.commandIndex = 0 } - } -} + } +} // Load the Console when the window loads var logConsole; -Event.OnLoad(function() { logConsole = new LogConsole()}); +Event.OnLoad(function() { logConsole = new LogConsole()}); @@ -440,7 +449,7 @@ Event.OnLoad(function() { logConsole = new LogConsole()}); // ------------------------- // Helper Functions And Junk // ------------------------- -function inspect(o) +function inspect(o) { var objtype = typeof(o); if (objtype == "undefined") { @@ -457,7 +466,7 @@ function inspect(o) return "[" + typeof(o) + "]"; } - if (typeof(o) == "function") + if (typeof(o) == "function") { o = ostring.replace(/^\s+/, ""); var idx = o.indexOf("{"); @@ -466,9 +475,9 @@ function inspect(o) } return o; } - - var reprString = function (o) - { + + var reprString = function (o) + { return ('"' + o.replace(/(["\\])/g, '\\$1') + '"' ).replace(/[\f]/g, "\\f" ).replace(/[\b]/g, "\\b" @@ -509,7 +518,7 @@ function inspect(o) } return "[" + res.join(", ") + "]"; } - + // generic object code path res = []; for (var k in o) { @@ -530,7 +539,7 @@ function inspect(o) res.push(useKey + ":" + val); } return "{" + res.join(", ") + "}"; -} +} Array.prototype.contains = function(object) { for(var i = 0; i < this.length; i++) { @@ -538,10 +547,10 @@ Array.prototype.contains = function(object) { } return false -} +} // Helper Alias for simple logging -var puts = function() {return Logger.log(arguments[0], arguments[1])} +var puts = function() {return Logger.log(arguments[0], arguments[1])} /************************************* @@ -550,23 +559,23 @@ var puts = function() {return Logger.log(arguments[0], arguments[1])} last revision:04.11.2004 steve@slayeroffice.com http://slayeroffice.com - + (c)2004 S.G. Chipman Please notify me of any modifications - you make to this code so that I can + you make to this code so that I can update the version hosted on slayeroffice.com ************************************/ if(typeof Prado == "undefined") var Prado = {}; -Prado.Inspector = +Prado.Inspector = { - d : document, + d : document, types : new Array(), objs : new Array(), - hidden : new Array(), + hidden : new Array(), opera : window.opera, displaying : '', nameList : new Array(), @@ -583,23 +592,23 @@ Prado.Inspector = if(typeof obj == "string") { name = obj; obj = eval(obj); } win= typeof obj == 'undefined' ? window : obj; this.displaying = name ? name : win.toString(); - for(js in win) { + for(js in win) { try { if(win[js] && js.toString().indexOf("Inspector")==-1 && (win[js]+"").indexOf("[native code]")==-1) { - + t=typeof(win[js]); - if(!this.objs[t.toString()]) { + if(!this.objs[t.toString()]) { this.types[this.types.length]=t; this.objs[t]={}; this.nameList[t] = new Array(); } this.nameList[t].push(js); - this.objs[t][js] = this.format(win[js]+""); + this.objs[t][js] = this.format(win[js]+""); } } catch(err) { } } - for(i=0;i"+list[i]+""; + links[i+1] = ""+list[i]+""; } return links.join("."); }, @@ -636,11 +645,11 @@ Prado.Inspector = mHTML +="