﻿Type.registerNamespace("PhotoSite.Framework");PhotoSite.Framework.TraceLevel=function(){};PhotoSite.Framework.TraceLevel.prototype={Debug:1,Info:2,Warn:3,Error:4,Fatal:5,Off:6};PhotoSite.Framework.TraceLevel.registerEnum("PhotoSite.Framework.TraceLevel",false);PhotoSite.Framework.Logger=function(B,C,A){this._traceConsole=B;this._traceName=C;this._traceLevel=A;};PhotoSite.Framework.Logger.prototype={debug:function(C,E){if(E&&typeof(E)=="object"){var D=new Sys.StringBuilder(C);D.append(": [");var A=true;for(var B in E){if(A==false){D.append(", ");}D.append(B);D.append(":");D.append(E[B]);A=false;}D.append("]");this.trace(PhotoSite.Framework.TraceLevel.Debug,D.toString());}else{this.trace(PhotoSite.Framework.TraceLevel.Debug,C);}},info:function(A){this.trace(PhotoSite.Framework.TraceLevel.Info,A);},warn:function(A,B){this.trace(PhotoSite.Framework.TraceLevel.Warn,A,B);},error:function(A,B){this.trace(PhotoSite.Framework.TraceLevel.Error,A,B);},fatal:function(A,B){this.trace(PhotoSite.Framework.TraceLevel.Fatal,A,B);},trace:function(A,B,C){if(A<this._traceLevel){return;}this._traceConsole.write(this._traceName,this._traceLevel,B,C);},initialize:function(){PhotoSite.Framework.Logger.callBaseMethod(this,"initialize");},dispose:function(){PhotoSite.Framework.Logger.callBaseMethod(this,"dispose");},get_traceLevel:function(){return this._traceLevel;},set_traceLevel:function(A){if(this._traceLevel!==A){this._traceLevel=A;this.trace(PhotoSite.Framework.TraceLevel.Off,"TraceLevelSet: "+A);}}};PhotoSite.Framework.Logger.registerClass("PhotoSite.Framework.Logger",Sys.Component);PhotoSite.Framework.TraceConsole=function(A){PhotoSite.Framework.TraceConsole.initializeBase(this,[A]);this._active=false;this._defaultTraceLevel=PhotoSite.Framework.TraceLevel.Warn;this._defaultLogger=null;this._loggers=new Object();this._inputConsoleHandler=Function.createDelegate(this,this._onInputConsole);this._inputConsoleKeypressHandler=Function.createDelegate(this,this._onInputConsoleKeypress);this._toEndTimerId=null;this._toEndTimerHandler=Function.createDelegate(this,this._onToEndTimer);this._entry=false;};PhotoSite.Framework.TraceConsole.prototype={write:function(C,B,A,D){if(this._active==false){return;}if(typeof(A)=="object"){Sys.Debug.trace(C+"["+B+"] dump:");Sys.Debug.traceDump(A);}else{Sys.Debug.trace(C+"["+B+"]:"+A);}if(D){Sys.Debug.trace(this._traceName+"  exception:"+D);}this._entry=true;},_onToEndTimer:function(){if(this._entry==true){this.toEnd();}this._entry=false;},toEnd:function(){var A=$get("TraceConsole");A.scrollTop=A.scrollHeight;},addLogger:function(C,A){var B=new PhotoSite.Framework.Logger(C,A);B.initialize();this._loggers[C]=B;},getLogger:function(A){return this._defaultLogger;},clear:function(){$get("TraceConsole").value="";},_onInputConsole:function(){var A=$get("InputConsole").value;this._exec(A);$get("InputConsole").value="";},_onInputConsoleKeypress:function(A){},_exec:function(code){this._defaultLogger.info(code);eval(code);},initialize:function(){PhotoSite.Framework.TraceConsole.callBaseMethod(this,"initialize");this.get_element().Console=this;this._initDefaultLogger();this._initInput();$log=function(A){return $get("TraceConsole").Console.getLogger(A);};this._toEndTimerId=setInterval(this._toEndTimerHandler,500);},_initDefaultLogger:function(){this._defaultLogger=new PhotoSite.Framework.Logger(this,"",this._defaultTraceLevel);this._defaultLogger.initialize();},_initInput:function(){var A=$get("InputConsole");if(A){$addHandler(A,"click",this._inputConsoleHandler);$addHandler(A,"keypress",this._inputConsoleKeypressHandler);}},_disposeInput:function(){var A=$get("InputConsole");if(A){try{$removeHandler(A,"click",this._inputConsoleHandler);}catch(B){}try{$removeHandler(A,"keypress",this._inputConsoleKeypressHandler);}catch(B){}}},dispose:function(){clearInterval(this._toEndTimerId);this._disposeInput();PhotoSite.Framework.TraceConsole.callBaseMethod(this,"dispose");},get_active:function(){return this._active;},set_active:function(A){if(this._active!==A){this._active=A;this.raisePropertyChanged("active");}},get_defaultTraceLevel:function(){return this._defaultTraceLevel;},set_defaultTraceLevel:function(A){if(this._defaultTraceLevel!==A){this._defaultTraceLevel=A;this.raisePropertyChanged("defaultTraceLevel");}}};PhotoSite.Framework.TraceConsole.registerClass("PhotoSite.Framework.TraceConsole",Sys.UI.Control);if(typeof(Sys)!=="undefined"){Sys.Application.notifyScriptLoaded();}
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();