Merge pull request #1752 from nisargjhaveri/nav_hide_group
rfe#1557, Hide groups from navi panel
This commit is contained in:
commit
8dc5b922db
@ -64,6 +64,7 @@ phpMyAdmin - ChangeLog
|
||||
- bug #4966 MySQL errors are not shown when DebugSQL is enabled
|
||||
+ rfe #342 One file per table and one file per database export option
|
||||
+ rfe #1060 Designer settings should be part of saved state
|
||||
+ rfe #1557 Option to remove functions, procedures, etc., from navigation tree
|
||||
|
||||
4.4.11.0 (not yet released)
|
||||
|
||||
|
||||
@ -1560,7 +1560,7 @@ Navigation panel setup
|
||||
:type: string
|
||||
:default: ``'index.php'``
|
||||
|
||||
Enter :term:`URL` where logo in the navigation panel will point to.
|
||||
Enter :term:`URL` where logo in the navigation panel will point to.
|
||||
For use especially with self made theme which changes this.
|
||||
For external URLs, you should include URL scheme as well.
|
||||
|
||||
@ -1647,6 +1647,42 @@ Navigation panel setup
|
||||
|
||||
Whether to offer the possibility of tree expansion in the navigation panel.
|
||||
|
||||
.. config:option:: $cfg['NavigationTreeShowTables']
|
||||
|
||||
:type: boolean
|
||||
:default: true
|
||||
|
||||
Whether to show tables under database in the navigation panel.
|
||||
|
||||
.. config:option:: $cfg['NavigationTreeShowViews']
|
||||
|
||||
:type: boolean
|
||||
:default: true
|
||||
|
||||
Whether to show views under database in the navigation panel.
|
||||
|
||||
.. config:option:: $cfg['NavigationTreeShowFunctions']
|
||||
|
||||
:type: boolean
|
||||
:default: true
|
||||
|
||||
Whether to show functions under database in the navigation panel.
|
||||
|
||||
.. config:option:: $cfg['NavigationTreeShowProcedures']
|
||||
|
||||
:type: boolean
|
||||
:default: true
|
||||
|
||||
Whether to show procedures under database in the navigation panel.
|
||||
|
||||
.. config:option:: $cfg['NavigationTreeShowEvents']
|
||||
|
||||
:type: boolean
|
||||
:default: true
|
||||
|
||||
Whether to show events under database in the navigation panel.
|
||||
|
||||
|
||||
Main panel
|
||||
----------
|
||||
|
||||
|
||||
@ -999,6 +999,41 @@ $cfg['NavigationTreeDefaultTabTable2'] = '';
|
||||
*/
|
||||
$cfg['NavigationTreeEnableExpansion'] = true;
|
||||
|
||||
/**
|
||||
* Show tables in navigation panel
|
||||
*
|
||||
* @global boolean $cfg['NavigationTreeShowTables']
|
||||
*/
|
||||
$cfg['NavigationTreeShowTables'] = true;
|
||||
|
||||
/**
|
||||
* Show views in navigation panel
|
||||
*
|
||||
* @global boolean $cfg['NavigationTreeShowViews']
|
||||
*/
|
||||
$cfg['NavigationTreeShowViews'] = true;
|
||||
|
||||
/**
|
||||
* Show functions in navigation panel
|
||||
*
|
||||
* @global boolean $cfg['NavigationTreeShowFunctions']
|
||||
*/
|
||||
$cfg['NavigationTreeShowFunctions'] = true;
|
||||
|
||||
/**
|
||||
* Show procedures in navigation panel
|
||||
*
|
||||
* @global boolean $cfg['NavigationTreeShowProcedures']
|
||||
*/
|
||||
$cfg['NavigationTreeShowProcedures'] = true;
|
||||
|
||||
/**
|
||||
* Show events in navigation panel
|
||||
*
|
||||
* @global boolean $cfg['NavigationTreeShowEvents']
|
||||
*/
|
||||
$cfg['NavigationTreeShowEvents'] = true;
|
||||
|
||||
/*******************************************************************************
|
||||
* In the main panel, at startup...
|
||||
*/
|
||||
|
||||
@ -245,6 +245,8 @@ $strConfigForm_Navi_databases = __('Databases');
|
||||
$strConfigForm_Navi_databases_desc = __('Databases display options.');
|
||||
$strConfigForm_Navi_panel = __('Navigation panel');
|
||||
$strConfigForm_Navi_panel_desc = __('Customize appearance of the navigation panel.');
|
||||
$strConfigForm_Navi_tree = __('Navigation tree');
|
||||
$strConfigForm_Navi_tree_desc = __('Customize the navigation tree.');
|
||||
$strConfigForm_Navi_servers = __('Servers');
|
||||
$strConfigForm_Navi_servers_desc = __('Servers display options.');
|
||||
$strConfigForm_Navi_tables = __('Tables');
|
||||
@ -482,6 +484,21 @@ $strConfigNavigationTreeEnableExpansion_desc
|
||||
= __('Whether to offer the possibility of tree expansion in the navigation panel.');
|
||||
$strConfigNavigationTreeEnableExpansion_name
|
||||
= __('Enable navigation tree expansion');
|
||||
$strConfigNavigationTreeShowTables_name = __('Show tables in tree');
|
||||
$strConfigNavigationTreeShowTables_desc
|
||||
= __('Whether to show tables under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowViews_name = __('Show views in tree');
|
||||
$strConfigNavigationTreeShowViews_desc
|
||||
= __('Whether to show views under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowFunctions_name = __('Show functions in tree');
|
||||
$strConfigNavigationTreeShowFunctions_desc
|
||||
= __('Whether to show functions under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowProcedures_name = __('Show procedures in tree');
|
||||
$strConfigNavigationTreeShowProcedures_desc
|
||||
= __('Whether to show procedures under database in the navigation tree');
|
||||
$strConfigNavigationTreeShowEvents_name = __('Show events in tree');
|
||||
$strConfigNavigationTreeShowEvents_desc
|
||||
= __('Whether to show events under database in the navigation tree');
|
||||
$strConfigNumRecentTables_desc
|
||||
= __('Maximum number of recently used tables; set 0 to disable.');
|
||||
$strConfigNumFavoriteTables_desc
|
||||
|
||||
@ -176,13 +176,20 @@ $forms['Navi_panel']['Navi_panel'] = array(
|
||||
'NavigationLogoLinkWindow',
|
||||
'NavigationTreePointerEnable',
|
||||
'FirstLevelNavigationItems',
|
||||
'MaxNavigationItems',
|
||||
'NavigationTreeEnableGrouping',
|
||||
'NavigationTreeEnableExpansion',
|
||||
'NavigationTreeDisplayItemFilterMinimum',
|
||||
'NumRecentTables',
|
||||
'NumFavoriteTables'
|
||||
);
|
||||
$forms['Navi_panel']['Navi_tree'] = array(
|
||||
'MaxNavigationItems',
|
||||
'NavigationTreeEnableGrouping',
|
||||
'NavigationTreeEnableExpansion',
|
||||
'NavigationTreeShowTables',
|
||||
'NavigationTreeShowViews',
|
||||
'NavigationTreeShowFunctions',
|
||||
'NavigationTreeShowProcedures',
|
||||
'NavigationTreeShowEvents'
|
||||
);
|
||||
$forms['Navi_panel']['Navi_servers'] = array(
|
||||
'NavigationDisplayServers',
|
||||
'DisplayServersList');
|
||||
|
||||
@ -85,13 +85,20 @@ $forms['Navi_panel']['Navi_panel'] = array(
|
||||
'NavigationLogoLinkWindow',
|
||||
'NavigationTreePointerEnable',
|
||||
'FirstLevelNavigationItems',
|
||||
'MaxNavigationItems',
|
||||
'NavigationTreeEnableGrouping',
|
||||
'NavigationTreeEnableExpansion',
|
||||
'NavigationTreeDisplayItemFilterMinimum',
|
||||
'NumRecentTables',
|
||||
'NumFavoriteTables'
|
||||
);
|
||||
$forms['Navi_panel']['Navi_tree'] = array(
|
||||
'MaxNavigationItems',
|
||||
'NavigationTreeEnableGrouping',
|
||||
'NavigationTreeEnableExpansion',
|
||||
'NavigationTreeShowTables',
|
||||
'NavigationTreeShowViews',
|
||||
'NavigationTreeShowFunctions',
|
||||
'NavigationTreeShowProcedures',
|
||||
'NavigationTreeShowEvents'
|
||||
);
|
||||
$forms['Navi_panel']['Navi_databases'] = array(
|
||||
'NavigationTreeDisplayDbFilterMinimum',
|
||||
'NavigationTreeDbSeparator');
|
||||
|
||||
@ -189,6 +189,7 @@ class PMA_Navigation
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
|
||||
$typeMap = array(
|
||||
'group' => __('Groups:'),
|
||||
'event' => __('Events:'),
|
||||
'function' => __('Functions:'),
|
||||
'procedure' => __('Procedures:'),
|
||||
|
||||
@ -560,29 +560,57 @@ class PMA_NavigationTree
|
||||
*/
|
||||
private function _addDbContainers($db, $type, $pos2)
|
||||
{
|
||||
// Get items to hide
|
||||
$hidden = $db->getHiddenItems('group');
|
||||
if (!$GLOBALS['cfg']['NavigationTreeShowTables']
|
||||
&& !in_array('tables', $hidden)
|
||||
) {
|
||||
$hidden[] = 'tables';
|
||||
}
|
||||
if (!$GLOBALS['cfg']['NavigationTreeShowViews']
|
||||
&& !in_array('views', $hidden)
|
||||
) {
|
||||
$hidden[] = 'views';
|
||||
}
|
||||
if (!$GLOBALS['cfg']['NavigationTreeShowFunctions']
|
||||
&& !in_array('functions', $hidden)
|
||||
) {
|
||||
$hidden[] = 'functions';
|
||||
}
|
||||
if (!$GLOBALS['cfg']['NavigationTreeShowProcedures']
|
||||
&& !in_array('procedures', $hidden)
|
||||
) {
|
||||
$hidden[] = 'procedures';
|
||||
}
|
||||
if (!$GLOBALS['cfg']['NavigationTreeShowEvents']
|
||||
&& !in_array('events', $hidden)
|
||||
) {
|
||||
$hidden[] = 'events';
|
||||
}
|
||||
|
||||
$retval = array();
|
||||
if ($db->hasChildren(true) == 0) {
|
||||
if ($db->getPresence('tables')) {
|
||||
if (!in_array('tables', $hidden) && $db->getPresence('tables')) {
|
||||
$retval['tables'] = PMA_NodeFactory::getInstance(
|
||||
'Node_Table_Container'
|
||||
);
|
||||
}
|
||||
if ($db->getPresence('views')) {
|
||||
if (!in_array('views', $hidden) && $db->getPresence('views')) {
|
||||
$retval['views'] = PMA_NodeFactory::getInstance(
|
||||
'Node_View_Container'
|
||||
);
|
||||
}
|
||||
if ($db->getPresence('functions')) {
|
||||
if (!in_array('functions', $hidden) && $db->getPresence('functions')) {
|
||||
$retval['functions'] = PMA_NodeFactory::getInstance(
|
||||
'Node_Function_Container'
|
||||
);
|
||||
}
|
||||
if ($db->getPresence('procedures')) {
|
||||
if (!in_array('procedures', $hidden) && $db->getPresence('procedures')) {
|
||||
$retval['procedures'] = PMA_NodeFactory::getInstance(
|
||||
'Node_Procedure_Container'
|
||||
);
|
||||
}
|
||||
if ($db->getPresence('events')) {
|
||||
if (!in_array('events', $hidden) && $db->getPresence('events')) {
|
||||
$retval['events'] = PMA_NodeFactory::getInstance(
|
||||
'Node_Event_Container'
|
||||
);
|
||||
@ -1124,10 +1152,10 @@ class PMA_NavigationTree
|
||||
} else {
|
||||
$retval .= " {$node->name}";
|
||||
}
|
||||
$retval .= $node->getHtmlForControlButtons();
|
||||
if ($node->type == Node::CONTAINER) {
|
||||
$retval .= "</i>";
|
||||
}
|
||||
$retval .= $node->getHtmlForControlButtons();
|
||||
$retval .= '<div class="clearfloat"></div>';
|
||||
$wrap = true;
|
||||
} else {
|
||||
|
||||
@ -741,7 +741,40 @@ class Node
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
return '';
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if (isset($cfgRelation['navwork']) && $cfgRelation['navwork']) {
|
||||
if ($this instanceof Node_DatabaseChild_Container
|
||||
|| $this instanceof Node_DatabaseChild
|
||||
) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$item = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php'
|
||||
. PMA_URL_getCommon()
|
||||
. '&hideNavItem=true'
|
||||
. '&itemType=' . urlencode($this->getItemType())
|
||||
. '&itemName=' . urlencode($item)
|
||||
. '&dbName=' . urlencode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('lightbulb_off.png', __('Hide'))
|
||||
. '</a></span>';
|
||||
} else if ($this instanceof Node_Database) {
|
||||
if ($this->hiddenCount > 0) {
|
||||
$ret = '<span class="dbItemControls">'
|
||||
. '<a href="navigation.php'
|
||||
. PMA_URL_getCommon()
|
||||
. '&showUnhideDialog=true'
|
||||
. '&dbName=' . urldecode($this->real_name) . '"'
|
||||
. ' class="showUnhide ajax">'
|
||||
. PMA_Util::getImage(
|
||||
'lightbulb.png', __('Show hidden items')
|
||||
)
|
||||
. '</a></span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -21,7 +21,7 @@ class Node_Database extends Node
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_hiddenCount = 0;
|
||||
protected $hiddenCount = 0;
|
||||
|
||||
/**
|
||||
* Initialises the class
|
||||
@ -338,7 +338,6 @@ class Node_Database extends Node
|
||||
public function getData($type, $pos, $searchClause = '')
|
||||
{
|
||||
$retval = array();
|
||||
$db = $this->real_name;
|
||||
switch ($type) {
|
||||
case 'tables':
|
||||
$retval = $this->_getTables($pos, $searchClause);
|
||||
@ -362,30 +361,46 @@ class Node_Database extends Node
|
||||
// Remove hidden items so that they are not displayed in navigation tree
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if (isset($cfgRelation['navwork']) && $cfgRelation['navwork']) {
|
||||
$navTable = PMA_Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA_Util::backquote($cfgRelation['navigationhiding']);
|
||||
$sqlQuery = "SELECT `item_name` FROM " . $navTable
|
||||
. " WHERE `username`='" . $cfgRelation['user'] . "'"
|
||||
. " AND `item_type`='" . substr($type, 0, -1)
|
||||
. "'" . " AND `db_name`='" . PMA_Util::sqlAddSlashes($db) . "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
if ($result) {
|
||||
$hiddenItems = array();
|
||||
while ($row = $GLOBALS['dbi']->fetchArray($result)) {
|
||||
$hiddenItems[] = $row[0];
|
||||
}
|
||||
foreach ($retval as $key => $item) {
|
||||
if (in_array($item, $hiddenItems)) {
|
||||
unset($retval[$key]);
|
||||
}
|
||||
$hiddenItems = $this->getHiddenItems(substr($type, 0, -1));
|
||||
foreach ($retval as $key => $item) {
|
||||
if (in_array($item, $hiddenItems)) {
|
||||
unset($retval[$key]);
|
||||
}
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
}
|
||||
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of hidden items of given type
|
||||
*
|
||||
* @param string $type The type of items we are looking for
|
||||
* ('table', 'function', 'group', etc.)
|
||||
*
|
||||
* @return array Array containing hidden items of given type
|
||||
*/
|
||||
public function getHiddenItems($type)
|
||||
{
|
||||
$db = $this->real_name;
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
$navTable = PMA_Util::backquote($cfgRelation['db'])
|
||||
. "." . PMA_Util::backquote($cfgRelation['navigationhiding']);
|
||||
$sqlQuery = "SELECT `item_name` FROM " . $navTable
|
||||
. " WHERE `username`='" . $cfgRelation['user'] . "'"
|
||||
. " AND `item_type`='" . $type
|
||||
. "'" . " AND `db_name`='" . PMA_Util::sqlAddSlashes($db) . "'";
|
||||
$result = PMA_queryAsControlUser($sqlQuery, false);
|
||||
$hiddenItems = array();
|
||||
if ($result) {
|
||||
while ($row = $GLOBALS['dbi']->fetchArray($result)) {
|
||||
$hiddenItems[] = $row[0];
|
||||
}
|
||||
}
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
return $hiddenItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of tables or views inside this database
|
||||
*
|
||||
@ -624,32 +639,6 @@ class Node_Database extends Node
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML for show hidden button displayed infront of database node
|
||||
*
|
||||
* @return String HTML for show hidden button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if (isset($cfgRelation['navwork']) && $cfgRelation['navwork']) {
|
||||
if ($this->_hiddenCount > 0) {
|
||||
$ret = '<span class="dbItemControls">'
|
||||
. '<a href="navigation.php'
|
||||
. PMA_URL_getCommon()
|
||||
. '&showUnhideDialog=true'
|
||||
. '&dbName=' . urldecode($this->real_name) . '"'
|
||||
. ' class="showUnhide ajax">'
|
||||
. PMA_Util::getImage(
|
||||
'lightbulb.png', __('Show hidden items')
|
||||
)
|
||||
. '</a></span>';
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the number of hidden items in this database
|
||||
*
|
||||
@ -659,7 +648,7 @@ class Node_Database extends Node
|
||||
*/
|
||||
public function setHiddenCount($count)
|
||||
{
|
||||
$this->_hiddenCount = $count;
|
||||
$this->hiddenCount = $count;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -669,7 +658,7 @@ class Node_Database extends Node
|
||||
*/
|
||||
public function getHiddenCount()
|
||||
{
|
||||
return $this->_hiddenCount;
|
||||
return $this->hiddenCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,32 +16,6 @@ if (! defined('PHPMYADMIN')) {
|
||||
*/
|
||||
abstract class Node_DatabaseChild extends Node
|
||||
{
|
||||
/**
|
||||
* Returns HTML for hide button displayed infront of the database child node
|
||||
*
|
||||
* @return String HTML for hide button
|
||||
*/
|
||||
public function getHtmlForControlButtons()
|
||||
{
|
||||
$ret = '';
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
if (isset($cfgRelation['navwork']) && $cfgRelation['navwork']) {
|
||||
$db = $this->realParent()->real_name;
|
||||
$item = $this->real_name;
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php'
|
||||
. PMA_URL_getCommon()
|
||||
. '&hideNavItem=true'
|
||||
. '&itemType=' . urlencode($this->getItemType())
|
||||
. '&itemName=' . urlencode($item)
|
||||
. '&dbName=' . urlencode($db) . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. PMA_Util::getImage('lightbulb_off.png', __('Hide'))
|
||||
. '</a></span>';
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
|
||||
@ -32,5 +32,15 @@ abstract class Node_DatabaseChild_Container extends Node
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of the item represented by the node.
|
||||
*
|
||||
* @return string type of the item
|
||||
*/
|
||||
protected function getItemType()
|
||||
{
|
||||
return 'group';
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user