- Remove code duplication
- Improve variable name Signed-off-by: Marc Delisle <marc@infomarc.info>
This commit is contained in:
parent
2c108f3268
commit
14e8e4b3ff
@ -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 ' <em>(' . __('Primary') . ')</em>';
|
||||
}
|
||||
echo '</td>';
|
||||
echo '<td' . $type_nowrap . ' lang="en" dir="ltr">' . $type . '</td>';
|
||||
echo '<td'
|
||||
. PMA_Util::getClassForType(
|
||||
$extracted_columnspec['type']
|
||||
)
|
||||
. ' lang="en" dir="ltr">' . $type . '</td>';
|
||||
|
||||
echo '<td>';
|
||||
echo (($row['Null'] == 'NO') ? __('No') : __('Yes'));
|
||||
echo '</td>';
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -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
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user