diff --git a/ChangeLog b/ChangeLog index 3697c7fac..3a3dc23c6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,10 @@ $Source$ - fixed bug #1416848 'Insert new row from Browse page' * libraries/common.lib.php: - 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 * lang/english and hebrew: bug #1429769, typo diff --git a/libraries/select_server.lib.php b/libraries/select_server.lib.php index 022d12de4..c389ac293 100644 --- a/libraries/select_server.lib.php +++ b/libraries/select_server.lib.php @@ -4,96 +4,113 @@ * $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? - $list = $cfg['DisplayServersList']; - if (!$form) { - $list = FALSE; + if ($not_only_options) { + $list = $GLOBALS['cfg']['DisplayServersList']; + $not_only_options =! $list; + } else { + $list = false; } - - if ($form) { - if ($left) { - echo '
' . $GLOBALS['strServer']. ':
'; + + if ($not_only_options) { + echo '
'; + + if (! $ommit_fieldset) { + echo '
'; + } + echo ' '; + + echo ' - $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 ($selected && !$left) { - echo '» ' . htmlspecialchars($label) . '
'; - } else { - echo '» ' . htmlspecialchars($label) . '
'; - } + if ($list) { + // TODO FIXME display server list as 'list' + // echo '
  • '; + if ($selected && !$ommit_fieldset) { + echo '» ' . htmlspecialchars($label) . '
    '; } else { - echo ' ' . "\n"; + echo '» ' . htmlspecialchars($label) . '
    '; } - - } // end if (!empty($val['host'])) + // echo '
  • '; + } else { + echo ' ' . "\n"; + } } // end while - if ($form) { - if ( ! $list ) { - ?> - + if ($not_only_options) { + echo ''; + if ($ommit_fieldset) { + echo '
    '; + } else { + echo '
    '; + } + ?> - 1) { - echo ''; - } - ?> -
    - - '; - } + // Show submit button if we have just one server (this happens with no default) + echo ''; + echo ''; + } elseif ($list) { + // TODO FIXME display server list as 'list' + // echo ''; } } ?>