From 3f258cfb45cbcc23ebb45a75cb091d06fa595dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 21 Oct 2004 10:18:12 +0000 Subject: [PATCH] Cleanup of message displaying and navigation reloading. --- ChangeLog | 7 ++++++ db_details_common.php | 44 ++--------------------------------- db_details_links.php | 8 +++++++ header.inc.php | 3 +++ ldi_table.php | 1 + libraries/common.lib.php | 37 +++++++++++++++++++---------- main.php | 22 +++++++----------- server_binlog.php | 2 +- server_links.inc.php | 16 ++++++------- server_processlist.php | 2 +- sql.php | 1 + tbl_alter.php | 12 ++++++++++ tbl_change.php | 8 +++++-- tbl_properties.php | 7 +++++- tbl_properties_common.php | 9 ++----- tbl_properties_export.php | 8 +++++-- tbl_properties_links.php | 26 ++++++++++++++++++++- tbl_properties_operations.php | 16 +++++-------- tbl_properties_structure.php | 12 ++++++++-- tbl_properties_table_info.php | 22 ------------------ tbl_relation.php | 17 +++++++++++--- tbl_select.php | 9 +++++++ 22 files changed, 161 insertions(+), 128 deletions(-) diff --git a/ChangeLog b/ChangeLog index 87fb690fe..a0c868d17 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,13 @@ phpMyAdmin - Changelog $Id$ $Source$ +2004-10-21 Michal Čihař + * [too many files to mention]: Cleanup of message displaying and + navigation reloading. Messages are now displayed bellow tabs (RFE + #1005511), navigation is reloaded once in header (I'm not sure whether I + choose correct version of reload code, we have several diferent, but it + seems to work well). + 2004-10-20 Marc Delisle * libraries/common.lib.php: there was already a tip icon in our collection, thanks to Michael Keck diff --git a/db_details_common.php b/db_details_common.php index c0878214d..f29fb8b4f 100644 --- a/db_details_common.php +++ b/db_details_common.php @@ -44,48 +44,8 @@ if (isset($submitcollation) && !empty($db_collation) && PMA_MYSQL_INT_VERSION >= unset($db_charset, $db_collation); } -// Displays headers -if (!isset($message)) { - $js_to_run = 'functions.js'; - require_once('./header.inc.php'); - // Reloads the navigation frame via JavaScript if required - if (isset($reload) && $reload) { - echo "\n"; - ?> - - '; } + +/** + * Displays a message + */ +if (!empty($message)) { + PMA_showMessage($message); + unset($message); +} ?>
diff --git a/header.inc.php b/header.inc.php index 242242c77..06efbb67a 100644 --- a/header.inc.php +++ b/header.inc.php @@ -127,6 +127,9 @@ if (empty($GLOBALS['is_header_sent'])) { diff --git a/ldi_table.php b/ldi_table.php index 39d65410f..fb08b4c11 100644 --- a/ldi_table.php +++ b/ldi_table.php @@ -21,6 +21,7 @@ require('./tbl_properties_common.php'); $err_url = 'ldi_table.php' . $err_url; $url_query .= '&goto=ldi_table.php&back=ldi_table.php'; require('./tbl_properties_table_info.php'); +require('./tbl_properties_links.php'); /** * Displays the form diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 6e3f20093..82238594f 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -1484,21 +1484,14 @@ if ($is_minimum_common == FALSE) { } } // end of the 'PMA_countRecords()' function - /** - * Displays a message at the top of the "main" (right) frame + * Reloads navigation if needed. * - * @param string the message to display - * - * @global array the configuration array + * @global bool whehter to reload * * @access public */ - function PMA_showMessage($message) - { - global $cfg; - - require_once('./header.inc.php'); + function PMA_reloadNavigation() { // Reloads the navigation frame via JavaScript if required if (isset($GLOBALS['reload']) && $GLOBALS['reload']) { @@ -1516,9 +1509,23 @@ if (typeof(window.parent) != 'undefined' +
@@ -1622,7 +1630,12 @@ if (typeof(document.getElementById) != 'undefined' } else if (!empty($GLOBALS['validatequery'])) { $query_base = PMA_validateSQL($query_base); } else { - $parsed_sql = PMA_SQP_parse($query_base); + // avoid reparsing query: + if (isset($GLOBALS['parsed_sql']) && $query_base = $GLOBALS['parsed_sql']['raw']) { + $parsed_sql = $GLOBALS['parsed_sql']; + } else { + $parsed_sql = PMA_SQP_parse($query_base); + } $query_base = PMA_formatSql($parsed_sql, $query_base); } diff --git a/main.php b/main.php index c8a653883..db164fcea 100644 --- a/main.php +++ b/main.php @@ -52,20 +52,6 @@ if (isset($table)) { } $show_query = '1'; require_once('./header.inc.php'); -if (isset($message)) { - PMA_showMessage($message); -} -else if (isset($reload) && $reload) { - // Reloads the navigation frame via JavaScript if required - echo "\n"; - ?> - - 0) { } // end if +// Any message to display? + +if (isset($message)) { + PMA_showMessage($message); + unset($message); +} + /** * Reload mysql (flush privileges) */ diff --git a/server_binlog.php b/server_binlog.php index f57ce3733..27a015888 100644 --- a/server_binlog.php +++ b/server_binlog.php @@ -57,7 +57,7 @@ while ($row = PMA_DBI_fetch_assoc($res)) { unset($res); unset($row); -PMA_showMessage($GLOBALS['strSQLQuery']); +PMA_showMessage($GLOBALS['strSuccess']); /** diff --git a/server_links.inc.php b/server_links.inc.php index 517c4c491..2732ecf7e 100644 --- a/server_links.inc.php +++ b/server_links.inc.php @@ -30,14 +30,6 @@ if ($is_superuser) { } -/** - * Displays a message - */ -if (!empty($message)) { - PMA_showMessage($message); -} - - /** * Displays tab links */ @@ -79,5 +71,13 @@ if (!$cfg['LightTabs']) { echo '
'; } +/** + * Displays a message + */ +if (!empty($message)) { + PMA_showMessage($message); + unset($message); +} + ?>
diff --git a/server_processlist.php b/server_processlist.php index 3e444eea0..4eecdc767 100644 --- a/server_processlist.php +++ b/server_processlist.php @@ -49,7 +49,7 @@ while ($row = PMA_DBI_fetch_assoc($res)) { unset($res); unset($row); -PMA_showMessage($GLOBALS['strSQLQuery']); +PMA_showMessage($GLOBALS['strSuccess']); /** diff --git a/sql.php b/sql.php index b2fc46747..186032f7d 100644 --- a/sql.php +++ b/sql.php @@ -667,6 +667,7 @@ else { require('./tbl_properties_common.php'); $url_query .= '&goto=tbl_properties.php&back=tbl_properties.php'; require('./tbl_properties_table_info.php'); + require('./tbl_properties_links.php'); } else { require('./db_details_common.php'); diff --git a/tbl_alter.php b/tbl_alter.php index 69a2fba5e..15ddc930f 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -13,6 +13,18 @@ require_once('./header.inc.php'); // Check parameters PMA_checkParameters(array('db', 'table')); +/** + * Gets tables informations + */ +require('./tbl_properties_common.php'); +require('./tbl_properties_table_info.php'); +/** + * Displays top menu links + */ +$active_page = 'tbl_properties_structure.php'; +require('./tbl_properties_links.php'); + + /** * Defines the url to return to in case of error in a sql statement */ diff --git a/tbl_change.php b/tbl_change.php index 7a0c1bc10..fb0f4379a 100644 --- a/tbl_change.php +++ b/tbl_change.php @@ -66,13 +66,17 @@ require('./libraries/db_table_exists.lib.php'); /** - * Sets parameters for links and displays top menu + * Sets parameters for links */ $url_query = PMA_generate_common_url($db, $table) . '&goto=tbl_properties.php'; require('./tbl_properties_table_info.php'); -echo '
'; + +/** + * Displays top menu links + */ +require('./tbl_properties_links.php'); /** * Get the list of the fields of the current table diff --git a/tbl_properties.php b/tbl_properties.php index d1e84de9a..dd95fa5a0 100644 --- a/tbl_properties.php +++ b/tbl_properties.php @@ -11,10 +11,15 @@ $err_url = 'tbl_properties.php' . $err_url; $url_query .= '&goto=tbl_properties.php&back=tbl_properties.php'; /** - * Top menu + * Get table information */ require('./tbl_properties_table_info.php'); +/** + * Displays top menu links + */ +require('./tbl_properties_links.php'); + ?> ' . "\n"; /** * Count amount of navigation tabs @@ -97,4 +99,26 @@ if (!$cfg['LightTabs']) { echo '
'; } +/** + * Displays table comment + */ +if (!empty($show_comment) && !isset($avoid_show_comment)) { + ?> + +

+ +

+
diff --git a/tbl_properties_operations.php b/tbl_properties_operations.php index d33773441..18edd1c15 100644 --- a/tbl_properties_operations.php +++ b/tbl_properties_operations.php @@ -57,13 +57,6 @@ if (isset($submitoptions)) { $message = $strSuccess; } -// Displays a message if a query had been submitted -if (isset($message)) { - PMA_showMessage($message); -} - - - /** * Reordering the table has been requested by the user */ @@ -74,15 +67,18 @@ if (isset($submitorderby) && !empty($order_field)) { $sql_query .= ' DESC'; } $result = PMA_DBI_query($sql_query); - PMA_showMessage($result ? $strSuccess : $strFailed); + $message = $result ? $strSuccess : $strFailed; } // end if - /** - * Gets tables informations and displays top links + * Gets tables informations */ require('./tbl_properties_table_info.php'); +/** + * Displays top menu links + */ +require('./tbl_properties_links.php'); /** * Get columns names diff --git a/tbl_properties_structure.php b/tbl_properties_structure.php index 687b9f4a9..b8d4838d9 100644 --- a/tbl_properties_structure.php +++ b/tbl_properties_structure.php @@ -34,7 +34,10 @@ $url_query .= '&goto=tbl_properties_structure.php&back=tbl_properties_st /** * Prepares the table structure display */ -// 1. Get table information/display tabs; + +/** + * Gets tables informations + */ require('./tbl_properties_table_info.php'); /** @@ -42,9 +45,14 @@ require('./tbl_properties_table_info.php'); */ if ((!empty($submit_mult) && isset($selected_fld)) || isset($mult_btn)) { - PMA_showMessage($strSuccess); + $message = $strSuccess; } +/** + * Displays top menu links + */ +require('./tbl_properties_links.php'); + // 2. Gets table keys and retains them $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';'); $primary = ''; diff --git a/tbl_properties_table_info.php b/tbl_properties_table_info.php index dad070f33..3484b4b5c 100644 --- a/tbl_properties_table_info.php +++ b/tbl_properties_table_info.php @@ -36,26 +36,4 @@ for ($i = 0; $i < $tmp_cnt; $i++) { } // end for unset($tmp1, $tmp); PMA_DBI_free_result($table_info_result); - - -/** - * Displays top menu links - */ -echo '' . "\n"; -require('./tbl_properties_links.php'); - - -/** - * Displays table comment - */ -if (!empty($show_comment) && !isset($avoid_show_comment)) { - ?> - -

- -

- diff --git a/tbl_relation.php b/tbl_relation.php index 90cec8b86..66ec6b52e 100644 --- a/tbl_relation.php +++ b/tbl_relation.php @@ -7,14 +7,25 @@ */ require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/common.lib.php'); -require('./tbl_properties_common.php'); +require_once('./tbl_properties_common.php'); $url_query .= '&goto=tbl_properties.php'; -// Note: in tbl_properties_table_info we get and display the table comment. + +/** + * Gets tables informations + */ +require('./tbl_properties_table_info.php'); + +// Note: in tbl_properties_links.php we get and display the table comment. // For InnoDB, this comment contains the REFER information but any update // has not been done yet (will be done in tbl_relation.php later). $avoid_show_comment = TRUE; -require('./tbl_properties_table_info.php'); + +/** + * Displays top menu links + */ +require('./tbl_properties_links.php'); + require_once('./libraries/relation.lib.php'); $options_array = array('CASCADE' => 'CASCADE', 'SET_NULL' => 'SET NULL', 'NO_ACTION' => 'NO ACTION', 'RESTRICT' => 'RESTRICT'); diff --git a/tbl_select.php b/tbl_select.php index b920e8544..454517784 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -38,8 +38,17 @@ if (!isset($param) || $param[0] == '') { require('./tbl_properties_common.php'); //$err_url = 'tbl_select.php' . $err_url; $url_query .= '&goto=tbl_select.php&back=tbl_select.php'; + + /** + * Gets tables informations + */ require('./tbl_properties_table_info.php'); + /** + * Displays top menu links + */ + require('./tbl_properties_links.php'); + if (!isset($goto)) { $goto = $cfg['DefaultTabTable']; }