diff --git a/db_datadict.php b/db_datadict.php index 68865a2b3f..f4c49f60ed 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -123,14 +123,7 @@ foreach ($tables as $table) { // reformat mysql query output // set or enum types: slashes single quotes inside options - if ('set' == $extracted_columnspec['type'] - || 'enum' == $extracted_columnspec['type'] - ) { - $type_nowrap = ''; - } else { - $type_nowrap = ' class="nowrap"'; - } $type = htmlspecialchars($extracted_columnspec['print_type']); $attribute = $extracted_columnspec['attribute']; if (! isset($row['Default'])) { @@ -152,7 +145,12 @@ foreach ($tables as $table) { echo ' (' . __('Primary') . ')'; } echo ''; - echo '' . $type . ''; + echo '' . $type . ''; + echo ''; echo (($row['Null'] == 'NO') ? __('No') : __('Yes')); echo ''; diff --git a/libraries/Util.class.php b/libraries/Util.class.php index 4ead84156b..277580270d 100644 --- a/libraries/Util.class.php +++ b/libraries/Util.class.php @@ -4842,6 +4842,25 @@ class PMA_Util return $serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50705 || ($serverType == 'MariaDB' && PMA_MYSQL_INT_VERSION >= 50200); } + + /** + * Returns the proper class clause according to the column type + * + * @param string $type the column type + * + * @return string $class_clause the HTML class clause + */ + public static function getClassForType($type) + { + if ('set' == $type + || 'enum' == $type + ) { + $class_clause = ''; + } else { + $class_clause = ' class="nowrap"'; + } + return $class_clause; + } } ?> diff --git a/libraries/display_structure.inc.php b/libraries/display_structure.inc.php index ec561decc1..7273c27f08 100644 --- a/libraries/display_structure.inc.php +++ b/libraries/display_structure.inc.php @@ -81,13 +81,10 @@ foreach ($fields as $row) { $type = $row['Type']; $extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']); - if ('set' == $extracted_columnspec['type'] - || 'enum' == $extracted_columnspec['type'] - ) { - $type_nowrap = ''; - } else { - $type_nowrap = ' class="nowrap"'; - } + $class_for_type = PMA_Util::getClassForType( + $extracted_columnspec['type'] + ); + $type = $extracted_columnspec['print_type']; if (empty($type)) { $type = ' '; @@ -177,7 +174,7 @@ foreach ($fields as $row) { $response->addHTML( PMA_getHtmlTableStructureRow( $row, $rownum, $displayed_field_name, - $type_nowrap, $extracted_columnspec, $type_mime, + $class_for_type, $extracted_columnspec, $type_mime, $field_charset, $attribute, $tbl_is_view, $db_is_system_schema, $url_query, $field_encoded, $titles, $table )