From b24cf7103a0c1fda2a582f5892bb3c95001276a8 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Tue, 4 May 2004 11:38:52 +0000 Subject: [PATCH] NaturalOrder for Non-Light left frame. New mode 'nested' for Tooltip-Aliases: Groups/folders are created using the Alias name, the tablenames are the non-aliased ones. RFE from the forums. --- ChangeLog | 7 ++++++ Documentation.html | 7 +++++- config.inc.php | 21 ++++++++-------- left.php | 61 ++++++++++++++++++++++++++++++++++------------ 4 files changed, 69 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index b68bd76ad..7546f13f9 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-05-04 Garvin Hicking + * Documentation.html, config.inc.php, left.php: Use NaturalOrder + for Non-Light left frame. Introduce new option 'nested' for + $cfg['ShowTooltipAliasTB']. With this set Aliases are used for + virtual nested grouping, but for the tablename itself the tablename + will be show, not the Alias. + 2004-05-03 Alexander M. Turek * lang/german-*.inc.php: Clarification. diff --git a/Documentation.html b/Documentation.html index f040958c1..3c5119345 100755 --- a/Documentation.html +++ b/Documentation.html @@ -1170,9 +1170,14 @@ $cfg['PmaAbsoluteUri'] = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://'

-
$cfg['ShowTooltipAliasTB'] boolean
+
$cfg['ShowTooltipAliasTB'] boolean/string
Same as $cfg['ShowTooltipAliasDB'], except this works for table names. + + When setting this to 'nested', the Alias of the Tablename is only used + to split/nest the tables according to the $cfg['LeftFrameTableSeparator'] + directive. So only the folder is called like the Alias, the tablename itself + stays the real tablename.

