Navigator for the table list in the content panel

This commit is contained in:
Marc Delisle
2007-06-25 14:00:35 +00:00
parent 93bbd8b148
commit 09b1ea0646
9 changed files with 61 additions and 16 deletions

View File

@@ -67,6 +67,8 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
but just at the end of a row
+ [gui] Query window: use verbose server name if any
+ [auth] patch #1712514 specify host for single signon, thanks to Thierry
+ [gui] Navigator for the db list in the navigation panel
+ [gui] Navigator for the table list in the content panel
2.10.3.0 (not yet released)

View File

@@ -1091,6 +1091,10 @@ ALTER TABLE `pma_column_comments`
<dt id="cfg_MaxDbList">$cfg['MaxDbList'] integer</dt>
<dd>The maximum number of database names to be displayed in the
navigation frame and the database list.</dd>
<dt id="cfg_MaxTableList">$cfg['MaxTableList'] integer</dt>
<dd>The maximum number of table names to be displayed in the
right panel's list.</dd>
<dt id="cfg_OBGzip">$cfg['OBGzip'] string/boolean</dt>
<dd>Defines whether to use GZip output buffering for increased

View File

@@ -160,6 +160,13 @@ if (true == $cfg['PropertiesIconic']) {
/**
* Displays the tables list
*/
$_url_params = array(
'pos' => $pos,
'db' => $db);
PMA_listNavigator($total_num_tables, $pos, $_url_params, 'db_structure.php', 'frame_content', $GLOBALS['cfg']['MaxTableList']);
?>
<form method="post" action="db_structure.php" name="tablesForm" id="tablesForm">
<?php

View File

@@ -2103,23 +2103,23 @@ function PMA_pageselector($url, $rows, $pageNow = 1, $nbTotalPage = 1,
/**
* Generate navigation for db list
* Generate navigation for a list
*
* @todo use $pos from $_url_params
* @uses $GLOBALS['strPageNumber']
* @uses range()
* @param integer number of databases
* @param integer number of elements in the list
* @param integer current position in the list
* @param array url parameters
* @param string script name for form target
* @param string target frame
* @param integer maximum number of elements to display from the list
*
* @access public
*/
function PMA_dbPageSelector($databases_count, $pos, $_url_params, $script, $frame) {
function PMA_listNavigator($count, $pos, $_url_params, $script, $frame, $max_count) {
if ($GLOBALS['cfg']['MaxDbList']
&& $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
if ($max_count < $count) {
if ('frame_navigation' == $frame) {
echo '<div id="navidbpageselector">' . "\n";
}
@@ -2142,7 +2142,7 @@ function PMA_dbPageSelector($databases_count, $pos, $_url_params, $script, $fram
echo '<a' . $title1 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
. $caption1 . '</a>';
$_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxDbList'];
$_url_params['pos'] = $pos - $max_count;
echo '<a' . $title2 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
. $caption2 . '</a>';
@@ -2152,12 +2152,12 @@ function PMA_dbPageSelector($databases_count, $pos, $_url_params, $script, $fram
echo PMA_generate_common_hidden_inputs($_url_params);
echo PMA_pageselector(
$script . PMA_generate_common_url($_url_params) . '&',
$GLOBALS['cfg']['MaxDbList'],
floor(($pos + 1) / $GLOBALS['cfg']['MaxDbList']) + 1,
ceil($databases_count / $GLOBALS['cfg']['MaxDbList']));
$max_count,
floor(($pos + 1) / $max_count) + 1,
ceil($count / $max_count));
echo '</form>';
if ($pos + $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
if ($pos + $max_count < $count) {
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$caption3 = ' &gt; ';
$caption4 = '&gt;&gt;';
@@ -2169,11 +2169,11 @@ function PMA_dbPageSelector($databases_count, $pos, $_url_params, $script, $fram
$title3 = '';
$title4 = '';
} // end if... else...
$_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxDbList'];
$_url_params['pos'] = $pos + $max_count;
echo '<a' . $title3 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
. $caption3 . '</a>';
$_url_params['pos'] = floor($databases_count / $GLOBALS['cfg']['MaxDbList']) * $GLOBALS['cfg']['MaxDbList'];
$_url_params['pos'] = floor($count / $max_count) * $max_count;
echo '<a' . $title4 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
. $caption4 . '</a>';

View File

@@ -342,6 +342,13 @@ $cfg['ServerDefault'] = 1;
*/
$cfg['MaxDbList'] = 100;
/**
* maximum number of tables displayed in table list
*
* @global integer $cfg['MaxTableList']
*/
$cfg['MaxTableList'] = 100;
/**
* use GZIP output buffering if possible (true|false|'auto')
*

View File

@@ -215,8 +215,12 @@ function PMA_DBI_get_tables($database, $link = null)
* @return array list of tables in given db(s)
*/
function PMA_DBI_get_tables_full($database, $table = false,
$tbl_is_group = false, $link = null)
$tbl_is_group = false, $link = null, $limit_offset = 0, $limit_count = false)
{
// currently supported for MySQL >= 50002
if (true === $limit_count) {
$limit_count = $GLOBALS['cfg']['MaxTableList'];
}
// prepare and check parameters
if (! is_array($database)) {
$databases = array($database);
@@ -277,6 +281,9 @@ function PMA_DBI_get_tables_full($database, $table = false,
WHERE ' . (PMA_IS_WINDOWS ? '' : 'BINARY') . ' `TABLE_SCHEMA` IN (\'' . implode("', '", $this_databases) . '\')
' . $sql_where_table;
if ($limit_count) {
$sql .= ' LIMIT ' . $limit_count . ' OFFSET ' . $limit_offset;
}
$tables = PMA_DBI_fetch_result($sql, array('TABLE_SCHEMA', 'TABLE_NAME'),
null, $link);
unset($sql_where_table, $sql);

View File

@@ -40,6 +40,17 @@
*/
require_once './libraries/common.inc.php';
/**
* limits for table list
*/
if (! isset($_SESSION['table_limit_offset'])) {
$_SESSION['table_limit_offset'] = 0;
}
if (isset($_REQUEST['pos'])) {
$_SESSION['table_limit_offset'] = (int) $_REQUEST['pos'];
}
$pos = $_SESSION['table_limit_offset'];
/**
* fills given tooltip arrays
*
@@ -191,7 +202,11 @@ if (! isset($sot_ready)) {
$tables = PMA_DBI_get_tables_full($db, $tbl_group, 'comment');
} else {
// all tables in db
$tables = PMA_DBI_get_tables_full($db);
// - get the total number of tables
$tables = PMA_DBI_get_tables($db);
$total_num_tables = count($tables);
// - then fetch the details for a possible limited subset
$tables = PMA_DBI_get_tables_full($db, false, false, null, $pos, true);
}
if ($cfg['ShowTooltip']) {
@@ -205,6 +220,9 @@ if (! isset($sot_ready)) {
* @global int count of tables in db
*/
$num_tables = count($tables);
if (! isset($total_num_tables)) {
$total_num_tables = $num_tables;
}
/**
* cleanup

View File

@@ -589,6 +589,6 @@ function PMA_displayTableList($tables, $visible = false,
echo '</div>' . "\n";
$_url_params = array('pos' => $pos);
PMA_dbPageSelector($GLOBALS['PMA_List_Database']->count(), $pos, $_url_params, 'navigation.php', 'frame_navigation');
PMA_listNavigator($GLOBALS['PMA_List_Database']->count(), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
PMA_exitNavigationFrame();
?>

View File

@@ -148,7 +148,7 @@ if ($databases_count > 0) {
'sort_order' => $sort_order,
);
PMA_dbPageSelector($databases_count, $pos, $_url_params, 'server_databases.php', 'frame_content');
PMA_listNavigator($databases_count, $pos, $_url_params, 'server_databases.php', 'frame_content', $GLOBALS['cfg']['MaxDbList']);
$_url_params['pos'] = $pos;