From 694c1cdf751e1fcbe2435087e3cea0dcd85ca458 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sun, 23 Oct 2011 10:27:06 -0400 Subject: [PATCH] bug #3427256 [interface] no links to browse/empty views and tables --- ChangeLog | 1 + db_structure.php | 66 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 47 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b7f26f99..0219da3b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog 3.4.8.0 (not yet released) - bug #3425230 [interface] enum data split at space char (more space to edit) - bug #3426840 [interface] ENUM/SET editor can't handle commas in values +- bug #3427256 [interface] no links to browse/empty views and tables 3.4.7.0 (2011-10-23) - bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false diff --git a/db_structure.php b/db_structure.php index d81af5d53..b7047594c 100644 --- a/db_structure.php +++ b/db_structure.php @@ -254,31 +254,57 @@ foreach ($tables as $keyname => $each_table) { $hidden_fields[] = ''; } - if ($each_table['TABLE_ROWS'] > 0) { - $browse_table = '' . $titles['Browse'] . ''; - $search_table = '' . $titles['Search'] . ''; - $browse_table_label = '' . $truename . ''; + /* + * Always activate links for Browse, Search and Empty, even if + * the icons are greyed, because + * 1. for views, we don't know the number of rows at this point + * 2. for tables, another source could have populated them since the + * page was generated + * + * I could have used the PHP ternary conditional operator but I find + * the code easier to read without this operator. + */ + if ($each_table['TABLE_ROWS'] > 0 || $table_is_view) { + $may_have_rows = true; } else { - $browse_table = $titles['NoBrowse']; - $search_table = $titles['NoSearch']; - $browse_table_label = '' . $truename . ''; + $may_have_rows = false; } + $browse_table = ''; + if ($may_have_rows) { + $browse_table .= $titles['Browse']; + } else { + $browse_table .= $titles['NoBrowse']; + } + $browse_table .= ''; + + $search_table = ''; + if ($may_have_rows) { + $search_table .= $titles['Search']; + } else { + $search_table .= $titles['NoSearch']; + } + $search_table .= ''; + + $browse_table_label = '' . $truename . ''; if (! $db_is_information_schema) { - if (! empty($each_table['TABLE_ROWS'])) { - $empty_table = '' . $titles['Empty'] . ''; - } else { - $empty_table = $titles['NoEmpty']; + $empty_table = ''; + if ($may_have_rows) { + $empty_table .= $titles['Empty']; + } else { + $empty_table .= $titles['NoEmpty']; + } + $empty_table .= ''; + $drop_query = 'DROP ' . ($table_is_view ? 'VIEW' : 'TABLE') . ' ' . PMA_backquote($each_table['TABLE_NAME']);