bug #3427256 [interface] no links to browse/empty views and tables

This commit is contained in:
Marc Delisle
2011-10-23 10:27:06 -04:00
parent d590bccda2
commit 694c1cdf75
2 changed files with 47 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ phpMyAdmin - ChangeLog
3.4.8.0 (not yet released) 3.4.8.0 (not yet released)
- bug #3425230 [interface] enum data split at space char (more space to edit) - 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 #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) 3.4.7.0 (2011-10-23)
- bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false - bug #3418610 [interface] Links in navigation when $cfg['MainPageIconic'] = false

View File

@@ -254,31 +254,57 @@ foreach ($tables as $keyname => $each_table) {
$hidden_fields[] = '<input type="hidden" name="views[]" value="' . htmlspecialchars($each_table['TABLE_NAME']) . '" />'; $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 . '&amp;pos=0">' . $titles['Browse'] . '</a>'; * Always activate links for Browse, Search and Empty, even if
$search_table = '<a href="tbl_select.php?' . $tbl_url_query . '">' . $titles['Search'] . '</a>'; * the icons are greyed, because
$browse_table_label = '<a href="sql.php?' . $tbl_url_query . '&amp;pos=0">' . $truename . '</a>'; * 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 { } else {
$browse_table = $titles['NoBrowse']; $may_have_rows = false;
$search_table = $titles['NoSearch'];
$browse_table_label = '<a href="tbl_structure.php?' . $tbl_url_query . '">' . $truename . '</a>';
} }
$browse_table = '<a href="sql.php?' . $tbl_url_query . '&amp;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 . '&amp;pos=0">' . $truename . '</a>';
if (! $db_is_information_schema) { if (! $db_is_information_schema) {
if (! empty($each_table['TABLE_ROWS'])) { $empty_table = '<a ';
$empty_table = '<a '; if ($GLOBALS['cfg']['AjaxEnable']) {
if ($GLOBALS['cfg']['AjaxEnable']) { $empty_table .= 'class="truncate_table_anchor"';
$empty_table .= 'class="truncate_table_anchor"';
}
$empty_table .= ' href="sql.php?' . $tbl_url_query
. '&amp;sql_query=';
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
. '&amp;message_to_show='
. urlencode(sprintf(__('Table %s has been emptied'), htmlspecialchars($each_table['TABLE_NAME'])))
.'">' . $titles['Empty'] . '</a>';
} else {
$empty_table = $titles['NoEmpty'];
} }
$empty_table .= ' href="sql.php?' . $tbl_url_query
. '&amp;sql_query=';
$empty_table .= urlencode('TRUNCATE ' . PMA_backquote($each_table['TABLE_NAME']))
. '&amp;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 .= '</a>';
$drop_query = 'DROP ' $drop_query = 'DROP '
. ($table_is_view ? 'VIEW' : 'TABLE') . ($table_is_view ? 'VIEW' : 'TABLE')
. ' ' . PMA_backquote($each_table['TABLE_NAME']); . ' ' . PMA_backquote($each_table['TABLE_NAME']);