From 736b182dad6e4441882b2cbcf12d5ea9fadd291c Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Fri, 26 Mar 2004 18:49:56 +0000 Subject: [PATCH] Natural order --- config.inc.php | 2 ++ left.php | 33 +++++++++++++++++++++++++++++---- libraries/common.lib.php | 2 +- libraries/config_import.lib.php | 4 ++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/config.inc.php b/config.inc.php index db5a70113..b43bd190b 100644 --- a/config.inc.php +++ b/config.inc.php @@ -509,6 +509,8 @@ $cfg['MaxExactCount'] = 20000; // When approximate count < this, PM $cfg['WYSIWYG-PDF'] = TRUE; // Utilize DHTML/JS capabilities to allow WYSIWYG editing of // the PDF page editor. Requires an IE6/Mozilla based browser. +$cfg['NaturalOrder'] = TRUE; // Sort table and database in natural order + /** * Default queries. * %d will be replaced by database name diff --git a/left.php b/left.php index 761b11ef4..521164e9c 100644 --- a/left.php +++ b/left.php @@ -399,6 +399,17 @@ if ($num_dbs > 1) { $selected_db = 0; + // natural order for db list + if ($cfg['NaturalOrder'] && $num_dbs > 0) { + $dblist_temp = $dblist; + natsort($dblist_temp); + $i = 0; + foreach ($dblist_temp as $each) { + $dblist[$i] = $each; + $i++; + } + } + // Gets the tables list per database for ($i = 0; $i < $num_dbs; $i++) { $db = $dblist[$i]; @@ -539,15 +550,29 @@ if ($num_dbs > 1) { $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); - $table_list .= ' ' . "\n"; - $table_list .= ' ' . $strBrowse . ': ' . $url_title . ' ' . "\n"; + // natural order or not, use an array for the table list + + $table_array[$table] .= ' ' . "\n"; + + $table_array[$table] .= ' ' . $strBrowse . ': ' . $url_title . ' ' . "\n"; + if (PMA_USR_BROWSER_AGENT == 'IE') { - $table_list .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n"; + $table_array[$table] .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n"; } else { - $table_list .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n"; + $table_array[$table] .= ' ' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '
' . "\n"; } + + $table_title[$table] = htmlspecialchars($table); + } // end while (tables list) + if ($cfg['NaturalOrder'] && $num_tables > 0) { + natsort($table_title); + } + foreach (array_keys($table_title) as $each){ + $table_list .= " $table_array[$each]"; + } + if (!$table_list) { $table_list = '

' . "\n" . '
' . $strNoTablesFound . '
' . "\n"; diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 2dd1880ae..8eab5abcc 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -136,7 +136,7 @@ if (isset($cfg['FileRevision'])) { } else { $cfg['FileRevision'] = array(1, 1); } -if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 11)) { +if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 12)) { require_once('./libraries/config_import.lib.php'); } diff --git a/libraries/config_import.lib.php b/libraries/config_import.lib.php index 4b58af671..345349570 100644 --- a/libraries/config_import.lib.php +++ b/libraries/config_import.lib.php @@ -799,6 +799,10 @@ if (!isset($cfg['WYSIWYG-PDF'])) { $cfg['WYSIWYG-PDF'] = TRUE; } +if (!isset($cfg['NaturalOrder'])) { + $cfg['NaturalOrder'] = TRUE; +} + if (!isset($cfg['DefaultQueryTable'])) { $cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1'; }