Cleanup of message displaying and navigation reloading.

This commit is contained in:
Michal Čihař
2004-10-21 10:18:12 +00:00
parent 1293dc1a24
commit 3f258cfb45
22 changed files with 161 additions and 128 deletions

View File

@@ -5,6 +5,13 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2004-10-21 Michal Čihař <michal@cihar.com>
* [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 <lem9@users.sourceforge.net> 2004-10-20 Marc Delisle <lem9@users.sourceforge.net>
* libraries/common.lib.php: there was already a tip icon in our collection, * libraries/common.lib.php: there was already a tip icon in our collection,
thanks to Michael Keck thanks to Michael Keck

View File

@@ -44,48 +44,8 @@ if (isset($submitcollation) && !empty($db_collation) && PMA_MYSQL_INT_VERSION >=
unset($db_charset, $db_collation); unset($db_charset, $db_collation);
} }
// Displays headers $js_to_run = 'functions.js';
if (!isset($message)) { require_once('./header.inc.php');
$js_to_run = 'functions.js';
require_once('./header.inc.php');
// Reloads the navigation frame via JavaScript if required
if (isset($reload) && $reload) {
echo "\n";
?>
<script type="text/javascript" language="javascript1.2">
<!--
var hashformDone = false;
function hashformReload() {
<?php
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
?>
if (hashformDone != true) {
if (typeof(window.parent.frames['queryframe'].document.hashform.hash) != 'undefined' && typeof(window.parent.frames['nav']) != 'undefined') {
window.parent.frames['nav'].location.replace('./left.php?<?php echo PMA_generate_common_url('', '', '&');?>&hash=' +
window.parent.frames['queryframe'].document.hashform.hash.value);
hashformDone = true;
} else {
setTimeout("hashformReload();",500);
}
}
<?php
} else {
?>
window.parent.frames['nav'].location.replace('./left.php?<?php echo PMA_generate_common_url('', '', '&');?>&hash=' +
'<?php echo md5($cfg['PmaAbsoluteUri']); ?>');
<?php
}
?>
}
setTimeout("hashformReload();",500);
//-->
</script>
<?php
}
echo "\n";
} else {
PMA_showMessage($message);
}
/** /**
* Set parameters for links * Set parameters for links

View File

@@ -93,5 +93,13 @@ if (!$cfg['LightTabs']) {
} else { } else {
echo '<br />'; echo '<br />';
} }
/**
* Displays a message
*/
if (!empty($message)) {
PMA_showMessage($message);
unset($message);
}
?> ?>
<br /> <br />

View File

@@ -127,6 +127,9 @@ if (empty($GLOBALS['is_header_sent'])) {
<?php <?php
} }
echo "\n"; echo "\n";
// Reloads the navigation frame via JavaScript if required
PMA_reloadNavigation();
?> ?>
<meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" /> <meta name="OBGZip" content="<?php echo ($cfg['OBGzip'] ? 'true' : 'false'); ?>" />
</head> </head>

View File

