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">
  37. 38:     /* <![CDATA[ */
  38. 39:         body {
  39. 40:             margin: 0;
  40. 41:             padding: 0;
  41. 42:             font: 9pt/1.5 Verdana, sans-serif;
  42. 43:             background: white;
  43. 44:             color: #333;
  44. 45:         }
  45. 46:  
  46. 47:         h1 {
  47. 48:             font-size: 13pt;
  48. 49:             margin: 0;
  49. 50:             padding: 2px 8px;
  50. 51:             background: black;
  51. 52:             color: white;
  52. 53:             border-bottom: 1px solid black;
  53. 54:         }
  54. 55:  
  55. 56:         h2 {
  56. 57:             font: 11pt/1.5 sans-serif;
  57. 58:             margin: 0;
  58. 59:             padding: 2px 8px;
  59. 60:             background: #3484d2;
  60. 61:             color: white;
  61. 62:         }
  62. 63:  
  63. 64:         a {
  64. 65:             text-decoration: none;
  65. 66:             color: #4197E3;
  66. 67:         }
  67. 68:  
  68. 69:         a abbr {
  69. 70:             font-family: sans-serif;
  70. 71:             color: #999;
  71. 72:         }
  72. 73:  
  73. 74:         p {
  74. 75:             margin: .8em 0
  75. 76:         }
  76. 77:  
  77. 78:         pre, code, table {
  78. 79:             font: 9pt/1.5 Consolas, monospace;
  79. 80:         }
  80. 81:  
  81. 82:         pre, table {
  82. 83:             background: #fffbcc;
  83. 84:             padding: .4em .7em;
  84. 85:             border: 1px dotted silver;
  85. 86:         }
  86. 87:  
  87. 88:         table pre {
  88. 89:             padding: 0;
  89. 90:             margin: 0;
  90. 91:             border: none;
  91. 92:         }
  92. 93:  
  93. 94:         pre.dump span {
  94. 95:             color: #c16549;
  95. 96:         }
  96. 97:  
  97. 98:         pre.dump a {
  98. 99:             color: #333;
  99. 100:         }
  100. 101:  
  101. 102:         table {
  102. 103:             border-collapse: collapse;
  103. 104:             width: 100%;
  104. 105:         }
  105. 106:  
  106. 107:         td, th {
  107. 108:             vertical-align: top;
  108. 109:             text-align: left;
  109. 110:             border: 1px solid #eeeebb;
  110. 111:         }
  111. 112:  
  112. 113:         th {
  113. 114:             width: 10;
  114. 115:             padding: 2px 3px 2px 8px;
  115. 116:             font-weight: bold;
  116. 117:         }
  117. 118:  
  118. 119:         td {
  119. 120:             padding: 2px 8px 2px 3px;
  120. 121:         }
  121. 122:  
  122. 123:         .odd, .odd pre {
  123. 124:             background: #faf5c3;
  124. 125:         }
  125. 126:  
  126. 127:     /* ]]> */
  127. 128:     </style>
  128. 129:  
  129. 130:  
  130. 131:     <script type="text/javascript">
  131. 132:     /* <![CDATA[ */
  132. 133:         document.write('<style> .collapsed { display: none; } <\/style>');
  133. 134:  
  134. 135:         function netteToggle(link, panelId)
  135. 136:         {
  136. 137:             var arrow = link.getElementsByTagName('abbr')[0];
  137. 138:             var panel = panelId ? document.getElementById(panelId) : link.nextSibling;
  138. 139:             while (panel.nodeType !== 1) panel = panel.nextSibling;
  139. 140:             var collapsed = panel.currentStyle ? panel.currentStyle.display == 'none' : getComputedStyle(panel, null).display == 'none';
  140. 141:  
  141. 142:             arrow.innerHTML = String.fromCharCode(collapsed ? 0x25bc : 0x25ba);
  142. 143:             panel.style.display = collapsed ? (panel.tagName.toLowerCase() === 'code' ? 'inline' : 'block') : 'none';
  143. 144:  
  144. 145:             return true;
  145. 146:         }
  146. 147:     /* ]]> */
  147. 148:     </script>
  148. 149: </head>
  149. 150:  
  150. 151:  
  151. 152:  
  152. 153: <body>
  153. 154:     <h1>Nette Debug Console</h1>
  154. 155: </body>
  155. 156: </html>
  156. 157: <?php $document ob_get_clean(?>
  157. 158:  
  158. 159: <?php ob_start(?>
  159. 160: <?php foreach ($payload as $item)?>
  160. 161:     <?php if ($item['title']):?>
  161. 162:     <h2><?php echo htmlspecialchars($item['title']?></h2>
  162. 163:     <?php endif ?>
  163. 164:  
  164. 165:     <table>
  165. 166:     <?php $i ?>
  166. 167:     <?php foreach ($item['dump'as $key => $dump)?>
  167. 168:     <tr class="<?php echo $i++ % 'odd' 'even' ?>">
  168. 169:         <th><?php echo htmlspecialchars($key?></th>
  169. 170:         <td><?php echo preg_replace_callback('#(<pre class="dump">|\s+)?(.*)\((\d+)\) <code>#''_netteDumpCb2'$dump?></td>
  170. 171:     </tr>
  171. 172:     <?php endforeach ?>
  172. 173:     </table>
  173. 174: <?php endforeach ?>
  174. 175: <?php $body ob_get_clean(?>
  175. 176:  
  176. 177: <script type="text/javascript">
  177. 178: /* <![CDATA[ */
  178. 179: if (typeof _netteConsole === 'undefined') {
  179. 180:     _netteConsole = window.open('','_netteConsole','width=700,height=700,resizable,scrollbars=yes');
  180. 181:     _netteConsole.document.write(<?php echo json_encode(preg_replace('#[ \t\r\n]+#'' '$document)) ?>);
  181. 182:     _netteConsole.document.close();
  182. 183:     _netteConsole.document.onkeyup = function(e) {
  183. 184:         e = e || _netteConsole.event;
  184. 185:         if (e.keyCode == 27) _netteConsole.close();
  185. 186:     }
  186. 187:     _netteConsole.document.body.focus();
  187. 189: _netteConsole.document.body.innerHTML = _netteConsole.document.body.innerHTML + <?php echo json_encode($body?>;
  188. 190: /* ]]> */
  189. 191: </script>