$cfg['LeftDisplayLogo'] boolean
diff --git a/config.inc.php b/config.inc.php index b699f5dfa..3e35c00f3 100644 --- a/config.inc.php +++ b/config.inc.php @@ -212,16 +212,17 @@ $cfg['VerboseMultiSubmit'] = TRUE; // if set to true, PMA will show the a $cfg['AllowArbitraryServer'] = FALSE; // allow login to any user entered server in cookie based auth // Left frame setup -$cfg['LeftFrameLight'] = TRUE; // use a select-based menu and display only the - // current tables in the left frame. -$cfg['LeftFrameTableSeparator']= '__'; // Which string will be used to generate table prefixes - // to split tables into multiple categories -$cfg['LeftFrameTableLevel'] = '1'; // How many sublevels should be displayed when splitting - // up tables by the above Separator -$cfg['ShowTooltip'] = TRUE; // display table comment as tooltip in left frame -$cfg['ShowTooltipAliasDB'] = FALSE; // if ShowToolTip is enabled, this defines that table/db comments -$cfg['ShowTooltipAliasTB'] = FALSE; // are shown (in the left menu and db_details_structure) instead of - // table/db names +$cfg['LeftFrameLight'] = TRUE; // use a select-based menu and display only the + // current tables in the left frame. +$cfg['LeftFrameTableSeparator']= '__'; // Which string will be used to generate table prefixes + // to split/nest tables into multiple categories +$cfg['LeftFrameTableLevel'] = '1'; // How many sublevels should be displayed when splitting + // up tables by the above Separator +$cfg['ShowTooltip'] = TRUE; // display table comment as tooltip in left frame +$cfg['ShowTooltipAliasDB'] = FALSE; // if ShowToolTip is enabled, this defines that table/db comments +$cfg['ShowTooltipAliasTB'] = FALSE; // are shown (in the left menu and db_details_structure) instead of + // table/db names. Setting ShowTooltipAliasTB to 'nested' will only + // use the Aliases for nested descriptors, not the table itself. $cfg['LeftDisplayLogo'] = TRUE; // display logo at top of left frame $cfg['LeftDisplayServers'] = FALSE; // display server choice at top of left frame diff --git a/left.php b/left.php index e4592f247..d14642c2d 100644 --- a/left.php +++ b/left.php @@ -484,7 +484,7 @@ if ($num_dbs > 1) { $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db)); while ($tmp = PMA_DBI_fetch_assoc($result)) { $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''); - $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : $tmp['Comment']); + $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] && $cfg['ShowTooltipAliasTB'] !== 'nested' ? $tmp['Name'] : $tmp['Comment']); $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '') . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')'; @@ -530,14 +530,29 @@ if ($num_dbs > 1) {
> $table_sortkey) { $alias = (!empty($tooltip_name) && isset($tooltip_name[$table])) ? htmlspecialchars($tooltip_name[$table]) : ''; $url_title = (!empty($tooltip) && isset($tooltip[$table])) ? htmlspecialchars($tooltip[$table]) : ''; + $table_item = ($alias != '' && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested' + ? $alias + : htmlspecialchars($table)); $tablename = ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)); @@ -548,7 +563,7 @@ if ($num_dbs > 1) { $list_item .= '' . $strBrowse . ': ' . $url_title . ''; $list_item .= ' ' . "\n"; $list_item .= ''; - $list_item .= $tablename . '
' . "\n"; + $list_item .= $table_item . '
' . "\n"; // garvin: Check whether to display nested sets if (!empty($cfg['LeftFrameTableSeparator'])) { @@ -563,19 +578,18 @@ if ($num_dbs > 1) { unset($_table[count($_table)-1]); $_table = PMA_reduceNest($_table); - $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $tablename) . '\';'; + $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table_item) . '\';'; $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';'; eval($eval_string); } else { - $tablestack['']['pma_name'][] = $tablename; + $tablestack['']['pma_name'][] = $table_item; $tablestack['']['pma_list_item'][] = $list_item; } } else { - $tablestack['']['pma_name'][] = $tablename; + $tablestack['']['pma_name'][] = $table_item; $tablestack['']['pma_list_item'][] = $list_item; } } // end while (tables list) - PMA_nestedSet($j, $tablestack); ?>
@@ -712,8 +726,8 @@ else if ($num_dbs == 1) { $tooltip_name = array(); $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db), NULL, PMA_DBI_QUERY_STORE); while ($tmp = PMA_DBI_fetch_assoc($result)) { - $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''); - $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] ? $tmp['Name'] : $tmp['Comment']); + $tooltip_name[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : ''); + $tmp['Comment'] = ($cfg['ShowTooltipAliasTB'] && $cfg['ShowTooltipAliasTB'] !== 'nested' ? $tmp['Name'] : $tmp['Comment']); $tooltip[$tmp['Name']] = (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : '') . '(' . (isset($tmp['Rows']) ? $tmp['Rows'] : '0') . ' ' . $strRows . ')'; @@ -770,13 +784,28 @@ else if ($num_dbs == 1) { // Displays the list of tables from the current database $tablestack = array(); + $table_array = array(); while (list($table) = PMA_DBI_fetch_row($tables)) { + $table_item = (!empty($tooltip_name) && isset($tooltip_name[$table]) && !empty($tooltip_name[$table]) && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested' + ? htmlspecialchars($tooltip_name[$table]) + : htmlspecialchars($table)); + $table_array[$table] = $table_item; + } + + if ($cfg['NaturalOrder']) { + natcasesort($table_array); + } + + foreach($table_array as $table => $table_sortkey) { $alias = (!empty($tooltip_name) && isset($tooltip_name[$table])) - ? htmlentities($tooltip_name[$table]) + ? htmlspecialchars($tooltip_name[$table]) : ''; $url_title = (!empty($tooltip) && isset($tooltip[$table])) - ? htmlentities($tooltip[$table]) + ? htmlspecialchars($tooltip[$table]) : ''; + $table_item = ($alias != '' && $cfg['ShowTooltipAliasTB'] && strtolower($cfg['ShowTooltipAliasTB']) !== 'nested' + ? $alias + : htmlspecialchars($table)); $tablename = ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)); @@ -789,14 +818,14 @@ else if ($num_dbs == 1) { <?php echo $strBrowse . ': ' . $url_title; ?>  -
+
'; $list_item .= '' . $strBrowse . ': ' . $url_title . ''; $list_item .= ' ' . "\n"; $list_item .= ''; - $list_item .= $tablename . '
'; + $list_item .= $table_item . '
'; // garvin: Check whether to display nested sets if (!empty($cfg['LeftFrameTableSeparator'])) { @@ -811,15 +840,15 @@ else if ($num_dbs == 1) { unset($_table[count($_table)-1]); $_table = PMA_reduceNest($_table); - $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $tablename) . '\';'; + $eval_string = '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_name\'][] = \'' . str_replace('\'', '\\\'', $table_item) . '\';'; $eval_string .= '$tablestack[\'' . implode('\'][\'', $_table) . '\'][\'pma_list_item\'][] = \'' . str_replace('\'', '\\\'', $list_item) . '\';'; eval($eval_string); } else { - $tablestack['']['pma_name'][] = $tablename; + $tablestack['']['pma_name'][] = $table_item; $tablestack['']['pma_list_item'][] = $list_item; } } else { - $tablestack['']['pma_name'][] = $tablename; + $tablestack['']['pma_name'][] = $table_item; $tablestack['']['pma_list_item'][] = $list_item; } }