- fixed pre-select for current server (fixed type missmatch)

- do not auto submit on '(Server) ...'
This commit is contained in:
Sebastian Mendel
2006-02-17 09:48:10 +00:00
parent 884834db27
commit c80232dd7d
2 changed files with 19 additions and 16 deletions

View File

@@ -12,6 +12,8 @@ $Source$
- linked all references - linked all references
* libraries/common.lib.php: * libraries/common.lib.php:
- fixed bug #1432626 'bad url error after select "(Databases)..."' - fixed bug #1432626 'bad url error after select "(Databases)..."'
* libraries/select_server.lib.php:
fixed pre-select for current server (fixed type missmatch)
2006-02-16 Marc Delisle <lem9@users.sourceforge.net> 2006-02-16 Marc Delisle <lem9@users.sourceforge.net>
* lang/italian: update, thanks to Luca Rebellato * lang/italian: update, thanks to Luca Rebellato

View File

@@ -6,7 +6,7 @@
/** /**
* display server selection in list or selectbox form, or option tags only * display server selection in list or selectbox form, or option tags only
* *
* @todo make serverlist a real html-list * @todo make serverlist a real html-list
* @globals $lang * @globals $lang
* @globals $convcharset * @globals $convcharset
@@ -22,7 +22,7 @@
function PMA_select_server($not_only_options, $ommit_fieldset) function PMA_select_server($not_only_options, $ommit_fieldset)
{ {
global $lang, $convcharset; global $lang, $convcharset;
// Show as list? // Show as list?
if ($not_only_options) { if ($not_only_options) {
$list = $GLOBALS['cfg']['DisplayServersList']; $list = $GLOBALS['cfg']['DisplayServersList'];
@@ -30,7 +30,7 @@ function PMA_select_server($not_only_options, $ommit_fieldset)
} else { } else {
$list = false; $list = false;
} }
if ($not_only_options) { if ($not_only_options) {
echo '<form method="post" action="index.php" target="_parent">'; echo '<form method="post" action="index.php" target="_parent">';
@@ -38,8 +38,9 @@ function PMA_select_server($not_only_options, $ommit_fieldset)
echo '<fieldset>'; echo '<fieldset>';
} }
echo '<label for="select_server">' . $GLOBALS['strServer'] . ':</label> '; echo '<label for="select_server">' . $GLOBALS['strServer'] . ':</label> ';
echo '<select name="server" id="select_server" onchange="this.form.submit();">'; echo '<select name="server" id="select_server"'
. ' onchange="if (this.value != \'\') this.form.submit();">';
// TODO FIXME replace with $GLOBALS['strServers'] // TODO FIXME replace with $GLOBALS['strServers']
echo '<option value="">(' . $GLOBALS['strServer'] . ') ...</option>' . "\n"; echo '<option value="">(' . $GLOBALS['strServer'] . ') ...</option>' . "\n";
} elseif ($list) { } elseif ($list) {
@@ -47,18 +48,18 @@ function PMA_select_server($not_only_options, $ommit_fieldset)
// TODO FIXME display server list as 'list' // TODO FIXME display server list as 'list'
// echo '<ol>'; // echo '<ol>';
} }
foreach ($GLOBALS['cfg']['Servers'] as $key => $server) { foreach ($GLOBALS['cfg']['Servers'] as $key => $server) {
if (empty($server['host'])) { if (empty($server['host'])) {
continue; continue;
} }
if (!empty($GLOBALS['server']) && $GLOBALS['server'] === $key) { if (!empty($GLOBALS['server']) && (int) $GLOBALS['server'] === (int) $key) {
$selected = 1; $selected = 1;
} else { } else {
$selected = 0; $selected = 0;
} }
if (!empty($server['verbose'])) { if (!empty($server['verbose'])) {
$label = $server['verbose']; $label = $server['verbose'];
} else { } else {
@@ -71,7 +72,7 @@ function PMA_select_server($not_only_options, $ommit_fieldset)
// value, displaying such informations may not be a so good // value, displaying such informations may not be a so good
// idea // idea
if (!empty($server['only_db'])) { if (!empty($server['only_db'])) {
// TODO FIXME this can become a really big selectbox ... // TODO FIXME this can become a really big/long/wide selectbox ...
$label .= ' - ' . (is_array($server['only_db']) ? implode(', ', $server['only_db']) : $server['only_db']); $label .= ' - ' . (is_array($server['only_db']) ? implode(', ', $server['only_db']) : $server['only_db']);
} }
if (!empty($server['user']) && $server['auth_type'] == 'config') { if (!empty($server['user']) && $server['auth_type'] == 'config') {
@@ -104,13 +105,13 @@ function PMA_select_server($not_only_options, $ommit_fieldset)
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" /> <input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
<?php <?php
// Show submit button if we have just one server (this happens with no default) // Show submit button if we have just one server (this happens with no default)
echo '<noscript>'; echo '<noscript>';
echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />'; echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
echo '</noscript>'; echo '</noscript>';
echo '</form>'; echo '</form>';
} elseif ($list) { } elseif ($list) {
// TODO FIXME display server list as 'list' // TODO FIXME display server list as 'list'
// echo '</ol>'; // echo '</ol>';
} }
} }
?> ?>