From c468705538f034e06447b85123063cdcfffc1b59 Mon Sep 17 00:00:00 2001 From: Aris Feryanto Date: Tue, 10 May 2011 01:55:02 +0700 Subject: [PATCH] Add PMA_addRecentTable function, jQuery for recent tables 'onchange' event --- Documentation.html | 25 +++++++++++++++++++++++++ js/navigation.js | 10 ++++++++++ libraries/RecentTable.class.php | 17 +++++++---------- libraries/header.inc.php | 26 ++++++++++++++++++-------- navigation.php | 2 +- 5 files changed, 61 insertions(+), 19 deletions(-) diff --git a/Documentation.html b/Documentation.html index cee6a4211e..55bc56d0c1 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1054,6 +1054,27 @@ ALTER TABLE `pma_column_comments` +
+ $cfg['Servers'][$i]['recent'] string +
+
+ Since release ??? you can show recently used tables in the left navigation frame. + It helps you to jump across table directly, without the need to select the database, + and then select the table. Using + $cfg['LeftRecentTable'] + you can configure the maximum number of recent tables shown.

+ + Without configuring the storage, you can still access the recently used tables, + but it will disappear after you logout.

+ + To allow the usage of this functionality: + + +
+
$cfg['Servers'][$i]['tracking'] string
@@ -1467,6 +1488,10 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE
Defines how many sublevels should be displayed when splitting up tables by the above separator.
+
$cfg['LeftRecentTable'] integer
+
The maximum number of recently used tables shown in the left navigation + frame. Set this to 0 (zero) to disable the recent tables.
+
$cfg['ShowTooltip'] boolean
Defines whether to display table comment as tool-tip in left frame or not.
diff --git a/js/navigation.js b/js/navigation.js index ed6dcb1049..9403ade8d4 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -177,4 +177,14 @@ $(document).ready(function(){ $('#clear_fast_filter').click(clear_fast_filter); $('#fast_filter').focus(function (evt) {evt.target.select();}); $('#fast_filter').keyup(function (evt) {fast_filter(evt.target.value);}); + + /* Jump to recent table */ + $('#recentTable').change(function() { + if (this.value != '') { + var arr = this.value.split('.'); + window.parent.setDb(arr[0]); + window.parent.setTable(arr[1]); + window.parent.refreshMain($('#LeftDefaultTabTable')[0].value); + } + }); }); diff --git a/libraries/RecentTable.class.php b/libraries/RecentTable.class.php index 387879e7a2..635b659a02 100644 --- a/libraries/RecentTable.class.php +++ b/libraries/RecentTable.class.php @@ -10,8 +10,7 @@ require_once './libraries/Message.class.php'; /** * Handles the recently used tables. * - * @TODO Add documentation about configuration LeftRecentTable - * @TODO Add documentation about table pma_recent (#recent) in Documentation.html + * @TODO Change the release version in table pma_recent (#recent in Documentation.html) * * @package phpMyAdmin */ @@ -124,7 +123,8 @@ class RecentTable */ public function trim() { - while (count($this->tables) > $GLOBALS['cfg']['LeftRecentTable']) { + $max = max($GLOBALS['cfg']['LeftRecentTable'], 0); + while (count($this->tables) > $max) { array_pop($this->tables); } } @@ -137,13 +137,10 @@ class RecentTable public function getHtmlSelect() { $this->trim(); - - $html = ''; + $html .= '