The branch, master has been updated via 8f2a040f41f2cd03e359bcadeb8d9f24c23290fa (commit) via ab6d16ed2f4728c9f066353a851621a352ef969f (commit) via c2edb0a165115b71a13b26f7e27d870f1cd3c1d7 (commit) via 5dee868bfff80abfb7aea70d1d41a083117fd2ba (commit) via 456640c457d62ff0e0a0d7965cca4aa0135aed93 (commit) via 963d77e3bef98f6f8624dd5ee28b92405ad77149 (commit) via fadd8994ccc41f1a7bc74509428a50a89d8789ac (commit) via 44d05b522c7cfb7cd3a36bb20257441248761bdd (commit) via 4ab5d6aded69bd4ce43777326cc225324cbbd39a (commit) via b49922c14b4ac6ca98042f755c95a2b80ac5a563 (commit) via 6e4abf02d6af2a32fc9ebff6410a3603dc50ba4b (commit) via b8c654d748c7de1fde1c388743c734a6a6b30d9c (commit) via 0c0b4376799ebf517d026c7489ea5d746d5a3607 (commit) via 48092de206fd1c07bf4696ace0071a565be6630a (commit) via c468705538f034e06447b85123063cdcfffc1b59 (commit) via ed646a067f057ba8e133a06c3224a7ab9f98a1c1 (commit) via 04bbe91b52ca660d0743d0bc644823e8960fffb0 (commit) via d5421a41f9491edeebfde55c49823ada7f5dabed (commit) via 23021911b14cf6834fa4e04f5cbe79c736e2c425 (commit) via 576fca3dc2a45800c4e9a7bdea6ef3a3f17863bb (commit) via 21bceed4148081c50f0b2b03126717d41b65f10a (commit) via 4b7e65e6107706b9d9ea9b671f509935ed49f3f0 (commit) via e4820139bf284418956e3cf6ea86cb292155f61e (commit) via 175ffa5c4ea914bcffcf139902857b8d35ded5f6 (commit) from 755fc28b49b3012cc80881720f54f5c3781285ea (commit)
- Log ----------------------------------------------------------------- commit 8f2a040f41f2cd03e359bcadeb8d9f24c23290fa Merge: 755fc28b49b3012cc80881720f54f5c3781285ea ab6d16ed2f4728c9f066353a851621a352ef969f Author: Marc Delisle marc@infomarc.info Date: Tue May 24 08:18:25 2011 -0400
Merge commit 'ab6d16ed2f4728c9f066353a851621a352ef969f'
commit ab6d16ed2f4728c9f066353a851621a352ef969f Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 24 08:38:09 2011 +0700
Set default LeftRecentTable to 10
commit c2edb0a165115b71a13b26f7e27d870f1cd3c1d7 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 24 08:31:50 2011 +0700
Remove inline javascript and use jQuery instead
commit 5dee868bfff80abfb7aea70d1d41a083117fd2ba Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sat May 14 12:34:13 2011 +0700
Move recent tables trimming to correct place
commit 456640c457d62ff0e0a0d7965cca4aa0135aed93 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sat May 14 12:21:49 2011 +0700
Some fix for ajaxification
commit 963d77e3bef98f6f8624dd5ee28b92405ad77149 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sat May 14 02:46:15 2011 +0700
Ajaxification of recent tables list
commit fadd8994ccc41f1a7bc74509428a50a89d8789ac Author: Aris Feryanto aris_feryanto@yahoo.com Date: Wed May 11 11:27:47 2011 +0700
Documentation for cfg_LeftRecentTable updated
commit 44d05b522c7cfb7cd3a36bb20257441248761bdd Merge: 4ab5d6aded69bd4ce43777326cc225324cbbd39a 071bc679dbd8bd2ece5182bdb471c027f33daf6c Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 21:40:53 2011 +0700
Merge remote-tracking branch 'origin/master' into browsemode
commit 4ab5d6aded69bd4ce43777326cc225324cbbd39a Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 20:42:48 2011 +0700
Update documentation and string for the pma_recent
commit b49922c14b4ac6ca98042f755c95a2b80ac5a563 Merge: 6e4abf02d6af2a32fc9ebff6410a3603dc50ba4b 7698df152041315049ad0e8b7db235e7fbbe7d7c Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 20:29:18 2011 +0700
Merge remote-tracking branch 'origin/master' into browsemode
commit 6e4abf02d6af2a32fc9ebff6410a3603dc50ba4b Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 16:18:18 2011 +0700
Validation (non-negative number) for LeftRecentTable
commit b8c654d748c7de1fde1c388743c734a6a6b30d9c Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 09:56:24 2011 +0700
Updated target release 3.5.0 for 'recent' feature in Documentation.html
commit 0c0b4376799ebf517d026c7489ea5d746d5a3607 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 09:20:17 2011 +0700
Not refresh the navigation if the recent tables is not configured, added some checking
commit 48092de206fd1c07bf4696ace0071a565be6630a Merge: c468705538f034e06447b85123063cdcfffc1b59 8d3ebd746dfbfe4e2ca86121f0448ba7d5187432 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 01:55:59 2011 +0700
Merge remote-tracking branch 'origin/master' into browsemode
commit c468705538f034e06447b85123063cdcfffc1b59 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Tue May 10 01:55:02 2011 +0700
Add PMA_addRecentTable function, jQuery for recent tables 'onchange' event
commit ed646a067f057ba8e133a06c3224a7ab9f98a1c1 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Mon May 9 20:35:08 2011 +0700
Added array_merge (RecentTable.class.php) to ensure the keys are continuous
commit 04bbe91b52ca660d0743d0bc644823e8960fffb0 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sun May 8 22:40:46 2011 +0700
Recently used tables (fix bug & add pma_recent in /setup)
commit d5421a41f9491edeebfde55c49823ada7f5dabed Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sun May 8 03:11:09 2011 +0700
Recently used tables (add SQL in scripts/create_tables.sql)
commit 23021911b14cf6834fa4e04f5cbe79c736e2c425 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sun May 8 02:42:38 2011 +0700
Recently used tables (class, configuration, remember in pma database)
commit 576fca3dc2a45800c4e9a7bdea6ef3a3f17863bb Merge: 21bceed4148081c50f0b2b03126717d41b65f10a fd1ac3cdac0a302ace44c966337822d7589a129c Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sat May 7 14:52:13 2011 +0700
Merge remote branch 'origin/master' into browsemode
commit 21bceed4148081c50f0b2b03126717d41b65f10a Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sat May 7 14:52:07 2011 +0700
Recently used tables (now with configuration)
commit 4b7e65e6107706b9d9ea9b671f509935ed49f3f0 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Mon May 2 10:09:05 2011 +0700
Recently used tables (works, but only in temporary session variable)
commit e4820139bf284418956e3cf6ea86cb292155f61e Merge: 175ffa5c4ea914bcffcf139902857b8d35ded5f6 3256a4407600b6d1cbba29b1cb05ffadb6a1ad67 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Mon May 2 09:41:32 2011 +0700
Merge remote branch 'origin/master' into browsemode
commit 175ffa5c4ea914bcffcf139902857b8d35ded5f6 Author: Aris Feryanto aris_feryanto@yahoo.com Date: Sun May 1 22:58:47 2011 +0700
Recently used tables (simple version, only works with LeftDefaultTablTable=tbl_structure.php)
-----------------------------------------------------------------------
Summary of changes: Documentation.html | 27 ++++ config.sample.inc.php | 1 + js/functions.js | 4 + js/navigation.js | 23 +++ libraries/RecentTable.class.php | 200 +++++++++++++++++++++++++++ libraries/config.default.php | 14 ++ libraries/config.values.php | 1 + libraries/config/messages.inc.php | 4 + libraries/config/setup.forms.php | 4 +- libraries/config/user_preferences.forms.php | 3 +- libraries/header.inc.php | 23 +++- libraries/relation.lib.php | 16 ++- navigation.php | 18 +++ scripts/create_tables.sql | 12 ++ themes/original/css/theme_left.css.php | 10 ++ themes/pmahomme/css/theme_left.css.php | 12 ++- 16 files changed, 365 insertions(+), 7 deletions(-) create mode 100644 libraries/RecentTable.class.php
diff --git a/Documentation.html b/Documentation.html index 5b3da22..3bbb832 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1054,6 +1054,29 @@ ALTER TABLE `pma_column_comments` </ul> </dd>
+ <dt id="recent"> + <span id="cfg_Servers_recent">$cfg['Servers'][$i]['recent']</span> string + </dt> + <dd> + Since release 3.5.0 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 + <a href="#cfg_LeftRecentTable" class="configrule">$cfg['LeftRecentTable']</a> + you can configure the maximum number of recent tables shown. When you select a table + from the list, it will jump to the page specified in + <a href="#cfg_LeftDefaultTabTable" class="configrule">$cfg['LeftDefaultTabTable']</a>.<br/><br/> + + Without configuring the storage, you can still access the recently used tables, + but it will disappear after you logout.<br/><br/> + + To allow the usage of this functionality: + + <ul> + <li>set up <a href="#pmadb">pmadb</a> and the phpMyAdmin configuration storage</li> + <li>put the table name in <tt>$cfg['Servers'][$i]['recent']</tt> (e.g. 'pma_recent')</li> + </ul> + </dd> + <dt id="tracking"> <span id="cfg_Servers_tracking">$cfg['Servers'][$i]['tracking']</span> string </dt> @@ -1469,6 +1492,10 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE</pre> <dd>Defines how many sublevels should be displayed when splitting up tables by the above separator.</dd>
+ <dt id="cfg_LeftRecentTable">$cfg['LeftRecentTable'] integer</dt> + <dd>The maximum number of recently used tables shown in the left navigation + frame. Set this to 0 (zero) to disable the listing of recent tables.</dd> + <dt id="cfg_ShowTooltip">$cfg['ShowTooltip'] boolean</dt> <dd>Defines whether to display table comment as tool-tip in left frame or not.</dd> diff --git a/config.sample.inc.php b/config.sample.inc.php index 0ea16d5..95d3a1a 100644 --- a/config.sample.inc.php +++ b/config.sample.inc.php @@ -52,6 +52,7 @@ $cfg['Servers'][$i]['AllowNoPassword'] = false; // $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages'; // $cfg['Servers'][$i]['column_info'] = 'pma_column_info'; // $cfg['Servers'][$i]['history'] = 'pma_history'; +// $cfg['Servers'][$i]['recent'] = 'pma_recent'; // $cfg['Servers'][$i]['tracking'] = 'pma_tracking'; // $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords'; // $cfg['Servers'][$i]['userconfig'] = 'pma_userconfig'; diff --git a/js/functions.js b/js/functions.js index a5118df..f745e8c 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2287,6 +2287,10 @@ $(document).ready(function() { } });
+ $('#update_recent_tables').ready(function() { + window.parent.frame_navigation.PMA_reloadRecentTable(); + }); + }) // end of $(document).ready()
/** diff --git a/js/navigation.js b/js/navigation.js index 5052848..52d13cf 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -167,6 +167,19 @@ function clear_fast_filter() { elm.focus(); }
+/** + * Reloads the recent tables list. + */ +function PMA_reloadRecentTable() { + $.get('navigation.php', + { 'token' : window.parent.token, 'ajax_request' : true, 'recent_table' : true }, + function (data) { + if (data.success == true) { + $('#recentTable').html(data.options); + } + }); +} + /* Performed on load */ $(document).ready(function(){ /* Display filter */ @@ -179,4 +192,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 new file mode 100644 index 0000000..ebe93f5 --- /dev/null +++ b/libraries/RecentTable.class.php @@ -0,0 +1,200 @@ +<?php +/* vim: set expandtab sw=4 ts=4 sts=4: */ +/** + * + * @package phpMyAdmin + */ + +require_once './libraries/Message.class.php'; + +/** + * Handles the recently used tables. + * + * @TODO Change the release version in table pma_recent (#recent in Documentation.html) + * + * @package phpMyAdmin + */ +class RecentTable +{ + /** + * Defines the internal PMA table which contains recent tables. + * + * @access private + * @var string + */ + private $pma_table; + + /** + * Reference to session variable containing recently used tables. + * + * @access public + * @var array + */ + public $tables; + + /** + * RecentTable instance. + * + * @var RecentTable + */ + private static $_instance; + + public function __construct() + { + if (strlen($GLOBALS['cfg']['Server']['pmadb']) && + strlen($GLOBALS['cfg']['Server']['recent'])) { + $this->pma_table = PMA_backquote($GLOBALS['cfg']['Server']['pmadb']) .".". + PMA_backquote($GLOBALS['cfg']['Server']['recent']); + } + if (! isset($_SESSION['tmp_user_values']['recent_tables'])) { + $_SESSION['tmp_user_values']['recent_tables'] = + isset($this->pma_table) ? $this->getFromDb() : array(); + } + $this->tables =& $_SESSION['tmp_user_values']['recent_tables']; + } + + /** + * Returns class instance. + * + * @return RecentTable + */ + public static function getInstance() + { + if (is_null(self::$_instance)) { + self::$_instance = new RecentTable(); + } + return self::$_instance; + } + + /** + * Returns recently used tables from phpMyAdmin database. + * + * @uses $pma_table + * @uses PMA_query_as_controluser() + * @uses PMA_DBI_fetch_array() + * @uses json_decode() + * + * @return array + */ + public function getFromDb() + { + // Read from phpMyAdmin database, if recent tables is not in session + $sql_query = + " SELECT `tables` FROM " . $this->pma_table . + " WHERE `username` = '" . $GLOBALS['cfg']['Server']['user'] . "'"; + + $row = PMA_DBI_fetch_array(PMA_query_as_controluser($sql_query)); + if (isset($row[0])) { + return json_decode($row[0]); + } else { + return array(); + } + } + + /** + * Save recent tables into phpMyAdmin database. + * + * @uses PMA_DBI_try_query() + * @uses json_decode() + * @uses PMA_Message + * + * @return true|PMA_Message + */ + public function saveToDb() + { + $username = $GLOBALS['cfg']['Server']['user']; + $sql_query = + " REPLACE INTO " . $this->pma_table . " (`username`, `tables`)" . + " VALUES ('" . $username . "', '" . PMA_sqlAddslashes(json_encode($this->tables)) . "')"; + + $success = PMA_DBI_try_query($sql_query, $GLOBALS['controllink']); + + if (!$success) { + $message = PMA_Message::error(__('Could not save recent table')); + $message->addMessage('<br /><br />'); + $message->addMessage(PMA_Message::rawError(PMA_DBI_getError($GLOBALS['controllink']))); + return $message; + } + return true; + } + + /** + * Trim recent table according to the LeftRecentTable configuration. + * + * @return boolean True if trimming occurred + */ + public function trim() + { + $max = max($GLOBALS['cfg']['LeftRecentTable'], 0); + $trimming_occured = count($this->tables) > $max; + while (count($this->tables) > $max) { + array_pop($this->tables); + } + return $trimming_occured; + } + + /** + * Return options for HTML select. + * + * @return string + */ + public function getHtmlSelectOption() + { + // trim and save, in case where the configuration is changed + if ($this->trim() && isset($this->pma_table)) { + $this->saveToDb(); + } + + $html = '<option value="">(' . __('Recent tables') . ') ...</option>'; + if (count($this->tables)) { + foreach ($this->tables as $table) { + $html .= '<option value="' . $table . '">' . $table . '</option>'; + } + } else { + $html .= '<option value="">' . __('There are no recent tables') . '</option>'; + } + return $html; + } + + /** + * Return HTML select. + * + * @return string + */ + public function getHtmlSelect() + { + $html = '<input type="hidden" id="LeftDefaultTabTable" value="' . + $GLOBALS['cfg']['LeftDefaultTabTable'] . '" />'; + $html .= '<select id="recentTable">'; + $html .= $this->getHtmlSelectOption(); + $html .= '</select>'; + + return $html; + } + + /** + * Add recently used tables. + * + * @param string $db Database name where the table is located + * @param string $table Table name + * + * @return true|PMA_Message True if success, PMA_Message if not + */ + public function add($db, $table) + { + $table_str = $db . '.' . $table; + + // add only if this is new table + if (! isset($this->tables[0]) || $this->tables[0] != $table_str) { + array_unshift($this->tables, $table_str); + $this->tables = array_merge(array_unique($this->tables)); + $this->trim(); + if (isset($this->pma_table)) { + return $this->saveToDb(); + } + } + return true; + } + +} +?> diff --git a/libraries/config.default.php b/libraries/config.default.php index 4ca31e7..5c0b1b2 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -339,6 +339,13 @@ $cfg['Servers'][$i]['history'] = ''; $cfg['Servers'][$i]['designer_coords'] = '';
/** + * table to store recently used tables + * - leave blank for no "persistent" recently used tables + * SUGGESTED: 'pma_recent' + */ +$cfg['Servers'][$i]['recent'] = ''; + +/** * table to store SQL tracking * - leave blank for no SQL tracking * SUGGESTED: 'pma_tracking' @@ -795,6 +802,13 @@ $cfg['LeftLogoLink'] = 'main.php'; $cfg['LeftLogoLinkWindow'] = 'main';
/** + * number of recently used tables displayed in the navigation frame + * + * @global integer $cfg['LeftRecentTable'] + */ +$cfg['LeftRecentTable'] = 10; + +/** * display a JavaScript table filter in the left frame * when more then x tables are present * diff --git a/libraries/config.values.php b/libraries/config.values.php index b519037..d884e59 100644 --- a/libraries/config.values.php +++ b/libraries/config.values.php @@ -159,6 +159,7 @@ $cfg_db['_validators'] = array( 'Import/skip_queries' => 'validate_non_negative_number', 'InsertRows' => 'validate_positive_number', 'LeftFrameTableLevel' => 'validate_positive_number', + 'LeftRecentTable' => 'validate_non_negative_number', 'LimitChars' => 'validate_positive_number', 'LoginCookieValidity' => 'validate_positive_number', 'LoginCookieStore' => 'validate_non_negative_number', diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 8ea3cef..e8ce0df 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -283,6 +283,8 @@ $strConfigLeftLogoLinkWindow_desc = __('Open the linked page in the main window $strConfigLeftLogoLinkWindow_name = __('Logo link target'); $strConfigLeftPointerEnable_desc = __('Highlight server under the mouse cursor'); $strConfigLeftPointerEnable_name = __('Enable highlighting'); +$strConfigLeftRecentTable_desc = __('Maximum number of recently used tables; set 0 to disable'); +$strConfigLeftRecentTable_name = __('Recently used tables'); $strConfigLightTabs_desc = __('Use less graphically intense tabs'); $strConfigLightTabs_name = __('Light tabs'); $strConfigLimitChars_desc = __('Maximum number of characters shown in any non-numeric column on browse view'); @@ -401,6 +403,8 @@ $strConfigServers_pmadb_desc = __('Database used for relations, bookmarks, and P $strConfigServers_pmadb_name = __('Database name'); $strConfigServers_port_desc = __('Port on which MySQL server is listening, leave empty for default'); $strConfigServers_port_name = __('Server port'); +$strConfigServers_recent_desc = __('Leave blank for no "persistent" recently used tables across sessions, suggested: [kbd]pma_recent[/kbd]'); +$strConfigServers_recent_name = __('Recently used table'); $strConfigServers_relation_desc = __('Leave blank for no [a@http://wiki.phpmyadmin.net/pma/relation%5Drelation-links%5B/a] support, suggested: [kbd]pma_relation[/kbd]'); $strConfigServers_relation_name = __('Relation table'); $strConfigServers_ShowDatabasesCommand_desc = __('SQL command to fetch available databases'); diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php index 5287aad..7269823 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -73,6 +73,7 @@ $forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array( 'table_info' => 'pma_table_info', 'column_info' => 'pma_column_info', 'history' => 'pma_history', + 'recent' => 'pma_recent', 'tracking' => 'pma_tracking', 'table_coords' => 'pma_table_coords', 'pdf_pages' => 'pma_pdf_pages', @@ -162,7 +163,8 @@ $forms['Left_frame']['Left_frame'] = array( 'LeftDisplayLogo', 'LeftLogoLink', 'LeftLogoLinkWindow', - 'LeftPointerEnable'); + 'LeftPointerEnable', + 'LeftRecentTable'); $forms['Left_frame']['Left_servers'] = array( 'LeftDisplayServers', 'DisplayServersList'); diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php index d23edda..ffe0366 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -77,7 +77,8 @@ $forms['Left_frame']['Left_frame'] = array( 'LeftDisplayLogo', 'LeftLogoLink', 'LeftLogoLinkWindow', - 'LeftPointerEnable'); + 'LeftPointerEnable', + 'LeftRecentTable'); $forms['Left_frame']['Left_databases'] = array( 'DisplayDatabasesList', 'LeftFrameDBTree', diff --git a/libraries/header.inc.php b/libraries/header.inc.php index f6c3dcd..4036f86 100644 --- a/libraries/header.inc.php +++ b/libraries/header.inc.php @@ -8,11 +8,25 @@ if (! defined('PHPMYADMIN')) { exit; }
+require_once './libraries/common.inc.php'; +require_once './libraries/RecentTable.class.php'; + + /** + * Add recently used table and reload the navigation. * + * @param string $db Database name where the table is located. + * @param string $table The table name */ -require_once './libraries/common.inc.php'; - +function PMA_addRecentTable($db, $table) { + $tmp_result = RecentTable::getInstance()->add($db, $table); + if ($tmp_result === true) { + echo '<span class="hide" id="update_recent_tables"></span>'; + } else { + $error = $tmp_result; + $error->display(); + } +}
/** * This is not an Ajax request so we need to generate all this output. @@ -151,6 +165,11 @@ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) { .'"' . htmlspecialchars($show_comment) .'"</span>' . "\n"; } // end if + + // add recently used table and reload the navigation + if ($GLOBALS['cfg']['LeftRecentTable'] > 0) { + PMA_addRecentTable($GLOBALS['db'], $GLOBALS['table']); + } } else { // no table selected, display database comment if present /** diff --git a/libraries/relation.lib.php b/libraries/relation.lib.php index 338f833..87521a9 100644 --- a/libraries/relation.lib.php +++ b/libraries/relation.lib.php @@ -138,6 +138,10 @@ function PMA_printRelationsParamDiagnostic($cfgRelation)
PMA_printDiagMessageForFeature(__('Designer'), 'designerwork', $messages);
+ PMA_printDiagMessageForParameter('recent', isset($cfgRelation['recent']), $messages, 'recent'); + + PMA_printDiagMessageForFeature(__('Persistent recently used tables'), 'recentwork', $messages); + PMA_printDiagMessageForParameter('tracking', isset($cfgRelation['tracking']), $messages, 'tracking');
PMA_printDiagMessageForFeature(__('Tracking'), 'trackingwork', $messages); @@ -220,6 +224,7 @@ function PMA__getRelationsParam() $cfgRelation['commwork'] = false; $cfgRelation['mimework'] = false; $cfgRelation['historywork'] = false; + $cfgRelation['recentwork'] = false; $cfgRelation['trackingwork'] = false; $cfgRelation['designerwork'] = false; $cfgRelation['userconfigwork'] = false; @@ -271,6 +276,8 @@ function PMA__getRelationsParam() $cfgRelation['pdf_pages'] = $curr_table[0]; } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['history']) { $cfgRelation['history'] = $curr_table[0]; + } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['recent']) { + $cfgRelation['recent'] = $curr_table[0]; } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['tracking']) { $cfgRelation['tracking'] = $curr_table[0]; } elseif ($curr_table[0] == $GLOBALS['cfg']['Server']['userconfig']) { @@ -325,6 +332,10 @@ function PMA__getRelationsParam() $cfgRelation['historywork'] = true; }
+ if (isset($cfgRelation['recent'])) { + $cfgRelation['recentwork'] = true; + } + if (isset($cfgRelation['tracking'])) { $cfgRelation['trackingwork'] = true; } @@ -346,8 +357,9 @@ function PMA__getRelationsParam() if ($cfgRelation['relwork'] && $cfgRelation['displaywork'] && $cfgRelation['pdfwork'] && $cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfgRelation['historywork'] - && $cfgRelation['trackingwork'] && $cfgRelation['userconfigwork'] - && $cfgRelation['bookmarkwork'] && $cfgRelation['designerwork']) { + && $cfgRelation['recentwork'] && $cfgRelation['trackingwork'] + && $cfgRelation['userconfigwork'] && $cfgRelation['bookmarkwork'] + && $cfgRelation['designerwork']) { $cfgRelation['allworks'] = true; }
diff --git a/navigation.php b/navigation.php index a07a516..ac12807 100644 --- a/navigation.php +++ b/navigation.php @@ -53,6 +53,16 @@ function PMA_exitNavigationFrame() exit; }
+require_once './libraries/common.lib.php'; +require_once './libraries/RecentTable.class.php'; + +/** + * Check if it is an ajax request to reload the recent tables list. + */ +if ($GLOBALS['is_ajax_request'] && $_REQUEST['recent_table']) { + PMA_ajaxResponse('', true, array('options' => RecentTable::getInstance()->getHtmlSelectOption()) ); +} + // keep the offset of the db list in session before closing it if (! isset($_SESSION['tmp_user_values']['navi_limit_offset'])) { $_SESSION['tmp_user_values']['navi_limit_offset'] = 0; @@ -179,6 +189,14 @@ require_once './libraries/header_http.inc.php'; <body id="body_leftFrame"> <?php require './libraries/navigation_header.inc.php'; + +// display recently used tables +if ($GLOBALS['cfg']['LeftRecentTable'] > 0) { + echo '<div id="recentTableList">'; + echo RecentTable::getInstance()->getHtmlSelect(); + echo '</div>'; +} + if (! $GLOBALS['server']) { // no server selected PMA_exitNavigationFrame(); diff --git a/scripts/create_tables.sql b/scripts/create_tables.sql index 1efdaad..2d6cb56 100644 --- a/scripts/create_tables.sql +++ b/scripts/create_tables.sql @@ -105,6 +105,18 @@ CREATE TABLE IF NOT EXISTS `pma_pdf_pages` (
-- --------------------------------------------------------
+-- +-- Table structure for table `pma_recent` +-- + +CREATE TABLE IF NOT EXISTS `pma_recent` ( + `username` varchar(64) COLLATE utf8_bin NOT NULL, + `tables` blob NOT NULL, + PRIMARY KEY (`username`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- -------------------------------------------------------- + -- -- Table structure for table `pma_relation` -- diff --git a/themes/original/css/theme_left.css.php b/themes/original/css/theme_left.css.php index 50ffc39..f21bca2 100644 --- a/themes/original/css/theme_left.css.php +++ b/themes/original/css/theme_left.css.php @@ -83,6 +83,16 @@ div#pmalogo { background-color: <?php echo $GLOBALS['cfg']['NaviBackground']; ?>; padding:.3em; } + +div#recentTableList { + text-align: center; + margin-bottom: 0.5em; +} + +div#recentTableList select { + width: 100%; +} + div#pmalogo, div#leftframelinks, div#databaseList { diff --git a/themes/pmahomme/css/theme_left.css.php b/themes/pmahomme/css/theme_left.css.php index 467e70a..e0a6393 100644 --- a/themes/pmahomme/css/theme_left.css.php +++ b/themes/pmahomme/css/theme_left.css.php @@ -94,11 +94,21 @@ button { div#pmalogo { <?php //better echo $GLOBALS['cfg']['logoBGC']; ?> } + +div#recentTableList { + text-align: center; + margin: 20px 10px 0px 10px; +} + +div#recentTableList select { + width: 100%; +} + div#pmalogo, div#leftframelinks, div#databaseList { text-align: center; - margin: 20px 10px 0px 10px; + margin: 5px 10px 0px 10px; }
ul#databaseList {
hooks/post-receive