1 /* 2 * Naos Framework 3 * 4 * LICENSE 5 * http://www.naos-framework.com/website.naos.framework/en/license 6 * 7 * Copyright (c) 2008 Jupiter GmbH 8 */ 9 10 /** 11 * This class provides a debug window and the necessary debug call for 12 * collecting debug data. 13 * @namespace 14 */ 15 NaosDebug = {} 16 17 /** 18 * The handle to the debug window. 19 * @type Window 20 */ 21 NaosDebug.window = null; 22 23 /** 24 * Enables the debug window. 25 * @private 26 */ 27 NaosDebug.enable = function() { 28 NaosDebug.window = window.open(naosConfig.application.base_url+"/naos/naos/debug_dummy.html", "NaosDebugWindow", "dependent=yes,height=300,width=500,resizable=yes,menubar=no,location=no,scrollbars=yes,status=no,toolbar=no,top=0,left=0"); 29 NaosDebug.window.blur(); 30 31 NaosDebug.window.document.open(); 32 NaosDebug.window.document.write("<html><head><title>Naos Debug Window - "+naosConfig.application.title+"</title></head><body>"); 33 NaosDebug.window.document.write("<div id=\"debugOutput\"></div>"); 34 NaosDebug.window.document.write("</body></html>"); 35 NaosDebug.window.document.close(); 36 37 NaosDebug.debug("[NaosDebug]: Debug window initialized."); 38 } 39 40 /** 41 * This is the core method to display debug messages. Use it 42 * all over your JavaScript code! 43 * @param msg The debug message 44 */ 45 NaosDebug.debug = function(/**String*/ msg) { 46 if(NaosDebug.window != null && !NaosDebug.window.closed && NaosDebug.window.document != null) 47 { 48 var debugOutputObject = NaosDebug.window.document.getElementById("debugOutput"); 49 debugOutputObject.innerHTML = debugOutputObject.innerHTML + "<div style=\"margin: 3px; padding: 1px; border: 1px solid black; font-size: 8pt;\"><strong>"+(new Date()).toLocaleString()+"</strong><br/>"+msg.encodeXMLViewable()+"</div>"; 50 } 51 } 52