@@ -21,6 +21,7 @@ require('./tbl_properties_common.php');
$err_url = 'ldi_table.php' . $err_url; $err_url = 'ldi_table.php' . $err_url;
$url_query .= '&amp;goto=ldi_table.php&amp;back=ldi_table.php'; $url_query .= '&amp;goto=ldi_table.php&amp;back=ldi_table.php';
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
require('./tbl_properties_links.php');
/** /**
* Displays the form * Displays the form

View File

@@ -1484,21 +1484,14 @@ if ($is_minimum_common == FALSE) {
} }
} // end of the 'PMA_countRecords()' function } // 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 bool whehter to reload
*
* @global array the configuration array
* *
* @access public * @access public
*/ */
function PMA_showMessage($message) function PMA_reloadNavigation() {
{
global $cfg;
require_once('./header.inc.php');
// Reloads the navigation frame via JavaScript if required // Reloads the navigation frame via JavaScript if required
if (isset($GLOBALS['reload']) && $GLOBALS['reload']) { if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {
@@ -1516,9 +1509,23 @@ if (typeof(window.parent) != 'undefined'
<?php <?php
unset($GLOBALS['reload']); unset($GLOBALS['reload']);
} }
}
/**
* Displays a message at the top of the "main" (right) frame
*
* @param string the message to display
*
* @global array the configuration array
*
* @access public
*/
function PMA_showMessage($message)
{
global $cfg;
// Corrects the tooltip text via JS if required // Corrects the tooltip text via JS if required
else if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) { if (!empty($GLOBALS['table']) && $cfg['ShowTooltip']) {
$result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\''); $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], TRUE) . '\'');
if ($result) { if ($result) {
$tbl_status = PMA_DBI_fetch_assoc($result); $tbl_status = PMA_DBI_fetch_assoc($result);
@@ -1564,6 +1571,7 @@ if (typeof(document.getElementById) != 'undefined'
echo "\n"; echo "\n";
?> ?>
<br />
<div align="<?php echo $GLOBALS['cell_align_left']; ?>"> <div align="<?php echo $GLOBALS['cell_align_left']; ?>">
<table border="<?php echo $cfg['Border']; ?>" cellpadding="5" cellspacing="1"> <table border="<?php echo $cfg['Border']; ?>" cellpadding="5" cellspacing="1">
<tr> <tr>
@@ -1622,7 +1630,12 @@ if (typeof(document.getElementById) != 'undefined'
} else if (!empty($GLOBALS['validatequery'])) { } else if (!empty($GLOBALS['validatequery'])) {
$query_base = PMA_validateSQL($query_base); $query_base = PMA_validateSQL($query_base);
} else { } 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); $query_base = PMA_formatSql($parsed_sql, $query_base);
} }

View File

@@ -52,20 +52,6 @@ if (isset($table)) {
} }
$show_query = '1'; $show_query = '1';
require_once('./header.inc.php'); 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";
?>
<script type="text/javascript" language="javascript1.2">
<!--
window.parent.frames['nav'].location.replace('./left.php?<?php echo PMA_generate_common_url('', '', '&');?>&hash=' + <?php echo (($cfg['QueryFrame'] && $cfg['QueryFrameJS']) ? 'window.parent.frames[\'queryframe\'].document.hashform.hash.value' : "'" . md5($cfg['PmaAbsoluteUri']) . "'"); ?>);
//-->
</script>
<?php
}
echo "\n"; echo "\n";
@@ -85,6 +71,7 @@ echo "\n";
?> ?>
</h1> </h1>
<?php <?php
// Don't display server info if $server == 0 (no server selected) // Don't display server info if $server == 0 (no server selected)
// loic1: modified in order to have a valid words order whatever is the // loic1: modified in order to have a valid words order whatever is the
// language used // language used
@@ -117,6 +104,13 @@ if ($server > 0) {
} // end if } // end if
// Any message to display?
if (isset($message)) {
PMA_showMessage($message);
unset($message);
}
/** /**
* Reload mysql (flush privileges) * Reload mysql (flush privileges)
*/ */

View File

@@ -57,7 +57,7 @@ while ($row = PMA_DBI_fetch_assoc($res)) {
unset($res); unset($res);
unset($row); unset($row);
PMA_showMessage($GLOBALS['strSQLQuery']); PMA_showMessage($GLOBALS['strSuccess']);
/** /**

View File

@@ -30,14 +30,6 @@ if ($is_superuser) {
} }
/**
* Displays a message
*/
if (!empty($message)) {
PMA_showMessage($message);
}
/** /**
* Displays tab links * Displays tab links
*/ */
@@ -79,5 +71,13 @@ if (!$cfg['LightTabs']) {
echo '<br />'; echo '<br />';
} }
/**
* Displays a message
*/
if (!empty($message)) {
PMA_showMessage($message);
unset($message);
}
?> ?>
<br /> <br />

View File

