The branch, QA_3_4 has been updated via 694c1cdf751e1fcbe2435087e3cea0dcd85ca458 (commit) from d590bccda2409f3d1e168c470a6af3fe38531106 (commit)
- Log ----------------------------------------------------------------- -----------------------------------------------------------------------
Summary of changes: ChangeLog | 1 + db_structure.php | 64 ++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 7b7f26f..0219da3 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 d81af5d..b704759 100644 --- a/db_structure.php +++ b/db_structure.php @@ -254,31 +254,57 @@ foreach ($tables as $keyname => $each_table) { $hidden_fields[] = '<input type="hidden" name="views[]" value="' . htmlspecialchars($each_table['TABLE_NAME']) . '" />'; }
- if ($each_table['TABLE_ROWS'] > 0) { - $browse_table = '<a href="sql.php?' . $tbl_url_query . '&pos=0">' . $titles['Browse'] . '</a>'; - $search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">' . $titles['Search'] . '</a>'; - $browse_table_label = '<a href="sql.php?' . $tbl_url_query . '&pos=0">' . $truename . '</a>'; + /* + * 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 = '<a href="tbl_structure.php?' . $tbl_url_query . '">' . $truename . '</a>'; + $may_have_rows = false; } + $browse_table = '<a href="sql.php?' . $tbl_url_query . '&pos=0">'; + if ($may_have_rows) { + $browse_table .= $titles['Browse']; + } else { + $browse_table .= $titles['NoBrowse']; + } + $browse_table .= '</a>'; + + $search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">'; + if ($may_have_rows) { + $search_table .= $titles['Search']; + } else { + $search_table .= $titles['NoSearch']; + } + $search_table .= '</a>'; + + $browse_table_label = '<a href="sql.php?' . $tbl_url_query . '&pos=0">' . $truename . '</a>';
if (! $db_is_information_schema) { - if (! empty($each_table['TABLE_ROWS'])) { - $empty_table = '<a '; - if ($GLOBALS['cfg']['AjaxEnable']) { - $empty_table .= 'class="truncate_table_anchor"'; - } - $empty_table .= ' href="sql.php?' . $tbl_url_query - . '&sql_query='; - $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) - . '&message_to_show=' - . urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME']))) - .'">' . $titles['Empty'] . '</a>'; + $empty_table = '<a '; + if ($GLOBALS['cfg']['AjaxEnable']) { + $empty_table .= 'class="truncate_table_anchor"'; + } + $empty_table .= ' href="sql.php?' . $tbl_url_query + . '&sql_query='; + $empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME'])) + . '&message_to_show=' + . urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME']))) + .'">'; + if ($may_have_rows) { + $empty_table .= $titles['Empty']; } else { - $empty_table = $titles['NoEmpty']; + $empty_table .= $titles['NoEmpty']; } + $empty_table .= '</a>'; + $drop_query = 'DROP ' . ($table_is_view ? 'VIEW' : 'TABLE') . ' ' . PMA_backquote($each_table['TABLE_NAME']);
hooks/post-receive