Index: branches/5.2.x/core/kernel/utility/debugger/debugger.js =================================================================== diff -u -N -r16056 -r16410 --- branches/5.2.x/core/kernel/utility/debugger/debugger.js (.../debugger.js) (revision 16056) +++ branches/5.2.x/core/kernel/utility/debugger/debugger.js (.../debugger.js) (revision 16410) @@ -60,6 +60,7 @@ // Debugger function Debugger($params) { this.RowSeparator = ''; + this.FilterTypes = $params['FilterTypes']; this.IsFatalError = false; this.ErrorsCount = 0; this.SQLCount = 0; @@ -215,11 +216,28 @@ this.MakeDragable('debug_toolbar_span', function() {}, function() {}, function() {}); } -Debugger.prototype.AppendRow = function($html) { +Debugger.prototype.AppendRow = function($html, $row_type) { + var $message_type = $row_type || 'other'; + + if ( $message_type == 'warning' || $message_type == 'notice' ) { + $row_type = 'error'; + } else { + $row_type = $message_type; + } + this.RowCount++; var $tr = document.createElement('TR'); this.DebuggerTable.appendChild($tr); $tr.className = 'debug_row_' + (this.RowCount % 2 ? 'odd' : 'even'); + + if ( this.RowCount > 2 ) { + $tr.setAttribute('data-row-type', $row_type); + + if ( $message_type == 'error' ) { + document.getElementById('debug_row_' + (this.RowCount -1 )).setAttribute('data-row-type', 'error'); + } + } + $tr.id = 'debug_row_' + this.RowCount; var $td = document.createElement('TD'); $td.className = 'debug_cell'; @@ -365,6 +383,22 @@ if ($e.preventDefault) $e.preventDefault(); } +Debugger.prototype.Filter = function() { + + var $new_filter = document.getElementById('dbg_filter').value; + var $container_class_name = 'debug_layer_container'; + + if ( $new_filter != '' ) { + for (var index = 0; index < this.FilterTypes.length; ++index) { + if ( this.FilterTypes[index] != $new_filter ) { + $container_class_name += ' dbg-' + this.FilterTypes[index] + '-row-hidden'; + } + } + } + + this.DebuggerDIV.className = $container_class_name; +} + Debugger.prototype.Toggle = function($KeyCode) { if(!this.DebuggerDIV) return false; this.IsVisible = this.DebuggerDIV.style.display == 'none' ? false : true; @@ -400,7 +434,8 @@ } for (var $i = 0; $i < contents.length - 1; $i++) { - p_object.AppendRow(contents[$i]); + $json = eval('(' + contents[$i] + ')'); + p_object.AppendRow($json['html'], $json['row_type']); } if ( p_object.jQueryFound() ) { Index: branches/5.2.x/core/kernel/utility/debugger.php =================================================================== diff -u -N -r16272 -r16410 --- branches/5.2.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 16272) +++ branches/5.2.x/core/kernel/utility/debugger.php (.../debugger.php) (revision 16410) @@ -1,6 +1,6 @@ Data[$data_index]; + + switch ($data['debug_type']) { + case 'html': + if ( strpos($data['html'], 'SQL Total time') !== false ) { + return self::ROW_TYPE_SQL; + } + break; + + case 'error': + $error_map = array( + 'Fatal Error' => self::ROW_TYPE_ERROR, + 'Warning' => self::ROW_TYPE_WARNING, + 'Notice' => self::ROW_TYPE_NOTICE, + ); + + return $error_map[$this->getErrorNameByCode($data['no'])]; + break; + + case 'exception': + return self::ROW_TYPE_ERROR; + break; + + case 'profiler': + if ( preg_match('/^sql_/', $data['profile_key']) ) { + return self::ROW_TYPE_SQL; + } + break; + } + + return self::ROW_TYPE_OTHER; + } + + /** * Returns debugger report window width excluding scrollbar * * @return int @@ -1479,7 +1533,7 @@ $this->appendSession(); // show php session if any // ensure, that 1st line of debug output always is this one: - $top_line = '
[Reload Frame] [Hide Debugger] [Clear Debugger][Current Time: ' . date('H:i:s') . '] [File Size: #DBG_FILESIZE#]
'; + $top_line = '
[Reload Frame] [Hide Debugger] [Clear Debugger][Current Time: ' . date('H:i:s') . '] [File Size: #DBG_FILESIZE#]
' . $this->getFilterDropdown() . '
'; $this->appendHTML($top_line); $this->moveToBegin(1); @@ -1563,7 +1617,10 @@ $lineCount = count($this->Data); while ( $i < $lineCount ) { - fwrite($fp, $this->prepareHTML($i) . $this->rowSeparator); + $html = $this->prepareHTML($i); + $row_type = $this->getRowType($i); + + fwrite($fp, json_encode(Array ('html' => $html, 'row_type' => $row_type)) . $this->rowSeparator); $i++; } @@ -1579,6 +1636,7 @@ $dbg_path = str_replace(FULL_PATH, '', $this->tempFolder); $debugger_params = Array ( + 'FilterTypes' => $this->_filterTypes, 'RowSeparator' => $this->rowSeparator, 'ErrorsCount' => (int)$this->getProfilerTotal('error_handling'), 'IsFatalError' => $this->_fatalErrorHappened(), @@ -1646,6 +1704,17 @@ return ''; } + function getFilterDropdown() + { + $filter_options = ''; + + foreach ( $this->_filterTypes as $filter_type ) { + $filter_options .= ''; + } + + return 'Show: '; + } + function getMemoryUsed($debugger_start) { if ( !isset($this->ProfilerTotals['error_handling']) ) { Index: branches/5.2.x/core/kernel/utility/debugger/debugger.css =================================================================== diff -u -N -r15530 -r16410 --- branches/5.2.x/core/kernel/utility/debugger/debugger.css (.../debugger.css) (revision 15530) +++ branches/5.2.x/core/kernel/utility/debugger/debugger.css (.../debugger.css) (revision 16410) @@ -132,4 +132,5 @@ padding: 0px; } - +.dbg-error-row-hidden tr[data-row-type="error"], .dbg-sql-row-hidden tr[data-row-type="sql"], +.dbg-other-row-hidden tr[data-row-type="other"] {display: none} \ No newline at end of file Index: branches/5.2.x/index.php =================================================================== diff -u -N -r16409 -r16410 --- branches/5.2.x/index.php (.../index.php) (revision 16409) +++ branches/5.2.x/index.php (.../index.php) (revision 16410) @@ -1,6 +1,6 @@