@@ -49,7 +49,7 @@ while ($row = PMA_DBI_fetch_assoc($res)) {
unset($res); unset($res);
unset($row); unset($row);
PMA_showMessage($GLOBALS['strSQLQuery']); PMA_showMessage($GLOBALS['strSuccess']);
/** /**

View File

@@ -667,6 +667,7 @@ else {
require('./tbl_properties_common.php'); require('./tbl_properties_common.php');
$url_query .= '&amp;goto=tbl_properties.php&amp;back=tbl_properties.php'; $url_query .= '&amp;goto=tbl_properties.php&amp;back=tbl_properties.php';
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
require('./tbl_properties_links.php');
} }
else { else {
require('./db_details_common.php'); require('./db_details_common.php');

View File

@@ -13,6 +13,18 @@ require_once('./header.inc.php');
// Check parameters // Check parameters
PMA_checkParameters(array('db', 'table')); 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 * Defines the url to return to in case of error in a sql statement
*/ */

View File

@@ -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) $url_query = PMA_generate_common_url($db, $table)
. '&amp;goto=tbl_properties.php'; . '&amp;goto=tbl_properties.php';
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
echo '<br />';
/**
* Displays top menu links
*/
require('./tbl_properties_links.php');
/** /**
* Get the list of the fields of the current table * Get the list of the fields of the current table

View File

@@ -11,10 +11,15 @@ $err_url = 'tbl_properties.php' . $err_url;
$url_query .= '&amp;goto=tbl_properties.php&amp;back=tbl_properties.php'; $url_query .= '&amp;goto=tbl_properties.php&amp;back=tbl_properties.php';
/** /**
* Top menu * Get table information
*/ */
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
/**
* Displays top menu links
*/
require('./tbl_properties_links.php');
?> ?>
<!-- TABLE WORK --> <!-- TABLE WORK -->
<?php <?php

View File

@@ -29,13 +29,8 @@ require_once('./libraries/db_table_exists.lib.php');
/** /**
* Displays headers * Displays headers
*/ */
if (!isset($message)) { $js_to_run = 'functions.js';
$js_to_run = 'functions.js'; require_once('./header.inc.php');
require_once('./header.inc.php');
} else {
PMA_showMessage($message);
unset($message);
}
/** /**

View File

@@ -96,10 +96,14 @@ if (isset($sql_query)) {
} }
} }
} }
// TODO: can we avoid reparsing the query here? $message = $GLOBALS['strSuccess'];
PMA_showMessage($GLOBALS['strSQLQuery']);
} }
/**
* Displays top menu links
*/
require('./tbl_properties_links.php');
$export_type = 'table'; $export_type = 'table';
require_once('./libraries/display_export.lib.php'); require_once('./libraries/display_export.lib.php');

View File

@@ -14,7 +14,9 @@
require_once('./libraries/common.lib.php'); require_once('./libraries/common.lib.php');
PMA_checkParameters(array('db')); PMA_checkParameters(array('db', 'table'));
echo '<!-- top menu -->' . "\n";
/** /**
* Count amount of navigation tabs * Count amount of navigation tabs
@@ -97,4 +99,26 @@ if (!$cfg['LightTabs']) {
echo '<br />'; echo '<br />';
} }
/**
* Displays table comment
*/
if (!empty($show_comment) && !isset($avoid_show_comment)) {
?>
<!-- Table comment -->
<p><i>
<?php echo htmlspecialchars($show_comment) . "\n"; ?>
</i></p>
<?php
} // end if
echo "\n\n";
/**
* Displays a message
*/
if (!empty($message)) {
PMA_showMessage($message);
unset($message);
}
?><br /> ?><br />

View File

