Skip to content

Commit

Permalink
Added configuration directive: MaxNavigationItems
Browse files Browse the repository at this point in the history
  • Loading branch information
roccivic committed Oct 30, 2012
1 parent ed33120 commit 90b6718
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 25 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -54,6 +54,7 @@ VerboseMultiSubmit, ReplaceHelpImg
+ Dropped configuration directive: DisplayDatabasesList
+ Dropped configuration directives: ShowTooltipAliasDB and ShowTooltipAliasTB
+ Dropped configuration directive: NaviDatabaseNameColor
+ Added configuration directive: MaxNavigationItems

3.5.4.0 (not yet released)
- bug #3570212 [edit] uuid_short() is a no-arguments function
Expand Down
6 changes: 5 additions & 1 deletion Documentation.html
Expand Up @@ -1380,7 +1380,11 @@ <h2 id="config">Configuration</h2>

<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>
database list.</dd>

<dt id="cfg_MaxNavigationItems">$cfg['MaxNavigationItems'] integer</dt>
<dd>The number of items that can be displayed on each page
of the navigation tree.</dd>

<dt id="cfg_MaxTableList">$cfg['MaxTableList'] integer</dt>
<dd>The maximum number of table names to be displayed in the
Expand Down
9 changes: 8 additions & 1 deletion libraries/config.default.php
Expand Up @@ -566,12 +566,19 @@
$cfg['VersionCheck'] = VERSION_CHECK_DEFAULT;

/**
* maximum number of db's displayed in left frame and database list
* maximum number of db's displayed in database list
*
* @global integer $cfg['MaxDbList']
*/
$cfg['MaxDbList'] = 100;

/**
* maximum number of items displayed in navigation panel
*
* @global integer $cfg['MaxDbList']
*/
$cfg['MaxNavigationItems'] = 25;

