Source for file console.phtml

Documentation is available at console.phtml

  1. 1: <?php
  2. 2:  
  3. 3: /**
  4. 4:  * Nette Framework - Dump console template.
  5. 5:  *
  6. 6:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  7. 7:  * @license    http://nettephp.com/license  Nette license
  8. 8:  * @link       http://nettephp.com
  9. 9:  * @category   Nette
  10. 10:  * @package    Nette
  11. 11:  *
  12. 12:  * @param      array     $payload 
  13. 13:  * @return     void 
  14. 14:  */
  15. 15:  
  16. 16:  
  17. 17:  
  18. 18: if (!function_exists('_netteDumpCb2')) {
  19. 19:  
  20. 20:     function _netteDumpCb2($m)
  21. 21:     {
  22. 22:         return "$m[1]<a href='#' onclick='return !netteToggle(this)'>$m[2]($m[3]($m[3'<abbr>&#x25bc;</abbr> </a><code>' '<abbr>&#x25ba;</abbr> </a><code class="collapsed">');
  23. 23:     }
  24. 24: }
  25. 25:  
  26. 27:  
  27. 28: ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  28. 29: <html lang="en">
  29. 30: <head>
  30. 31:     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  31. 32:     <meta name="robots" content="noindex,noarchive">
  32. 33:     <meta name="generator" content="Nette Framework">
  33. 34:  
  34. 35:     <title>Nette Debug Console</title>
  35. 36:  
  36. 37:     <style type="text/css">body{margin:0;padding:0;font:9pt/1.5 Verdana,sans-serif;background:white;color:#333}h1{font-size:13pt;margin:0;padding:2px 8px;background:black;color:white;border-bottom:1px solid black}h2{font:11pt/1.5 sans-serif;margin:0;padding:2px 8px;background:#3484d2;color:white}a{text-decoration:none;color:#4197E3}a abbr{font-family:sans-serif;color:#999}p{margin:.8em 0}pre,code,table{font:9pt/1.5 Consolas,monospace}pre,table{background:#fffbcc;padding:.4em .7em;border:1px dotted silver}table pre{padding:0;margin:0;border:none}pre.dump span{color:#c16549}pre.dump a{color:#333}table{border-collapse:collapse;width:100%}td,th{vertical-align:top;text-align:left;border:1px solid #eeb}th{width:10;padding:2px 3px 2px 8px;font-weight:bold}td{padding:2px 8px 2px 3px}.odd,.odd pre{background:#faf5c3}</style>
  37. 38:  
  38. 39:  
  39. 40:     <script type="text/javascript">/*<![CDATA[*/document.write("<style> .collapsed { display: none; } </style>");function netteToggle(a,b){var c=a.getElementsByTagName("abbr")[0];for(a=b?document.getElementById(b):a.nextSibling;a.nodeType!==1;)a=a.nextSibling;b=a.currentStyle?a.currentStyle.display=="none":getComputedStyle(a,null).display=="none";c.innerHTML=String.fromCharCode(b?9660:9658);a.style.display=b?a.tagName.toLowerCase()==="code"?"inline":"block":"none";return true};/*]]>*/</script>
  40. 41: </head>
  41. 42:  
  42. 43:  
  43. 44:  
  44. 45: <body>
  45. 46:     <h1>Nette Debug Console</h1>
  46. 47: </body>
  47. 48: </html>
  48. 49: <?php $document ob_get_clean(?>
  49. 50:  
  50. 51: <?php ob_start(?>
  51. 52: <?php foreach ($payload as $item)?>
  52. 53:     <?php if ($item['title']):?>
  53. 54:     <h2><?php echo htmlspecialchars($item['title']?></h2>
  54. 55:     <?php endif ?>
  55. 56:  
  56. 57:     <table>
  57. 58:     <?php $i ?>
  58. 59:     <?php foreach ($item['dump'as $key => $dump)?>
  59. 60:     <tr class="<?php echo $i++ % 'odd' 'even' ?>">
  60. 61:         <th><?php echo htmlspecialchars($key?></th>
  61. 62:         <td><?php echo preg_replace_callback('#(<pre class="dump">|\s+)?(.*)\((\d+)\) <code>#''_netteDumpCb2'$dump?></td>
  62. 63:     </tr>
  63. 64:     <?php endforeach ?>
  64. 65:     </table>
  65. 66: <?php endforeach ?>
  66. 67: <?php $body ob_get_clean(?>
  67. 68:  
  68. 69: <script type="text/javascript">
  69. 70: /* <![CDATA[ */
  70. 71: if (typeof _netteConsole === 'undefined') {
  71. 72:     _netteConsole = window.open('','_netteConsole','width=700,height=700,resizable,scrollbars=yes');
  72. 73:     _netteConsole.document.write(<?php echo json_encode(preg_replace('#[ \t\r\n]+#'' '$document)) ?>);
  73. 74:     _netteConsole.document.close();
  74. 75:     _netteConsole.document.onkeyup = function(e) {
  75. 76:         e = e || _netteConsole.event;
  76. 77:         if (e.keyCode == 27) _netteConsole.close();
  77. 78:     }
  78. 79:     _netteConsole.document.body.focus();
  79. 80: }
  80. 81: _netteConsole.document.body.innerHTML = _netteConsole.document.body.innerHTML + <?php echo json_encode($body?>;
  81. 82: /* ]]> */
  82. 83: </script>