@@ -57,13 +57,6 @@ if (isset($submitoptions)) {
$message = $strSuccess; $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 * Reordering the table has been requested by the user
*/ */
@@ -74,15 +67,18 @@ if (isset($submitorderby) && !empty($order_field)) {
$sql_query .= ' DESC'; $sql_query .= ' DESC';
} }
$result = PMA_DBI_query($sql_query); $result = PMA_DBI_query($sql_query);
PMA_showMessage($result ? $strSuccess : $strFailed); $message = $result ? $strSuccess : $strFailed;
} // end if } // end if
/** /**
* Gets tables informations and displays top links * Gets tables informations
*/ */
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
/**
* Displays top menu links
*/
require('./tbl_properties_links.php');
/** /**
* Get columns names * Get columns names

View File

@@ -34,7 +34,10 @@ $url_query .= '&amp;goto=tbl_properties_structure.php&amp;back=tbl_properties_st
/** /**
* Prepares the table structure display * Prepares the table structure display
*/ */
// 1. Get table information/display tabs;
/**
* Gets tables informations
*/
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
/** /**
@@ -42,9 +45,14 @@ require('./tbl_properties_table_info.php');
*/ */
if ((!empty($submit_mult) && isset($selected_fld)) if ((!empty($submit_mult) && isset($selected_fld))
|| isset($mult_btn)) { || isset($mult_btn)) {
PMA_showMessage($strSuccess); $message = $strSuccess;
} }
/**
* Displays top menu links
*/
require('./tbl_properties_links.php');
// 2. Gets table keys and retains them // 2. Gets table keys and retains them
$result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';'); $result = PMA_DBI_query('SHOW KEYS FROM ' . PMA_backquote($table) . ';');
$primary = ''; $primary = '';

View File

@@ -36,26 +36,4 @@ for ($i = 0; $i < $tmp_cnt; $i++) {
} // end for } // end for
unset($tmp1, $tmp); unset($tmp1, $tmp);
PMA_DBI_free_result($table_info_result); PMA_DBI_free_result($table_info_result);
/**
* Displays top menu links
*/
echo '<!-- top menu -->' . "\n";
require('./tbl_properties_links.php');
/**
* Displays table comment
*/
if (!empty($show_comment) && !isset($avoid_show_comment)) {
?>
<!-- Table comment -->
<p><i>
<?php echo htmlspecialchars($show_comment) . "\n"; ?>
</i></p>
<?php
} // end if
echo "\n\n";
?> ?>

View File

@@ -7,14 +7,25 @@
*/ */
require_once('./libraries/grab_globals.lib.php'); require_once('./libraries/grab_globals.lib.php');
require_once('./libraries/common.lib.php'); require_once('./libraries/common.lib.php');
require('./tbl_properties_common.php'); require_once('./tbl_properties_common.php');
$url_query .= '&amp;goto=tbl_properties.php'; $url_query .= '&amp;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 // For InnoDB, this comment contains the REFER information but any update
// has not been done yet (will be done in tbl_relation.php later). // has not been done yet (will be done in tbl_relation.php later).
$avoid_show_comment = TRUE; $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'); require_once('./libraries/relation.lib.php');
$options_array = array('CASCADE' => 'CASCADE', 'SET_NULL' => 'SET NULL', 'NO_ACTION' => 'NO ACTION', 'RESTRICT' => 'RESTRICT'); $options_array = array('CASCADE' => 'CASCADE', 'SET_NULL' => 'SET NULL', 'NO_ACTION' => 'NO ACTION', 'RESTRICT' => 'RESTRICT');

View File

@@ -38,8 +38,17 @@ if (!isset($param) || $param[0] == '') {
require('./tbl_properties_common.php'); require('./tbl_properties_common.php');
//$err_url = 'tbl_select.php' . $err_url; //$err_url = 'tbl_select.php' . $err_url;
$url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php'; $url_query .= '&amp;goto=tbl_select.php&amp;back=tbl_select.php';
/**
* Gets tables informations
*/
require('./tbl_properties_table_info.php'); require('./tbl_properties_table_info.php');
/**
* Displays top menu links
*/
require('./tbl_properties_links.php');
if (!isset($goto)) { if (!isset($goto)) {
$goto = $cfg['DefaultTabTable']; $goto = $cfg['DefaultTabTable'];
} }