Natural order

This commit is contained in:
Marc Delisle
2004-03-26 18:49:56 +00:00
parent e5c4f13829
commit 736b182dad
4 changed files with 36 additions and 5 deletions

View File

@@ -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 $cfg['WYSIWYG-PDF'] = TRUE; // Utilize DHTML/JS capabilities to allow WYSIWYG editing of
// the PDF page editor. Requires an IE6/Mozilla based browser. // the PDF page editor. Requires an IE6/Mozilla based browser.
$cfg['NaturalOrder'] = TRUE; // Sort table and database in natural order
/** /**
* Default queries. * Default queries.
* %d will be replaced by database name * %d will be replaced by database name

View File

@@ -399,6 +399,17 @@ if ($num_dbs > 1) {
$selected_db = 0; $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 // Gets the tables list per database
for ($i = 0; $i < $num_dbs; $i++) { for ($i = 0; $i < $num_dbs; $i++) {
$db = $dblist[$i]; $db = $dblist[$i];
@@ -539,15 +550,29 @@ if ($num_dbs > 1) {
$book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label');
$table_list .= ' <nobr><a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&amp;table=' . urlencode($table) . '&amp;sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&amp;pos=0&amp;goto=' . $cfg['DefaultTabTable'] . '">' . "\n"; // natural order or not, use an array for the table list
$table_list .= ' <img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . $url_title . '" /></a><bdo dir="' . $text_dir . '">&nbsp;</bdo>' . "\n";
$table_array[$table] .= ' <nobr><a target="phpmain' . $hash . '" href="sql.php?' . $common_url_query . '&amp;table=' . urlencode($table) . '&amp;sql_query=' . (isset($book_sql_query) && $book_sql_query != FALSE ? urlencode($book_sql_query) : urlencode('SELECT * FROM ' . PMA_backquote($table))) . '&amp;pos=0&amp;goto=' . $cfg['DefaultTabTable'] . '">' . "\n";
$table_array[$table] .= ' <img src="images/button_smallbrowse.png" width="10" height="10" border="0" alt="' . $strBrowse . ': ' . $url_title . '" title="' . $strBrowse . ': ' . $url_title . '" /></a><bdo dir="' . $text_dir . '">&nbsp;</bdo>' . "\n";
if (PMA_USR_BROWSER_AGENT == 'IE') { if (PMA_USR_BROWSER_AGENT == 'IE') {
$table_list .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></span></nobr><br />' . "\n"; $table_array[$table] .= ' <span class="tblItem"><a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></span></nobr><br />' . "\n";
} else { } else {
$table_list .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n"; $table_array[$table] .= ' <a class="tblItem" id="tbl_' . md5($table) . '" title="' . $url_title . '" target="phpmain' . $hash . '" href="' . $cfg['DefaultTabTable'] . '?' . $common_url_query . '&amp;table=' . urlencode($table) . '">' . ($alias != '' && $cfg['ShowTooltipAliasTB'] ? $alias : htmlspecialchars($table)) . '</a></nobr><br />' . "\n";
} }
$table_title[$table] = htmlspecialchars($table);
} // end while (tables list) } // 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) { if (!$table_list) {
$table_list = ' <br /><br />' . "\n" $table_list = ' <br /><br />' . "\n"
. ' <div>' . $strNoTablesFound . '</div>' . "\n"; . ' <div>' . $strNoTablesFound . '</div>' . "\n";

View File

@@ -136,7 +136,7 @@ if (isset($cfg['FileRevision'])) {
} else { } else {
$cfg['FileRevision'] = array(1, 1); $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'); require_once('./libraries/config_import.lib.php');
} }

View File

@@ -799,6 +799,10 @@ if (!isset($cfg['WYSIWYG-PDF'])) {
$cfg['WYSIWYG-PDF'] = TRUE; $cfg['WYSIWYG-PDF'] = TRUE;
} }
if (!isset($cfg['NaturalOrder'])) {
$cfg['NaturalOrder'] = TRUE;
}
if (!isset($cfg['DefaultQueryTable'])) { if (!isset($cfg['DefaultQueryTable'])) {
$cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1'; $cfg['DefaultQueryTable'] = 'SELECT * FROM %t WHERE 1';
} }