navigation and MaxDbList (work in progress)
This commit is contained in:
@@ -1088,6 +1088,10 @@ ALTER TABLE `pma_column_comments`
|
||||
If you have only one server configured, <tt>$cfg['ServerDefault']</tt>
|
||||
MUST be set to that server.</dd>
|
||||
|
||||
<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_OBGzip">$cfg['OBGzip'] string/boolean</dt>
|
||||
<dd>Defines whether to use GZip output buffering for increased
|
||||
speed in <abbr title="HyperText Transfer Protocol">HTTP</abbr> transfers.<br />
|
||||
|
@@ -50,6 +50,9 @@ require_once './libraries/List.class.php';
|
||||
*/
|
||||
var $_show_databases_disabled = false;
|
||||
|
||||
var $limit_offset = 0;
|
||||
var $limit_count = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -88,7 +91,7 @@ require_once './libraries/List.class.php';
|
||||
*/
|
||||
function _checkAccess()
|
||||
{
|
||||
foreach ($this->items as $key => $db) {
|
||||
foreach ($this->getItems() as $key => $db) {
|
||||
if (! @PMA_DBI_select_db($db, $this->_db_link_user)) {
|
||||
unset($this->items[$key]);
|
||||
}
|
||||
@@ -114,7 +117,7 @@ require_once './libraries/List.class.php';
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->items as $key => $db) {
|
||||
foreach ($this->getItems() as $key => $db) {
|
||||
if (preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db)) {
|
||||
unset($this->items[$key]);
|
||||
}
|
||||
@@ -192,7 +195,6 @@ require_once './libraries/List.class.php';
|
||||
|
||||
if (! $this->_checkOnlyDatabase()) {
|
||||
$this->items = $this->_retrieve();
|
||||
|
||||
if ($GLOBALS['cfg']['NaturalOrder']) {
|
||||
natsort($this->items);
|
||||
$this->_need_to_reindex = true;
|
||||
@@ -307,7 +309,7 @@ require_once './libraries/List.class.php';
|
||||
{
|
||||
$dbgroups = array();
|
||||
$parts = array();
|
||||
foreach ($this->items as $key => $db) {
|
||||
foreach ($this->getItems() as $key => $db) {
|
||||
// garvin: Get comments from PMA comments table
|
||||
$db_tooltip = '';
|
||||
if ($GLOBALS['cfg']['ShowTooltip']
|
||||
@@ -352,6 +354,20 @@ require_once './libraries/List.class.php';
|
||||
return $dbgroups;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a part of the items
|
||||
*
|
||||
* @uses PMA_List_Database::$items
|
||||
* @uses PMA_List_Database::$limit_offset
|
||||
* @uses PMA_List_Database::$limit_count
|
||||
* @uses array_slice()
|
||||
* @return array the items
|
||||
*/
|
||||
function getItems()
|
||||
{
|
||||
return(array_slice($this->items, $this->limit_offset, $this->limit_count));
|
||||
}
|
||||
|
||||
/**
|
||||
* returns html code for list with dbs
|
||||
*
|
||||
|
@@ -2099,6 +2099,83 @@ function PMA_pageselector($url, $rows, $pageNow = 1, $nbTotalPage = 1,
|
||||
return $gotopage;
|
||||
} // end function
|
||||
|
||||
|
||||
/**
|
||||
* Generate navigation for db list
|
||||
*
|
||||
* @todo use $pos from $_url_params
|
||||
* @uses $GLOBALS['strPageNumber']
|
||||
* @uses range()
|
||||
* @param integer number of databases
|
||||
* @param integer current position in the list
|
||||
* @param array url parameters
|
||||
* @param string script name for form target
|
||||
* @param string target frame
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function PMA_dbPageSelector($databases_count, $pos, $_url_params, $script, $frame) {
|
||||
|
||||
if ($GLOBALS['cfg']['MaxDbList']
|
||||
&& $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
|
||||
// Move to the beginning or to the previous page
|
||||
if ($pos > 0) {
|
||||
// loic1: patch #474210 from Gosha Sakovich - part 1
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$caption1 = '<<';
|
||||
$caption2 = ' < ';
|
||||
$title1 = ' title="' . $GLOBALS['strPos1'] . '"';
|
||||
$title2 = ' title="' . $GLOBALS['strPrevious'] . '"';
|
||||
} else {
|
||||
$caption1 = $GLOBALS['strPos1'] . ' <<';
|
||||
$caption2 = $GLOBALS['strPrevious'] . ' <';
|
||||
$title1 = '';
|
||||
$title2 = '';
|
||||
} // end if... else...
|
||||
$_url_params['pos'] = 0;
|
||||
echo '<a' . $title1 . ' href="' . $script
|
||||
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
|
||||
. $caption1 . '</a>';
|
||||
$_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxDbList'];
|
||||
echo '<a' . $title2 . ' href="' . $script
|
||||
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
|
||||
. $caption2 . '</a>';
|
||||
}
|
||||
|
||||
echo '<form action="./' . $script . '" method="post">' . "\n";
|
||||
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']));
|
||||
echo '</form>';
|
||||
|
||||
if ($pos + $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$caption3 = ' > ';
|
||||
$caption4 = '>>';
|
||||
$title3 = ' title="' . $GLOBALS['strNext'] . '"';
|
||||
$title4 = ' title="' . $GLOBALS['strEnd'] . '"';
|
||||
} else {
|
||||
$caption3 = '> ' . $GLOBALS['strNext'];
|
||||
$caption4 = '>> ' . $GLOBALS['strEnd'];
|
||||
$title3 = '';
|
||||
$title4 = '';
|
||||
} // end if... else...
|
||||
$_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxDbList'];
|
||||
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'];
|
||||
echo '<a' . $title4 . ' href="' . $script
|
||||
. PMA_generate_common_url($_url_params) . '" target="' . $frame . '">'
|
||||
. $caption4 . '</a>';
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* replaces %u in given path with current user name
|
||||
*
|
||||
|
@@ -72,6 +72,16 @@ function PMA_exitNavigationFrame()
|
||||
exit;
|
||||
}
|
||||
|
||||
// keep the offset of the db list in session before closing it
|
||||
if (! isset($_SESSION['navi_limit_offset'])) {
|
||||
$_SESSION['navi_limit_offset'] = 0;
|
||||
}
|
||||
if (isset($_REQUEST['pos'])) {
|
||||
$_SESSION['navi_limit_offset'] = (int) $_REQUEST['pos'];
|
||||
}
|
||||
$pos = $GLOBALS['PMA_List_Database']->limit_offset = $_SESSION['navi_limit_offset'];
|
||||
$GLOBALS['PMA_List_Database']->limit_count = $GLOBALS['cfg']['MaxDbList'];
|
||||
|
||||
// free the session file, for the other frames to be loaded
|
||||
session_write_close();
|
||||
|
||||
@@ -103,6 +113,15 @@ $cfgRelation = PMA_getRelationsParam();
|
||||
*/
|
||||
require_once './libraries/header_http.inc.php';
|
||||
|
||||
if (! isset($_SESSION['navi_limit_offset'])) {
|
||||
$_SESSION['navi_limit_offset'] = 0;
|
||||
}
|
||||
if (isset($_REQUEST['pos'])) {
|
||||
$_SESSION['navi_limit_offset'] = (int) $_REQUEST['pos'];
|
||||
}
|
||||
$pos = $GLOBALS['PMA_List_Database']->limit_offset = $_SESSION['navi_limit_offset'];
|
||||
$GLOBALS['PMA_List_Database']->limit_count = $GLOBALS['cfg']['MaxDbList'];
|
||||
|
||||
/*
|
||||
* Displays the frame
|
||||
*/
|
||||
@@ -126,6 +145,7 @@ require_once './libraries/header_http.inc.php';
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=left&nocache=<?php echo $_SESSION['PMA_Config']->getMtime(); ?>" />
|
||||
<script type="text/javascript" src="js/navigation.js"></script>
|
||||
<script type="text/javascript" src="js/functions.js"></script>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
|
||||
@@ -292,7 +312,7 @@ function PMA_displayDbList($ext_dblist) {
|
||||
|
||||
// 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['PMA_List_Database']->items);
|
||||
$tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->getItems());
|
||||
|
||||
$url_dbgroup = '';
|
||||
echo '<ul id="leftdatabaselist">';
|
||||
@@ -567,5 +587,10 @@ function PMA_displayTableList($tables, $visible = false,
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
echo '<div>' . "\n";
|
||||
$_url_params = array('pos' => $pos);
|
||||
PMA_dbPageSelector($GLOBALS['PMA_List_Database']->count(), $pos, $_url_params, 'navigation.php', 'frame_navigation');
|
||||
echo '</div>' . "\n";
|
||||
PMA_exitNavigationFrame();
|
||||
?>
|
||||
|
@@ -100,7 +100,6 @@ if ($server > 0) {
|
||||
if ($databases_count > 0) {
|
||||
reset($databases);
|
||||
$first_database = current($databases);
|
||||
|
||||
// table col order
|
||||
// there is no db specific collation or charset prior 4.1.0
|
||||
if (PMA_MYSQL_INT_VERSION >= 40100) {
|
||||
@@ -149,63 +148,7 @@ if ($databases_count > 0) {
|
||||
'sort_order' => $sort_order,
|
||||
);
|
||||
|
||||
if ($GLOBALS['cfg']['MaxDbList']
|
||||
&& $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
|
||||
// Move to the beginning or to the previous page
|
||||
if ($pos > 0) {
|
||||
// loic1: patch #474210 from Gosha Sakovich - part 1
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$caption1 = '<<';
|
||||
$caption2 = ' < ';
|
||||
$title1 = ' title="' . $GLOBALS['strPos1'] . '"';
|
||||
$title2 = ' title="' . $GLOBALS['strPrevious'] . '"';
|
||||
} else {
|
||||
$caption1 = $GLOBALS['strPos1'] . ' <<';
|
||||
$caption2 = $GLOBALS['strPrevious'] . ' <';
|
||||
$title1 = '';
|
||||
$title2 = '';
|
||||
} // end if... else...
|
||||
$_url_params['pos'] = 0;
|
||||
echo '<a' . $title1 . 'href="server_databases.php'
|
||||
. PMA_generate_common_url($_url_params) . '">'
|
||||
. $caption1 . '</a>';
|
||||
$_url_params['pos'] = $pos - $GLOBALS['cfg']['MaxDbList'];
|
||||
echo '<a' . $title2 . 'href="server_databases.php'
|
||||
. PMA_generate_common_url($_url_params) . '">'
|
||||
. $caption2 . '</a>';
|
||||
}
|
||||
|
||||
echo '<form action="./server_databases.php" method="post">' . "\n";
|
||||
echo PMA_generate_common_hidden_inputs($_url_params);
|
||||
echo PMA_pageselector(
|
||||
'server_databases.php' . PMA_generate_common_url($_url_params) . '&',
|
||||
$GLOBALS['cfg']['MaxDbList'],
|
||||
floor(($pos + 1) / $GLOBALS['cfg']['MaxDbList']) + 1,
|
||||
ceil($databases_count / $GLOBALS['cfg']['MaxDbList']));
|
||||
echo '</form>';
|
||||
|
||||
if ($pos + $GLOBALS['cfg']['MaxDbList'] < $databases_count) {
|
||||
if ($GLOBALS['cfg']['NavigationBarIconic']) {
|
||||
$caption3 = ' > ';
|
||||
$caption4 = '>>';
|
||||
$title3 = ' title="' . $GLOBALS['strNext'] . '"';
|
||||
$title4 = ' title="' . $GLOBALS['strEnd'] . '"';
|
||||
} else {
|
||||
$caption3 = '> ' . $GLOBALS['strNext'];
|
||||
$caption4 = '>> ' . $GLOBALS['strEnd'];
|
||||
$title3 = '';
|
||||
$title4 = '';
|
||||
} // end if... else...
|
||||
$_url_params['pos'] = $pos + $GLOBALS['cfg']['MaxDbList'];
|
||||
echo '<a' . $title3 . 'href="server_databases.php'
|
||||
. PMA_generate_common_url($_url_params) . '">'
|
||||
. $caption3 . '</a>';
|
||||
$_url_params['pos'] = floor($databases_count / $GLOBALS['cfg']['MaxDbList']) * $GLOBALS['cfg']['MaxDbList'];
|
||||
echo '<a' . $title4 . 'href="server_databases.php'
|
||||
. PMA_generate_common_url($_url_params) . '">'
|
||||
. $caption4 . '</a>';
|
||||
}
|
||||
}
|
||||
PMA_dbPageSelector($databases_count, $pos, $_url_params, 'server_databases.php', 'frame_content');
|
||||
|
||||
$_url_params['pos'] = $pos;
|
||||
|
||||
|
@@ -36,7 +36,7 @@ form {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
select {
|
||||
select#lightm_db {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user