optional server list as links in left panel

This commit is contained in:
Marc Delisle
2004-04-26 14:01:25 +00:00
parent 93b8065584
commit 02580c9b3b
6 changed files with 60 additions and 12 deletions

View File

@@ -5,6 +5,12 @@ phpMyAdmin - Changelog
$Id$ $Id$
$Source$ $Source$
2004-04-26 Marc Delisle <lem9@users.sourceforge.net>
* config.inc.php, left.php, Documentation.html,
libraries/config_import.lib.php, libraries/common.lib.php:
$cfg['LeftDisplayServersList'] to display the server choice as links,
thanks to Cal Henderson
2004-04-26 Michal Cihar <michal@cihar.com> 2004-04-26 Michal Cihar <michal@cihar.com>
* libraries/string.lib.php: mb_* functions don't know some windows-* * libraries/string.lib.php: mb_* functions don't know some windows-*
charsets (bug #940638). charsets (bug #940638).

View File

@@ -1183,6 +1183,11 @@ Defaults to TRUE. <br />
<dt><b>$cfg['LeftDisplayServers'] </b>boolean</dt> <dt><b>$cfg['LeftDisplayServers'] </b>boolean</dt>
<dd>Defines whether to display a server choice at the top of the left frame or not. <dd>Defines whether to display a server choice at the top of the left frame or not.
Defaults to FALSE. <br /> Defaults to FALSE. <br />
<br />
</dd>
<dt><b>$cfg['LeftDisplayServersList'] </b>boolean</dt>
<dd>Defines whether to display this server choice as links instead of in a drop-down.
Defaults to FALSE (drop-down). <br />
<br /> <br />
</dd> </dd>
<dt><b>$cfg['ShowStats'] </b>boolean</dt> <dt><b>$cfg['ShowStats'] </b>boolean</dt>

View File

@@ -225,6 +225,7 @@ $cfg['ShowTooltipAliasTB'] = FALSE; // are shown (in the left menu and db_de
$cfg['LeftDisplayLogo'] = TRUE; // display logo at top of left frame $cfg['LeftDisplayLogo'] = TRUE; // display logo at top of left frame
$cfg['LeftDisplayServers'] = FALSE; // display server choice at top of left frame $cfg['LeftDisplayServers'] = FALSE; // display server choice at top of left frame
$cfg['LeftDisplayServersList'] = FALSE; // server choice as links
// In the main frame, at startup... // In the main frame, at startup...
$cfg['ShowStats'] = TRUE; // allow to display statistics and space usage in $cfg['ShowStats'] = TRUE; // allow to display statistics and space usage in

View File

@@ -310,50 +310,82 @@ if ($cfg['LeftDisplayLogo']) {
} }
echo "\n"; echo "\n";
if ($cfg['LeftDisplayServers']) { if ($cfg['LeftDisplayServers']) {
if ($cfg['LeftDisplayServersList']){
?> ?>
<br />
<?php
}else{
?>
<form method="post" action="index.php" target="_parent"> <form method="post" action="index.php" target="_parent">
<select name="server" onchange="this.form.submit();"> <select name="server" onchange="this.form.submit();">
<?php <?php
echo "\n"; }
foreach($cfg['Servers'] AS $key => $val) { foreach($cfg['Servers'] AS $key => $val) {
if (!empty($val['host'])) { if (!empty($val['host'])) {
echo ' <option value="' . $key . '"';
$selected = 0;
if (!empty($server) && ($server == $key)) { if (!empty($server) && ($server == $key)) {
echo ' selected="selected"'; $selected = 1;
} }
echo '>';
if (!empty($val['verbose'])) { if (!empty($val['verbose'])) {
echo $val['verbose']; $label = $val['verbose'];
} else { } else {
echo $val['host']; $label = $val['host'];
if (!empty($val['port'])) { if (!empty($val['port'])) {
echo ':' . $val['port']; $label .= ':' . $val['port'];
} }
// loic1: skip this because it's not a so good idea to display // loic1: skip this because it's not a so good idea to display
// sockets used to everybody // sockets used to everybody
// if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) { // if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
// echo ':' . $val['socket']; // $label .= ':' . $val['socket'];
// } // }
} }
// loic1: if 'only_db' is an array and there is more than one // loic1: if 'only_db' is an array and there is more than one
// value, displaying such informations may not be a so good // value, displaying such informations may not be a so good
// idea // idea
if (!empty($val['only_db'])) { if (!empty($val['only_db'])) {
echo ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']); $label .= ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']);
} }
if (!empty($val['user']) && ($val['auth_type'] == 'config')) { if (!empty($val['user']) && ($val['auth_type'] == 'config')) {
echo ' (' . $val['user'] . ')'; $label .= ' (' . $val['user'] . ')';
} }
echo '&nbsp;</option>' . "\n";
if ($cfg['LeftDisplayServersList']){
if ($selected){
echo "&raquo; <b>$label</b><br />";
}else{
echo "&raquo; <a href=\"index.php?server=$key&lang=$lang&convcharset=$convcharset\" target=\"_top\">$label</a><br />";
}
} else {
echo " <option value=\"$key\"".($selected?' selected':'').">$label</option>\n";
}
} // end if (!empty($val['host'])) } // end if (!empty($val['host']))
} // end while } // end while
if ($cfg['LeftDisplayServersList']){
?> ?>
<br />
<?php
}else{
?>
</select> </select>
<input type="hidden" name="lang" value="<?php echo $lang; ?>" /> <input type="hidden" name="lang" value="<?php echo $lang; ?>" />
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<noscript><input type="submit" value="<?php echo $strGo; ?>" /></noscript> <noscript><input type="submit" value="<?php echo $strGo; ?>" /></noscript>
</form> </form>
<?php <?php
}
} }
echo "\n"; echo "\n";
?> ?>

View File

@@ -136,7 +136,7 @@ if (isset($cfg['FileRevision'])) {
} else { } else {
$cfg['FileRevision'] = array(1, 1); $cfg['FileRevision'] = array(1, 1);
} }
if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 13)) { if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 15)) {
require_once('./libraries/config_import.lib.php'); require_once('./libraries/config_import.lib.php');
} }

View File

@@ -340,6 +340,10 @@ if (!isset($cfg['LeftDisplayServers'])) {
$cfg['LeftDisplayServers'] = FALSE; $cfg['LeftDisplayServers'] = FALSE;
} }
if (!isset($cfg['LeftDisplayServersList'])) {
$cfg['LeftDisplayServersList'] = FALSE;
}
if (!isset($cfg['ShowStats'])) { if (!isset($cfg['ShowStats'])) {
if (isset($cfgShowStats)) { if (isset($cfgShowStats)) {
$cfg['ShowStats'] = $cfgShowStats; $cfg['ShowStats'] = $cfgShowStats;