diff --git a/js/functions.js b/js/functions.js index b6f024913b..543a1d7284 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1355,8 +1355,7 @@ AJAX.registerOnload('functions.js', function () { var $form = $(this).prev('form'); var sql_query = $form.find("input[name='sql_query']").val(); - var $inner_sql = $(this).parent().prev().find('.inner_sql'); - var $sql_highlight = $(this).parent().prev().find('.sql-highlight'); + var $inner_sql = $(this).parent().prev().find('code.sql'); var old_text = $inner_sql.html(); var new_content = "\n"; @@ -1369,7 +1368,6 @@ AJAX.registerOnload('functions.js', function () { } $editor_area.html(new_content); $inner_sql.hide(); - $sql_highlight.hide(); bindCodeMirrorToInlineEditor(); return false; @@ -1392,8 +1390,7 @@ AJAX.registerOnload('functions.js', function () { }); $("input#sql_query_edit_discard").live('click', function () { - $('div#inline_editor_outer') - .siblings('.sql-highlight').show(); + $('div#inline_editor_outer').siblings('code.sql').show(); $('div#inline_editor_outer').remove(); }); @@ -3423,7 +3420,13 @@ function PMA_slidingMessage(msg, $obj) .children() .remove(); $obj - .append('
' + msg + '
') + .append('
' + msg + '
'); + // highlight any sql before taking height; + PMA_highlightSQL($obj); + $obj.find('div') + .first() + .hide(); + $obj .animate({ height: $obj.find('div').first().height() }) @@ -3434,12 +3437,15 @@ function PMA_slidingMessage(msg, $obj) } else { // Object does not already have a message // inside it, so we simply slide it down + $obj.width('100%') + .html('
' + msg + '
'); + // highlight any sql before taking height; + PMA_highlightSQL($obj); var h = $obj - .width('100%') - .html('
' + msg + '
') - .find('div') - .first() - .height(); + .find('div') + .first() + .hide() + .height(); $obj .find('div') .first() diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 158e2401c8..c110780c29 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -2831,7 +2831,7 @@ class PMA_DisplayResults if ($this->_isNeedToSyntaxHighlight($meta->name) && (trim($row[$i]) != '') ) { - $row[$i] = '' . PMA_Util::formatSql($row[$i]) . ''; + $row[$i] = PMA_Util::formatSql($row[$i]); include_once $this->transformation_info[strtolower($this->__get('db'))][strtolower($this->__get('table'))][strtolower($meta->name)][0]; $transformation_plugin = new $this->transformation_info [strtolower($this->__get('db'))] diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 6b7f51a4d6..590534b42d 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -408,9 +408,9 @@ class PMA_Util $cfg['MaxCharactersInDisplayedSQL'] ) . '[...]'; } - return '
' . "\n"
+        return '
' . "\n"
             . htmlspecialchars($sql_query) . "\n"
-            . '
'; + . '
'; } // end of the "formatSql()" function /** @@ -1279,7 +1279,7 @@ class PMA_Util if (! empty($GLOBALS['validatequery'])) { $retval .= '
'; } else { - $retval .= ''; + $retval .= '
'; } if ($query_too_big) { $retval .= $shortened_query_base; @@ -1291,11 +1291,7 @@ class PMA_Util if (! empty($GLOBALS['show_as_php'])) { $retval .= '";'; } - if (! empty($GLOBALS['validatequery'])) { - $retval .= '
'; - } else { - $retval .= '
'; - } + $retval .= '
'; $retval .= '
'; $retval .= '
'; diff --git a/libraries/plugins/transformations/abstract/SQLTransformationsPlugin.class.php b/libraries/plugins/transformations/abstract/SQLTransformationsPlugin.class.php index 8b4aa5202a..72e270bff2 100644 --- a/libraries/plugins/transformations/abstract/SQLTransformationsPlugin.class.php +++ b/libraries/plugins/transformations/abstract/SQLTransformationsPlugin.class.php @@ -44,7 +44,7 @@ abstract class SQLTransformationsPlugin extends TransformationsPlugin public function applyTransformation($buffer, $options = array(), $meta = '') { // see PMA_highlightSQL() - $result = '
' . $buffer . '
'; + $result = PMA_Util::formatSql($buffer); // Need to clear error state not to break subsequent queries display. PMA_SQP_resetError(); return $result; diff --git a/libraries/rte/rte_routines.lib.php b/libraries/rte/rte_routines.lib.php index 357311aa15..fcd93e591e 100644 --- a/libraries/rte/rte_routines.lib.php +++ b/libraries/rte/rte_routines.lib.php @@ -1374,12 +1374,7 @@ function PMA_RTN_handleExecute() if ($outcome) { // Pass the SQL queries through the "pretty printer" - $output = ''; - $output .= PMA_SQP_format( - PMA_SQP_parse(implode($queries)), - 'text' - ); - $output .= ''; + $output = PMA_Util::formatSql(implode($queries, "\n")); // Display results $output .= "
"; diff --git a/libraries/server_bin_log.lib.php b/libraries/server_bin_log.lib.php index 5ab4f0f560..a33a72f4e7 100644 --- a/libraries/server_bin_log.lib.php +++ b/libraries/server_bin_log.lib.php @@ -225,14 +225,6 @@ function PMA_getAllLogItemInfo($result, $dontlimitchars) $html = ""; $odd_row = true; while ($value = $GLOBALS['dbi']->fetchAssoc($result)) { - $len_info = $GLOBALS['PMA_String']->strlen($value['Info']); - $len_limitChars = $GLOBALS['cfg']['LimitChars']; - if (! $dontlimitchars && $len_info > $len_limitChars) { - $value['Info'] = $GLOBALS['PMA_String']->substr( - $value['Info'], 0, $GLOBALS['cfg']['LimitChars'] - ) . '...'; - } - $html .= '' . ' ' . $value['Log_name'] . ' ' . ' ' . $value['Pos'] . ' ' @@ -242,9 +234,8 @@ function PMA_getAllLogItemInfo($result, $dontlimitchars) . (isset($value['Orig_log_pos']) ? $value['Orig_log_pos'] : $value['End_log_pos']) . ' ' - . '
 ' . htmlspecialchars($value['Info'])
-            . ' 
' - . ''; + . ' ' . PMA_Util::formatSql($value['Info'], ! $dontlimitchars) + . ' '; $odd_row = !$odd_row; } diff --git a/libraries/server_status.lib.php b/libraries/server_status.lib.php index 41c7efea69..9db490caae 100644 --- a/libraries/server_status.lib.php +++ b/libraries/server_status.lib.php @@ -533,15 +533,7 @@ function PMA_getHtmlForServerProcessItem($process, $odd_row, $show_full_sql) if (empty($process['Info'])) { $retval .= '---'; } else { - $cfg_maxDisplaySQL = $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']; - if (! $show_full_sql && strlen($process['Info']) > $cfg_maxDisplaySQL) { - $info = substr($process['Info'], 0, $cfg_maxDisplaySQL); - $retval .= htmlspecialchars($info) . '[...]'; - } else { - $retval .= '
'
-                    . $process['Info']
-                    . '
'; - } + $retval .= PMA_Util::formatSql($process['Info'], ! $show_full_sql); } $retval .= ''; $retval .= ''; diff --git a/libraries/sqlparser.lib.php b/libraries/sqlparser.lib.php index 28dfb1c3d2..d6626cf481 100644 --- a/libraries/sqlparser.lib.php +++ b/libraries/sqlparser.lib.php @@ -2297,12 +2297,6 @@ function PMA_SQP_format( $html_line_break = '
'; break; } // end switch - // inner_sql is a span that exists for all cases, except query_only - // to make possible a replacement - // for inline editing - if ($mode!='query_only') { - $str .= ''; - } $indent = 0; $bracketlevel = 0; $functionlevel = 0; @@ -2739,10 +2733,6 @@ function PMA_SQP_format( $indent--; $str .= ($mode != 'query_only' ? '
' : ' '); } - if ($mode!='query_only') { - // close inner_sql span - $str .= '
'; - } return $str; } // end of the "PMA_SQP_format()" function diff --git a/test/libraries/common/PMA_formatSql_test.php b/test/libraries/common/PMA_formatSql_test.php index b9befacd5c..fc4f329210 100644 --- a/test/libraries/common/PMA_formatSql_test.php +++ b/test/libraries/common/PMA_formatSql_test.php @@ -19,9 +19,9 @@ class PMA_FormatSql_Test extends PHPUnit_Framework_TestCase { $this->assertEquals( - '
' . "\n"
+            '
' . "\n"
             . 'SELECT 1 < 2' . "\n"
-            . '
', + . '
', PMA_Util::formatSql('SELECT 1 < 2') ); } @@ -31,9 +31,9 @@ class PMA_FormatSql_Test extends PHPUnit_Framework_TestCase $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] = 6; $this->assertEquals( - '
' . "\n"
+            '
' . "\n"
             . 'SELECT[...]' . "\n"
-            . '
', + . '
', PMA_Util::formatSql('SELECT 1 < 2', true) ); } diff --git a/themes/original/css/common.css.php b/themes/original/css/common.css.php index 1639dc7613..8de05a9fff 100644 --- a/themes/original/css/common.css.php +++ b/themes/original/css/common.css.php @@ -1327,7 +1327,7 @@ div.sqlvalidate { overflow: auto; } -#result_query code.sql, +#result_query div.sqlOuter, div.sqlvalidate { border: solid 1px; border-top: 0; diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index 7c3c985f54..a14b002021 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -1689,7 +1689,11 @@ div.sqlvalidate { overflow: auto; } -#result_query code.sql, +#result_query div.sqlOuter { + background: ; + padding: 1em; +} + #PMA_slidingMessage code.sql, div.sqlvalidate { background: ;