- fixed bug #1425688 'Server Select quirk'
- valid XHTML 1.0 - code readability
This commit is contained in:
@@ -10,6 +10,10 @@ $Source$
|
|||||||
- fixed bug #1416848 'Insert new row from Browse page'
|
- fixed bug #1416848 'Insert new row from Browse page'
|
||||||
* libraries/common.lib.php:
|
* libraries/common.lib.php:
|
||||||
- fixed bug #1409893 - links in navigation frame opens new window
|
- fixed bug #1409893 - links in navigation frame opens new window
|
||||||
|
* libraries/select_server.lib.php:
|
||||||
|
- fixed bug #1425688 'Server Select quirk'
|
||||||
|
- valid XHTML 1.0
|
||||||
|
- code readability
|
||||||
|
|
||||||
2006-02-12 Marc Delisle <lem9@users.sourceforge.net>
|
2006-02-12 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* lang/english and hebrew: bug #1429769, typo
|
* lang/english and hebrew: bug #1429769, typo
|
||||||
|
@@ -4,96 +4,113 @@
|
|||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function PMA_select_server($form, $left) {
|
/**
|
||||||
global $server, $cfg, $lang, $convcharset;
|
* display server selection in list or selectbox form, or option tags only
|
||||||
|
*
|
||||||
|
* @todo make serverlist a real html-list
|
||||||
|
* @globals $lang
|
||||||
|
* @globals $convcharset
|
||||||
|
* @uses $GLOBALS['cfg']['DisplayServersList']
|
||||||
|
* @uses $GLOBALS['strServer']
|
||||||
|
* @uses $GLOBALS['cfg']['Servers']
|
||||||
|
* @uses $GLOBALS['strGo']
|
||||||
|
* @uses implode()
|
||||||
|
* @uses htmlspecialchars()
|
||||||
|
* @param boolean $not_only_options whether to include form tags or not
|
||||||
|
* @param boolean $ommit_fieldset whether to ommit fieldset tag or not
|
||||||
|
*/
|
||||||
|
function PMA_select_server($not_only_options, $ommit_fieldset)
|
||||||
|
{
|
||||||
|
global $lang, $convcharset;
|
||||||
|
|
||||||
// Show as list?
|
// Show as list?
|
||||||
$list = $cfg['DisplayServersList'];
|
if ($not_only_options) {
|
||||||
if (!$form) {
|
$list = $GLOBALS['cfg']['DisplayServersList'];
|
||||||
$list = FALSE;
|
$not_only_options =! $list;
|
||||||
|
} else {
|
||||||
|
$list = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($form) {
|
if ($not_only_options) {
|
||||||
if ($left) {
|
echo '<form method="post" action="index.php" target="_parent">';
|
||||||
echo '<div class="heada">' . $GLOBALS['strServer']. ':</div>';
|
|
||||||
|
if (! $ommit_fieldset) {
|
||||||
|
echo '<fieldset>';
|
||||||
|
}
|
||||||
|
echo '<label for="select_server">' . $GLOBALS['strServer'] . ':</label> ';
|
||||||
|
|
||||||
|
echo '<select name="server" id="select_server" onchange="this.form.submit();">';
|
||||||
|
// TODO FIXME replace with $GLOBALS['strServers']
|
||||||
|
echo '<option value="">(' . $GLOBALS['strServer'] . ') ...</option>' . "\n";
|
||||||
|
} elseif ($list) {
|
||||||
|
echo $GLOBALS['strServer'] . ':<br />';
|
||||||
|
// TODO FIXME display server list as 'list'
|
||||||
|
// echo '<ol>';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($GLOBALS['cfg']['Servers'] as $key => $server) {
|
||||||
|
if (empty($server['host'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($GLOBALS['server']) && $GLOBALS['server'] === $key) {
|
||||||
|
$selected = 1;
|
||||||
} else {
|
} else {
|
||||||
?>
|
$selected = 0;
|
||||||
<fieldset>
|
|
||||||
<legend><?php echo $GLOBALS['strServerChoice']; ?></legend>
|
|
||||||
<?php
|
|
||||||
}
|
}
|
||||||
if (!$list) {
|
|
||||||
?>
|
if (!empty($server['verbose'])) {
|
||||||
<form method="post" action="index.php" target="_parent">
|
$label = $server['verbose'];
|
||||||
<select name="server" onchange="this.form.submit();">
|
} else {
|
||||||
<?php
|
$label = $server['host'];
|
||||||
|
if (!empty($server['port'])) {
|
||||||
|
$label .= ':' . $server['port'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// loic1: if 'only_db' is an array and there is more than one
|
||||||
|
// value, displaying such informations may not be a so good
|
||||||
|
// idea
|
||||||
|
if (!empty($server['only_db'])) {
|
||||||
|
// TODO FIXME this can become a really big selectbox ...
|
||||||
|
$label .= ' - ' . (is_array($server['only_db']) ? implode(', ', $server['only_db']) : $server['only_db']);
|
||||||
|
}
|
||||||
|
if (!empty($server['user']) && $server['auth_type'] == 'config') {
|
||||||
|
$label .= ' (' . $server['user'] . ')';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
foreach ($cfg['Servers'] AS $key => $val) {
|
|
||||||
if (!empty($val['host'])) {
|
|
||||||
$selected = 0;
|
|
||||||
if (!empty($server) && ($server == $key)) {
|
|
||||||
$selected = 1;
|
|
||||||
}
|
|
||||||
if (!empty($val['verbose'])) {
|
|
||||||
$label = $val['verbose'];
|
|
||||||
} else {
|
|
||||||
$label = $val['host'];
|
|
||||||
if (!empty($val['port'])) {
|
|
||||||
$label .= ':' . $val['port'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// loic1: if 'only_db' is an array and there is more than one
|
|
||||||
// value, displaying such informations may not be a so good
|
|
||||||
// idea
|
|
||||||
if (!empty($val['only_db'])) {
|
|
||||||
$label .= ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']);
|
|
||||||
}
|
|
||||||
if (!empty($val['user']) && ($val['auth_type'] == 'config')) {
|
|
||||||
$label .= ' (' . $val['user'] . ')';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($list){
|
if ($list) {
|
||||||
if ($selected && !$left) {
|
// TODO FIXME display server list as 'list'
|
||||||
echo '» <b>' . htmlspecialchars($label) . '</b><br />';
|
// echo '<li>';
|
||||||
} else {
|
if ($selected && !$ommit_fieldset) {
|
||||||
echo '» <a class="item" href="index.php?server=' . $key . '&lang=' . $lang . '&convcharset=' . $convcharset . '" target="_top">' . htmlspecialchars($label) . '</a><br />';
|
echo '» <b>' . htmlspecialchars($label) . '</b><br />';
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
echo ' <option value="' . $key . '" ' . ($selected ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>' . "\n";
|
echo '» <a class="item" href="index.php?server=' . $key . '&lang=' . $lang . '&convcharset=' . $convcharset . '" target="_top">' . htmlspecialchars($label) . '</a><br />';
|
||||||
}
|
}
|
||||||
|
// echo '</li>';
|
||||||
} // end if (!empty($val['host']))
|
} else {
|
||||||
|
echo ' <option value="' . $key . '" ' . ($selected ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>' . "\n";
|
||||||
|
}
|
||||||
} // end while
|
} // end while
|
||||||
|
|
||||||
if ($form) {
|
if ($not_only_options) {
|
||||||
if ( ! $list ) {
|
echo '</select>';
|
||||||
|
if ($ommit_fieldset) {
|
||||||
|
echo '<hr />';
|
||||||
|
} else {
|
||||||
|
echo '</fieldset>';
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</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; ?>" />
|
||||||
<?php
|
|
||||||
// Show submit button if we have just one server (this happens with no default)
|
|
||||||
if (count($cfg['Servers']) > 1) {
|
|
||||||
echo '<noscript>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<input type="submit" value="<?php echo $GLOBALS['strGo']; ?>" />
|
|
||||||
<?php
|
|
||||||
if (count($cfg['Servers']) > 1) {
|
|
||||||
echo '</noscript>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</form>
|
|
||||||
<?php
|
<?php
|
||||||
}
|
// Show submit button if we have just one server (this happens with no default)
|
||||||
if (!$left) {
|
echo '<noscript>';
|
||||||
?>
|
echo '<input type="submit" value="' . $GLOBALS['strGo'] . '" />';
|
||||||
</fieldset>
|
echo '</noscript>';
|
||||||
<?php
|
echo '</form>';
|
||||||
} else {
|
} elseif ($list) {
|
||||||
echo '<hr />';
|
// TODO FIXME display server list as 'list'
|
||||||
}
|
// echo '</ol>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Reference in New Issue
Block a user