diff options
author | Kasun Chathuranga <chathuranga.jayaneththi@gmail.com> | 2013-07-21 13:16:16 +0400 |
---|---|---|
committer | Kasun Chathuranga <chathuranga.jayaneththi@gmail.com> | 2013-07-21 13:16:16 +0400 |
commit | 1282a3877f5459278399f621f65fe7ecef08da26 (patch) | |
tree | 39948131bc56daa980547c78d9828a967ea64a3e /navigation.php | |
parent | 66d01fcffb40eecde04bcb35119b2011f42626e9 (diff) |
Add a dialog to unhide hidden navigation tree items
Diffstat (limited to 'navigation.php')
-rw-r--r-- | navigation.php | 73 |
1 files changed, 49 insertions, 24 deletions
diff --git a/navigation.php b/navigation.php index 2c5080d5b2..2c35311e50 100644 --- a/navigation.php +++ b/navigation.php @@ -12,35 +12,60 @@ require_once './libraries/common.inc.php'; // Also initialises the collapsible tree class require_once './libraries/navigation/Navigation.class.php'; -$cfgRelation = PMA_getRelationsParam(); -if (isset($_REQUEST['hideNavItem']) && $cfgRelation['navwork']) { - if (! empty($_REQUEST['itemName']) && ! empty($_REQUEST['itemType'])) { - $navTable = PMA_Util::backquote($cfgRelation['db']) - . "." . PMA_Util::backquote($cfgRelation['navigation']); - $sqlQuery = "INSERT INTO " . $navTable - . "(`username`, `item_name`, `item_type`, `db_name`, `table_name`)" - . " VALUES (" - . "'" . $GLOBALS['cfg']['Server']['user'] . "'," - . "'" . $_REQUEST['itemName'] . "'," - . "'" . $_REQUEST['itemType'] . "'," - . "'" . (! empty($_REQUEST['dbName']) ? $_REQUEST['dbName'] : "") . "'," - . "'" . (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : "") - . "')"; - PMA_queryAsControlUser($sqlQuery, true); - } - exit; -} - -// Do the magic $response = PMA_Response::getInstance(); -if ($response->isAjax()) { - $navigation = new PMA_Navigation(); - $response->addJSON('message', $navigation->getDisplay()); -} else { +$navigation = new PMA_Navigation(); +if (! $response->isAjax()) { $response->addHTML( PMA_Message::error( __('Fatal error: The navigation can only be accessed via AJAX') ) ); + exit; } + +$cfgRelation = PMA_getRelationsParam(); +if ($cfgRelation['navwork']) { + if (isset($_REQUEST['hideNavItem'])) { + if (! empty($_REQUEST['itemName']) + && ! empty($_REQUEST['itemType']) + && ! empty($_REQUEST['dbName']) + ) { + $navigation->hideNavigationItem( + $_REQUEST['itemName'], + $_REQUEST['itemType'], + $_REQUEST['dbName'], + (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null) + ); + } + exit; + } + + if (isset($_REQUEST['unhideNavItem'])) { + if (! empty($_REQUEST['itemName']) + && ! empty($_REQUEST['itemType']) + && ! empty($_REQUEST['dbName']) + ) { + $navigation->unhideNavigationItem( + $_REQUEST['itemName'], + $_REQUEST['itemType'], + $_REQUEST['dbName'], + (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null) + ); + } + exit; + } + + if (isset($_REQUEST['showUnhideDialog'])) { + if (! empty($_REQUEST['dbName'])) { + $response->addJSON( + 'message', + $navigation->getItemUnhideDialog($_REQUEST['dbName']) + ); + } + exit; + } +} + +// Do the magic +$response->addJSON('message', $navigation->getDisplay()); ?> |