replaced $dblist with new PMA_List_Database class

This commit is contained in:
Sebastian Mendel
2006-09-20 11:15:56 +00:00
parent 9ec978a4a9
commit 45b04ab15d
13 changed files with 151 additions and 446 deletions

View File

@@ -31,16 +31,9 @@ $cfgRelation = PMA_getRelationsParam();
* before the user choose among available ones at the welcome screen.
*/
if ($server > 0) {
// this function is defined in "common.lib.php"
// it defines $num_dbs and $dblist
PMA_availableDatabases();
if ((! isset($db) || ! strlen($db)) && count($dblist) === 1) {
reset($dblist);
$db = current($dblist);
if (! isset($db) || ! strlen($db)) {
$db = $GLOBALS['PMA_List_Database']->getSingleItem();
}
} else {
$num_dbs = 0;
}
$db = isset($db) ? $db : '';
@@ -123,7 +116,7 @@ require_once './libraries/header_http.inc.php';
<?php
require './libraries/left_header.inc.php';
if ($num_dbs === 0) {
if (! $GLOBALS['PMA_List_Database']->count()) {
// no database available, so we break here
echo '<p>' . $strNoDatabases . '</p></body></html>';
@@ -144,7 +137,7 @@ if ($num_dbs === 0) {
PMA_outBufferPost($ob_mode);
}
exit();
} elseif ($GLOBALS['cfg']['LeftFrameLight'] && $num_dbs > 1) {
} elseif ($GLOBALS['cfg']['LeftFrameLight'] && $GLOBALS['PMA_List_Database']->count() > 1) {
// more than one database available and LeftFrameLight is true
// display db selectbox
//
@@ -255,24 +248,23 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && isset($db) && strlen($db)) {
* @global $img_minus
* @global $img_plus
* @global $href_left
* @global $num_dbs
* @global $db_start
* @global $common_url_query
* @param array $ext_dblist extended db list
*/
function PMA_displayDbList($ext_dblist) {
global $element_counter, $img_minus, $img_plus, $href_left, $num_dbs,
global $element_counter, $img_minus, $img_plus, $href_left,
$db_start, $common_url_query;
// get table list, for all databases
// doing this in one step takes advantage of a single query with information_schema!
$tables_full = PMA_DBI_get_tables_full($GLOBALS['dblist']);
$tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->items);
$url_dbgroup = '';
echo '<ul id="leftdatabaselist">';
$close_db_group = false;
foreach ($ext_dblist as $group => $db_group) {
if ($num_dbs > 1) {
if ($GLOBALS['PMA_List_Database']->count() > 1) {
if ($close_db_group) {
$url_dbgroup = '';
echo '</ul>';
@@ -311,7 +303,7 @@ function PMA_displayDbList($ext_dblist) {
// Displays the database name
echo '<li>' . "\n";
if ($num_dbs > 1) {
if ($GLOBALS['PMA_List_Database']->count() > 1) {
// only with more than one db we need collapse ...
if ($db_start != $db['name'] || $db['num_tables'] < 1) {
// display + only if this db is not preselected
@@ -384,7 +376,7 @@ function PMA_displayDbList($ext_dblist) {
$tables = PMA_getTableList($db['name']);
}
$child_visible =
(bool) ($num_dbs === 1 || $db_start == $db['name']);
(bool) ($GLOBALS['PMA_List_Database']->count() === 1 || $db_start == $db['name']);
PMA_displayTableList($tables, $child_visible, '', $db['name']);
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
// no tables and LeftFrameLight: