no duplication for SHOW TABLE STATUS.

Allow to only show tables within a left-frame table group to be show
Fix mouseover-selection bug #947781
This commit is contained in:
Garvin Hicking
2004-05-05 13:11:17 +00:00
parent 0b9bdd62a7
commit 44102a585f
4 changed files with 66 additions and 34 deletions

View File

@@ -5,6 +5,15 @@ phpMyAdmin - Changelog
$Id$
$Source$
2004-05-05 Garvin Hicking <pma@supergarv.de>
* db_details_db_info.php, db_details_structure.php, left.php: Speed
up table fetching when using $cfg['ShowTooltips']. Allow to only
see the grouped/nested tables in properties panel when clicking on
a table group on the left frame.
* db_details_structure.php: If JS is enabled, take away <label> link
functionality because of onmousedown-handler duplicating this
effect.
2004-05-05 Michal Cihar <michal@cihar.com>
* config.inc.php, tbl_change.php, tbl_replace.php,
libraries/common.lib.php, libraries/config_import.lib.php: Support for

View File

@@ -9,6 +9,23 @@ require_once('./libraries/common.lib.php');
PMA_checkParameters(array('db'));
function fillTooltip(&$tooltip_truename, &$tooltip_aliasname, &$tmp) {
$tooltip_truename[$tmp['Name']] = ($GLOBALS['cfg']['ShowTooltipAliasTB'] ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
$tooltip_aliasname[$tmp['Name']] = ($GLOBALS['cfg']['ShowTooltipAliasTB'] ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']));
if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
}
if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
}
if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
}
return true;
}
/**
* Gets the list of the table in the current db and informations about these
@@ -16,6 +33,19 @@ PMA_checkParameters(array('db'));
*/
// staybyte: speedup view on locked tables - 11 June 2001
$tables = array();
// When used in Nested table group mode, only show tables matching the given groupname
if (!empty($tbl_group) && !$cfg['ShowTooltipAliasTB']) {
$tbl_group_sql = ' LIKE \'' . $tbl_group . '%\'';
} else {
$tbl_group_sql = '';
}
if ($cfg['ShowTooltip']) {
$tooltip_truename = array();
$tooltip_aliasname = array();
}
// Special speedup for newer MySQL Versions (in 4.0 format changed)
if ($cfg['SkipLockedTables'] == TRUE) {
$db_info_result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
@@ -30,12 +60,21 @@ if ($cfg['SkipLockedTables'] == TRUE) {
PMA_DBI_free_result($db_info_result);
if (isset($sot_cache)) {
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
$db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
if (!isset($sot_cache[$tmp[0]])) {
$sts_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
$sts_tmp = PMA_DBI_fetch_assoc($sts_result);
if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
continue;
}
if ($cfg['ShowTooltip']) {
fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
}
$tables[] = $sts_tmp;
} else { // table in use
$tables[] = array('Name' => $tmp[0]);
@@ -48,9 +87,17 @@ if ($cfg['SkipLockedTables'] == TRUE) {
}
}
if (!isset($sot_ready)) {
$db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
$db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
while ($sts_tmp = PMA_DBI_fetch_assoc($db_info_result)) {
if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
continue;
}
if ($cfg['ShowTooltip']) {
fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
}
$tables[] = $sts_tmp;
}
}

View File

@@ -220,32 +220,7 @@ if ($num_tables == 0) {
}
// 2. Shows table informations - staybyte - 11 June 2001
else {
// Get additional information about tables for tooltip
if ($cfg['ShowTooltip']) {
$tooltip_truename = array();
$tooltip_aliasname = array();
$result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
while ($tmp = PMA_DBI_fetch_assoc($result)) {
$tooltip_truename[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
$tooltip_aliasname[$tmp['Name']] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''));
if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatCreateTime . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
}
if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatUpdateTime . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
}
if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
$tooltip_aliasname[$tmp['Name']] .= ', ' . $strStatCheckTime . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
}
} // end while
PMA_DBI_free_result($result);
unset($result);
} // end if
// Get additional information about tables for tooltip is done in db_details_db_info.php only once
if ($cfgRelation['commwork']) {
$comment = PMA_getComments($db);
@@ -305,7 +280,7 @@ else {
$alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$table]))
? htmlspecialchars($tooltip_aliasname[$table])
: htmlspecialchars($sts_data['Name']);
: htmlspecialchars($sts_data['Name']);
$truename = (!empty($tooltip_truename) && isset($tooltip_truename[$table]))
? htmlspecialchars($tooltip_truename[$table])
: htmlspecialchars($sts_data['Name']);
@@ -344,7 +319,7 @@ else {
<input type="checkbox" name="selected_tbl[]" value="<?php echo $table_encoded; ?>" id="checkbox_tbl_<?php echo $i; ?>"<?php echo $checked; ?> />
</td>
<td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap" <?php echo $click_mouse; ?>>
&nbsp;<b><label for="checkbox_tbl_<?php echo $i; ?>" title="<?php echo $alias; ?>"><?php echo $truename; ?></label>&nbsp;</b>&nbsp;
&nbsp;<b><label onclick="(document.getElementById('checkbox_tbl_<?php echo $i; ?>') ? return false : return true)" for="checkbox_tbl_<?php echo $i; ?>" title="<?php echo $alias; ?>"><?php echo $truename; ?></label>&nbsp;</b>&nbsp;
</td>
<td align="center" bgcolor="<?php echo $bgcolor; ?>">
<?php

View File

@@ -78,6 +78,7 @@ function PMA_indent($spaces) {
function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_level, $val, $childout = true) {
$name = $key;
$id = preg_replace('@[^a-z0-9]*@i', '', $baseid . $keyhistory . $key) . $indent;
$groupkey = $keyhistory . ($key != $keyhistory ? $GLOBALS['cfg']['LeftFrameTableSeparator'] . $key : '');
$on_mouse = (($GLOBALS['cfg']['LeftPointerColor'] == '') ? '' : ' onmouseover="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftPointerColor'] . '\')}" onmouseout="if (isDOM || isIE4) {hilightBase(\'el' . $id . '\', \'' . $GLOBALS['cfg']['LeftBgColor'] . '\')}"');
@@ -94,9 +95,9 @@ function PMA_nestedSetHeaderParent($baseid, $key, $keyhistory, $indent, $indent_
echo "\n";
echo PMA_indent($indent * 5) . '<div id="el' . $id . 'Parent" class="parent"' . $on_mouse . '>' . "\n";
echo PMA_indent($indent * 6) . '<div class="nowrap"><img src="images/spacer.gif" border="0" width="' . (($indent - 1) * $indent_level) . '" height="9" alt="" /><a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" onclick="if (capable) {expandBase(\'el' . $id . '\', true); return false} else {return true}">';
echo PMA_indent($indent * 6) . '<div class="nowrap"><img src="images/spacer.gif" border="0" width="' . (($indent - 1) * $indent_level) . '" height="9" alt="" /><a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '&amp;tbl_group=' . htmlspecialchars($groupkey) . '" onclick="if (capable) {expandBase(\'el' . $id . '\', true); return false} else {return true}">';
echo '<img name="imEx" id="el' . $id . 'Img" src="images/plus.png" border="0" width="9" height="9" alt="+" /></a>' . "\n";
echo PMA_indent($indent * 6) . '<a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '" title="' . htmlspecialchars($name) . '" onclick="if (capable) {expandBase(\'el' . $id . '\', false)}"><span class="heada">' . htmlspecialchars($name) . '<bdo dir="' . $GLOBALS['text_dir'] . '">&nbsp;&nbsp;</bdo></span><span class="headaCnt">(' . $counter . ')</span></a></div>' . "\n";
echo PMA_indent($indent * 6) . '<a class="item" href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . $GLOBALS['common_url_query'] . '&amp;tbl_group=' . htmlspecialchars($groupkey) . '" title="' . htmlspecialchars($name) . '" onclick="if (capable) {expandBase(\'el' . $id . '\', false)}"><span class="heada">' . htmlspecialchars($name) . '<bdo dir="' . $GLOBALS['text_dir'] . '">&nbsp;&nbsp;</bdo></span><span class="headaCnt">(' . $counter . ')</span></a></div>' . "\n";
echo PMA_indent($indent * 5) . '</div><!-- class="PMA_nestedSetHeaderParent" -->' . "\n";
echo "\n";
@@ -118,9 +119,9 @@ function PMA_nestedSetHeader($baseid, $tablestack, $keyhistory, $indent, $indent
}
if (isset($val['pma_name']) && isset($val['pma_list_item']) && count($val) == 2) {
PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, false, ($indent + 1));
PMA_nestedSet($baseid, $val, $key, $keyhistory . ($keyhistory != '' ? $GLOBALS['cfg']['LeftFrameTableSeparator'] : '') . $key, false, ($indent + 1));
} else {
PMA_nestedSet($baseid, $val, $key, $keyhistory . $key, true, ($indent + 1));
PMA_nestedSet($baseid, $val, $key, $keyhistory . ($keyhistory != '' ? $GLOBALS['cfg']['LeftFrameTableSeparator'] : '') . $key, true, ($indent + 1));
}
if ($headerOut) {