/**
* maximum number of tables displayed in table list
*
Expand Down
1 change: 1 addition & 0 deletions libraries/config.values.php
Expand Up @@ -212,6 +212,7 @@
'LoginCookieValidity' => 'validate_positive_number',
'LoginCookieStore' => 'validate_non_negative_number',
'MaxDbList' => 'validate_positive_number',
'MaxNavigationItems' => 'validate_positive_number',
'MaxCharactersInDisplayedSQL' => 'validate_positive_number',
'MaxRows' => 'validate_positive_number',
'MaxTableList' => 'validate_positive_number',
Expand Down
4 changes: 3 additions & 1 deletion libraries/config/messages.inc.php
Expand Up @@ -305,8 +305,10 @@
$strConfigMaxCharactersInDisplayedSQL_desc = __('Maximum number of characters used when a SQL query is displayed');
$strConfigMaxCharactersInDisplayedSQL_name = __('Maximum displayed SQL length');
$strConfigMaxDbList_cmt = __('Users cannot set a higher value');
$strConfigMaxDbList_desc = __('Maximum number of databases displayed in left frame and database list');
$strConfigMaxDbList_desc = __('Maximum number of databases displayed in database list');
$strConfigMaxDbList_name = __('Maximum databases');
$strConfigMaxNavigationItems_desc = __('The number of items that can be displayed on each page of the navigation tree');
$strConfigMaxNavigationItems_name = __('Maximum items in branch');
$strConfigMaxRows_desc = __('Number of rows displayed when browsing a result set. If the result set contains more rows, &quot;Previous&quot; and &quot;Next&quot; links will be shown.');
$strConfigMaxRows_name = __('Maximum number of rows to display');
$strConfigMaxTableList_cmt = __('Users cannot set a higher value');
Expand Down
3 changes: 2 additions & 1 deletion libraries/config/setup.forms.php
Expand Up @@ -166,7 +166,8 @@
'LeftLogoLink',
'LeftLogoLinkWindow',
'LeftPointerEnable',
'LeftRecentTable');
'LeftRecentTable',
'MaxNavigationItems');
$forms['Left_frame']['Left_servers'] = array(
'LeftDisplayServers',
'DisplayServersList');
Expand Down
3 changes: 2 additions & 1 deletion libraries/config/user_preferences.forms.php
Expand Up @@ -82,7 +82,8 @@
'LeftLogoLink',
'LeftLogoLinkWindow',
'LeftPointerEnable',
'LeftRecentTable');
'LeftRecentTable',
'MaxNavigationItems');
$forms['Left_frame']['Left_databases'] = array(
'LeftDisplayDatabaseFilterMinimum',
'LeftFrameDBTree',
Expand Down
6 changes: 3 additions & 3 deletions libraries/navigation/Navigation.class.php
Expand Up @@ -79,8 +79,8 @@ private function _getNavigationDbPos()
return PMA_DBI_fetch_value(
sprintf(
$query,
(int)$GLOBALS['cfg']['MaxDbList'],
(int)$GLOBALS['cfg']['MaxDbList'],
(int)$GLOBALS['cfg']['MaxNavigationItems'],
(int)$GLOBALS['cfg']['MaxNavigationItems'],
PMA_CommonFunctions::getInstance()->sqlAddSlashes($GLOBALS['db'])
)
);
Expand Down Expand Up @@ -114,7 +114,7 @@ public function getDisplay()
$_url_params,
'navigation.php',
'frame_navigation',
$GLOBALS['cfg']['MaxDbList'],
$GLOBALS['cfg']['MaxNavigationItems'],
'pos',
array('dbselector')
);
Expand Down
2 changes: 1 addition & 1 deletion libraries/navigation/NavigationTree.class.php
Expand Up @@ -963,7 +963,7 @@ private function _getPageSelector($node)
$_url_params,
'navigation.php',
'frame_navigation',
$GLOBALS['cfg']['MaxTableList'],
$GLOBALS['cfg']['MaxNavigationItems'],
'pos' . $level . '_value'
);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/navigation/Nodes/Node.class.php
Expand Up @@ -360,7 +360,7 @@ public function getData($type, $pos, $searchClause = '')
$query = "SELECT `SCHEMA_NAME` ";
$query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
$query .= "ORDER BY `SCHEMA_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxDbList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
return PMA_DBI_fetch_result($query);
}

Expand Down
20 changes: 10 additions & 10 deletions libraries/navigation/Nodes/Node_Database.class.php
Expand Up @@ -229,7 +229,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = " SHOW FULL TABLES FROM ";
Expand All @@ -248,7 +248,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr[0];
$count++;
}
Expand All @@ -272,7 +272,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "%'";
}
$query .= "ORDER BY `TABLE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$query = "SHOW FULL TABLES FROM ";
Expand All @@ -291,7 +291,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr[0];
$count++;
}
Expand All @@ -315,7 +315,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "%'";
}
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->sqlAddSlashes($db);
Expand All @@ -331,7 +331,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr['Name'];
$count++;
}
Expand All @@ -355,7 +355,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "%'";
}
$query .= "ORDER BY `ROUTINE_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->sqlAddSlashes($db);
Expand All @@ -371,7 +371,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr['Name'];
$count++;
}
Expand All @@ -394,7 +394,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "%'";
}
$query .= "ORDER BY `EVENT_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->backquote($db);
Expand All @@ -410,7 +410,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr['Name'];
$count++;
}
Expand Down
10 changes: 5 additions & 5 deletions libraries/navigation/Nodes/Node_Table.class.php
Expand Up @@ -122,7 +122,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "WHERE `TABLE_NAME`='$table' ";
$query .= "AND `TABLE_SCHEMA`='$db' ";
$query .= "ORDER BY `COLUMN_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->backquote($db);
Expand All @@ -132,7 +132,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr['Field'];
$count++;
}
Expand All @@ -150,7 +150,7 @@ public function getData($type, $pos, $searchClause = '')
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if (! in_array($arr['Key_name'], $retval)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr['Key_name'];
$count++;
}
Expand All @@ -168,7 +168,7 @@ public function getData($type, $pos, $searchClause = '')
$query .= "WHERE `EVENT_OBJECT_SCHEMA`='$db' ";
$query .= "AND `EVENT_OBJECT_TABLE`='$table' ";
$query .= "ORDER BY `TRIGGER_NAME` ASC ";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxTableList']}";
$query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}";
$retval = PMA_DBI_fetch_result($query);
} else {
$db = $this->_commonFunctions->backquote($db);
Expand All @@ -178,7 +178,7 @@ public function getData($type, $pos, $searchClause = '')
if ($handle !== false) {
$count = 0;
while ($arr = PMA_DBI_fetch_array($handle)) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxTableList']) {
if ($pos <= 0 && $count < $GLOBALS['cfg']['MaxNavigationItems']) {
$retval[] = $arr['Trigger'];
$count++;
}
Expand Down

0 comments on commit 90b6718

Please sign in to comment.