[Phpfreechat-svn] SF.net SVN: phpfreechat: [825] trunk/src
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2006-10-07 18:20:22
|
Revision: 825 http://svn.sourceforge.net/phpfreechat/?rev=825&view=rev Author: kerphi Date: 2006-10-07 11:20:15 -0700 (Sat, 07 Oct 2006) Log Message: ----------- [en] Improve the debug routines. [15min] [fr] Ameliore les routines de debogage. [15min] Modified Paths: -------------- trunk/src/client/chat.js.tpl.php trunk/src/client/pfcclient.js trunk/src/phpfreechat.class.php Modified: trunk/src/client/chat.js.tpl.php =================================================================== --- trunk/src/client/chat.js.tpl.php 2006-10-06 07:55:10 UTC (rev 824) +++ trunk/src/client/chat.js.tpl.php 2006-10-07 18:20:15 UTC (rev 825) @@ -1,7 +1,6 @@ <?php require_once(dirname(__FILE__)."/../../lib/json/JSON.php"); $json = new Services_JSON(); - ?> <?php $nick = $u->nick != "" ? $json->encode($u->nick) : $json->encode($c->nick); ?> @@ -137,6 +136,28 @@ text = s.escapeHTML(); rx = new RegExp('<','g'); text = text.replace(rx, '\n<'); - $('debugxajax').innerHTML += '\n---------------\n' + text; + $('pfc_debugxajax').innerHTML += '\n---------------\n' + text; } - <?php } ?> +<?php } ?> + +<?php if ($debug) { ?> +var pfc_debug_color = true; +function trace(text) { + var s = new String(text); + text = s.escapeHTML(); + rx = new RegExp('<','g'); + text = text.replace(rx, '\n<'); + var color = ''; + if (pfc_debug_color) + { + color = '#BBB'; + pfc_debug_color = false; + } + else + { + color = '#DDD'; + pfc_debug_color = true; + } + $('pfc_debug').innerHTML += '<p style="margin:0;border-bottom:1px solid #555;background-color:'+color+'">' + text + '</p>'; +} +<?php } ?> Modified: trunk/src/client/pfcclient.js =================================================================== --- trunk/src/client/pfcclient.js 2006-10-06 07:55:10 UTC (rev 824) +++ trunk/src/client/pfcclient.js 2006-10-07 18:20:15 UTC (rev 825) @@ -138,6 +138,8 @@ */ handleResponse: function(cmd, resp, param) { + if (pfc_debug) + if (cmd != "update") trace('handleResponse: '+cmd + "-"+resp+"-"+param); if (cmd == "connect") { //alert(cmd + "-"+resp+"-"+param); @@ -830,7 +832,7 @@ var recipientid = this.gui.getTabId(); var req = cmd+" "+this.clientid+" "+(recipientid==''?'0':recipientid)+(param?" "+param : ""); if (pfc_debug) - if (cmd != "/update") alert(req); + if (cmd != "/update") trace('sendRequest: '+req); return eval('pfc_handleRequest(req);'); }, Modified: trunk/src/phpfreechat.class.php =================================================================== --- trunk/src/phpfreechat.class.php 2006-10-06 07:55:10 UTC (rev 824) +++ trunk/src/phpfreechat.class.php 2006-10-07 18:20:15 UTC (rev 825) @@ -192,6 +192,18 @@ $output .= "<a href=\"http://www.phpfreechat.net\"><img src=\"http://www.phpfreechat.net/pub/logo_80x15.gif\" alt=\"PHP FREE CHAT [powered by phpFreeChat-".$c->version."]\" title=\"PHP FREE CHAT [powered by phpFreeChat-".$c->version."]\" /></a>"; $output .= "</div>"; + if ($c->debug) + { + $output .= '<div id="pfc_debug">'; + $output .= '</div>'; + } + + if ($c->debugxajax) + { + $output .= '<div id="pfc_debugxajax">'; + $output .= '</div>'; + } + $output .= "<script type=\"text/javascript\">\n"; $output .= " // <![CDATA[\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |