/*Uwd.System.Console = function() {
	
	var config = {
		id : 'uwd-system-console-win',
		title: 'Uwd.System.Console',
		html: 'testwin'
	};
	
	Uwd.System.Console.superclass.constructor.call(this, config);
};

Ext.extend(Uwd.System.Console, Ext.Window, {


});*/

Console = function(){	 	
	
	var logWindow = 0;
	
	// Public functions
	return {
		init : function() {},
		
		log : function(logString) {
			this.logWindow = Ext.getCmp('system-console-window');
			if (!this.logWindow) {
				this.logWindow = new Ext.Window({
					id: 'system-console-window',
					title: 'System Console',
					layout:'fit',
					resizable: false,
					closable: false,
					draggable: true,
					proxy: false,
					width:400,
					height:500,
					closable:true,
					autoScroll: true,
					modal:false,
					cls: 'x-plain',
					plain: true,
					html: '&nbsp;',			
					style: 'z-index: 30000;',
					buttons: [{
						text:'clear',
						handler: function(){
							this.logWindow.body.update('');
						}.createDelegate(this)
					}]
				});
				this.logWindow.show();
				
				setTimeout(function(){
					this.writeLog(logString);
				}.createDelegate(Console), 200);
			} else {
				this.writeLog(logString);	
			}
		},
		
		writeLog : function(logString) {
			var content = this.logWindow.body.dom.innerHTML;
			this.logWindow.body.update(content + 'UWD WebShell ~' + window.system.user.getName() + ':<br /><b>' + logString + '</b><br /><br />');
			this.logWindow.doLayout();
		}
	}
}();

