fix problem not remembering selected server
This commit is contained in:
@@ -5,6 +5,10 @@ phpMyAdmin - Changelog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2005-10-18 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
|
* footer.inc.php, index.php, server_databases.php, libraries/querywindow.js:
|
||||||
|
fix problem not remembering selected server
|
||||||
|
|
||||||
2005-10-18 Michal Čihař <michal@cihar.com>
|
2005-10-18 Michal Čihař <michal@cihar.com>
|
||||||
* libraries/relation.lib.php: Do not set database if not needed.
|
* libraries/relation.lib.php: Do not set database if not needed.
|
||||||
* libraries/common.lib.php: Use common infrastructure for getting tables.
|
* libraries/common.lib.php: Use common infrastructure for getting tables.
|
||||||
|
@@ -14,8 +14,7 @@ require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// If query window is wanted and open, update with latest selected db/table.
|
// If query window is wanted and open, update with latest selected db/table.
|
||||||
if ( $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ) {
|
if ( $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ) {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
@@ -24,7 +23,7 @@ if ( $cfg['QueryFrame'] && $cfg['QueryFrameJS'] ) {
|
|||||||
$table = isset( $table ) ? $table : '';
|
$table = isset( $table ) ? $table : '';
|
||||||
?>
|
?>
|
||||||
// sets selection in left frame quick db selectbox to current db
|
// sets selection in left frame quick db selectbox to current db
|
||||||
window.parent.setTable( '<?php echo $db; ?>', '<?php echo $table; ?>' );
|
window.parent.setAll( '<?php echo $lang; ?>', '<?php echo $collation_connection; ?>', '<?php echo $server; ?>', '<?php echo $db; ?>', '<?php echo $table; ?>' );
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@@ -141,6 +141,9 @@ header('Content-Type: text/html; charset=' . $GLOBALS['charset']);
|
|||||||
var safari_browser = <?php echo PMA_USR_BROWSER_AGENT != 'SAFARI' ? 'true' : 'false' ?>;
|
var safari_browser = <?php echo PMA_USR_BROWSER_AGENT != 'SAFARI' ? 'true' : 'false' ?>;
|
||||||
var querywindow_height = <?php echo $GLOBALS['cfg']['QueryWindowHeight']; ?>;
|
var querywindow_height = <?php echo $GLOBALS['cfg']['QueryWindowHeight']; ?>;
|
||||||
var querywindow_width = <?php echo $GLOBALS['cfg']['QueryWindowWidth']; ?>;
|
var querywindow_width = <?php echo $GLOBALS['cfg']['QueryWindowWidth']; ?>;
|
||||||
|
var collation_connection = '<?php echo $GLOBALS['collation_connection']; ?>';
|
||||||
|
var lang = '<?php echo $GLOBALS['lang']; ?>';
|
||||||
|
var server = '<?php echo $GLOBALS['server']; ?>';
|
||||||
var table = '<?php echo $GLOBALS['table']; ?>';
|
var table = '<?php echo $GLOBALS['table']; ?>';
|
||||||
var db = '<?php echo $GLOBALS['db']; ?>';
|
var db = '<?php echo $GLOBALS['db']; ?>';
|
||||||
var pma_absolute_uri = '<?php echo $GLOBALS['cfg']['PmaAbsoluteUri']; ?>';
|
var pma_absolute_uri = '<?php echo $GLOBALS['cfg']['PmaAbsoluteUri']; ?>';
|
||||||
|
@@ -1,21 +1,80 @@
|
|||||||
var querywindow = '';
|
var querywindow = '';
|
||||||
|
|
||||||
// sets current selected table (called from footer.inc.php)
|
/**
|
||||||
function setTable( new_db, new_table ) {
|
* sets current selected server, table and db (called from footer.inc.php)
|
||||||
//alert('setTable');
|
*/
|
||||||
if ( new_db != db || new_table != table ) {
|
function setDb( new_db ) {
|
||||||
// table or db has changed
|
//alert('setDb(' + new_db + ')');
|
||||||
|
if ( new_db != db ) {
|
||||||
|
// db has changed
|
||||||
|
//alert( new_db + '(' + new_db.length + ') : ' + db );
|
||||||
|
|
||||||
//alert( new_table + '(' + new_table.length + ') : ' + table );
|
|
||||||
if ( window.frames[0].document.getElementById( new_db ) == null
|
|
||||||
&& window.frames[0].document.getElementById( new_db + '.' + new_table ) == null ) {
|
|
||||||
// table or db is unknown, reload complete left frame
|
|
||||||
goTo('left.php?&db=' + new_db + '&table=' + new_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
// save new db and table
|
|
||||||
db = new_db;
|
db = new_db;
|
||||||
table = new_table;
|
|
||||||
|
if ( window.frames[0].document.getElementById( db ) == null ) {
|
||||||
|
// db is unknown, reload complete left frame
|
||||||
|
refreshLeft();
|
||||||
|
|
||||||
|
}
|
||||||
|
// TODO: add code to expand db in lightview mode
|
||||||
|
|
||||||
|
// refresh querywindow
|
||||||
|
refreshQuerywindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshMain( url ) {
|
||||||
|
if ( ! url ) {
|
||||||
|
if ( db ) {
|
||||||
|
url = opendb_url;
|
||||||
|
} else {
|
||||||
|
url = 'main.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goTo( url + '?&server=' + server +
|
||||||
|
'&db=' + db +
|
||||||
|
'&table=' + table +
|
||||||
|
'&lang=' + lang +
|
||||||
|
'&collation_connection=' + collation_connection,
|
||||||
|
'main' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshLeft() {
|
||||||
|
goTo('left.php?&server=' + server +
|
||||||
|
'&db=' + db +
|
||||||
|
'&table=' + table +
|
||||||
|
'&lang=' + lang +
|
||||||
|
'&collation_connection=' + collation_connection
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets current selected server, table and db (called from footer.inc.php)
|
||||||
|
*/
|
||||||
|
function setAll( new_lang, new_collation_connection, new_server, new_db, new_table ) {
|
||||||
|
//alert('setAll( ' + new_lang + ', ' + new_collation_connection + ', ' + new_server + ', ' + new_db + ', ' + new_table + ' )');
|
||||||
|
if ( new_server != server || new_lang != lang
|
||||||
|
|| new_collation_connection != collation_connection ) {
|
||||||
|
// something important has changed
|
||||||
|
server = new_server;
|
||||||
|
db = new_db;
|
||||||
|
table = new_table;
|
||||||
|
collation_connection = new_collation_connection;
|
||||||
|
lang = new_lang;
|
||||||
|
refreshLeft();
|
||||||
|
}
|
||||||
|
else if ( new_db != db || new_table != table ) {
|
||||||
|
// save new db and table
|
||||||
|
db = new_db;
|
||||||
|
table = new_table;
|
||||||
|
|
||||||
|
if ( window.frames[0].document.getElementById( db ) == null
|
||||||
|
&& window.frames[0].document.getElementById( db + '.' + table ) == null ) {
|
||||||
|
// table or db is unknown, reload complete left frame
|
||||||
|
refreshLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: add code to expand db in lightview mode
|
||||||
|
|
||||||
// refresh querywindow
|
// refresh querywindow
|
||||||
refreshQuerywindow();
|
refreshQuerywindow();
|
||||||
@@ -90,6 +149,13 @@ function refreshQuerywindow( url ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* opens new url in target frame, with default beeing left frame
|
||||||
|
* valid is 'main' and 'querywindow' all others leads to 'left'
|
||||||
|
*
|
||||||
|
* @param string targeturl new url to load
|
||||||
|
* @param string target frame where to load the new url
|
||||||
|
*/
|
||||||
function goTo( targeturl, target ) {
|
function goTo( targeturl, target ) {
|
||||||
//alert('goto');
|
//alert('goto');
|
||||||
if ( target == 'main' ) {
|
if ( target == 'main' ) {
|
||||||
@@ -119,10 +185,10 @@ function goTo( targeturl, target ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// opens selected db in main frame
|
// opens selected db in main frame
|
||||||
function openDb( db ) {
|
function openDb( new_db ) {
|
||||||
//alert('opendb');
|
//alert('opendb(' + new_db + ')');
|
||||||
goTo( opendb_url + '?' + common_query + '&db=' + db,
|
setDb( new_db );
|
||||||
window.parent.frames[1] );
|
refreshMain( opendb_url );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -252,7 +252,7 @@ if (count($statistics) > 0) {
|
|||||||
}
|
}
|
||||||
if ($is_superuser) {
|
if ($is_superuser) {
|
||||||
echo ' <td class="tool">' . "\n"
|
echo ' <td class="tool">' . "\n"
|
||||||
. ' <a onclick="window.parent.setTable(\'' . urlencode($current['db_name']) . '\');" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['db_name']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['db_name'])) . '">'. "\n"
|
. ' <a onclick="window.parent.setDb(\'' . urlencode($current['db_name']) . '\');" href="./server_privileges.php?' . $url_query . '&checkprivs=' . urlencode($current['db_name']) . '" title="' . sprintf($strCheckPrivsLong, htmlspecialchars($current['db_name'])) . '">'. "\n"
|
||||||
. ' ' .($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" alt=" ' .$strCheckPrivs . '" /> ' : $strCheckPrivs ). "\n"
|
. ' ' .($cfg['PropertiesIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_rights.png" width="16" height="16" alt=" ' .$strCheckPrivs . '" /> ' : $strCheckPrivs ). "\n"
|
||||||
. ' </a>' . "\n"
|
. ' </a>' . "\n"
|
||||||
. ' </td>' . "\n";
|
. ' </td>' . "\n";
|
||||||
|
Reference in New Issue
Block a user