Use same code for all server selection, possibly display server links also in right frame, show server links in query frame when possible.
This commit is contained in:
@@ -15,6 +15,11 @@ $Source$
|
||||
pma_theme as cookie name, default theme to some reasonable value to
|
||||
avoid undefined variables all around the code.
|
||||
* main.php, lang/*: strSelectTheme is IMHO not needed.
|
||||
* Documentation.html, config.inc.php, index.php, left.php, main.php,
|
||||
queryframe.php, libraries/config_import.lib.php,
|
||||
libraries/select_server.lib.php: Use same code for all server selection,
|
||||
possibly display server links also in right frame, show server links in
|
||||
query frame when possible.
|
||||
|
||||
2004-06-09 Alexander M. Turek <me@derrabus.de>
|
||||
* libraries/config_import.lib.php: The default settings should be merged.
|
||||
|
@@ -1194,7 +1194,7 @@ Defaults to TRUE. <br />
|
||||
Defaults to FALSE. <br />
|
||||
<br />
|
||||
</dd>
|
||||
<dt><b>$cfg['LeftDisplayServersList'] </b>boolean</dt>
|
||||
<dt><b>$cfg['DisplayServersList'] </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 />
|
||||
|
@@ -226,7 +226,7 @@ $cfg['ShowTooltipAliasTB'] = FALSE; // are shown (in the left menu and db_d
|
||||
|
||||
$cfg['LeftDisplayLogo'] = TRUE; // display logo at top of left frame
|
||||
$cfg['LeftDisplayServers'] = FALSE; // display server choice at top of left frame
|
||||
$cfg['LeftDisplayServersList'] = FALSE; // server choice as links
|
||||
$cfg['DisplayServersList'] = FALSE; // server choice as links
|
||||
|
||||
// In the main frame, at startup...
|
||||
$cfg['ShowStats'] = TRUE; // allow to display statistics and space usage in
|
||||
|
@@ -62,7 +62,7 @@ $phpmain_hash_js = time();
|
||||
|
||||
<?php
|
||||
$query_frame_height = 60;
|
||||
if ($cfg['LeftDisplayServers'] && !$cfg['LeftDisplayServersList']) {
|
||||
if ($cfg['LeftDisplayServers'] && !$cfg['DisplayServersList']) {
|
||||
$query_frame_height = $query_frame_height + 40;
|
||||
}
|
||||
if ($server > 0) {
|
||||
@@ -79,6 +79,11 @@ if ($cfg['LeftDisplayLogo']) {
|
||||
$query_frame_height = $query_frame_height + 50;
|
||||
}
|
||||
if ($cfg['QueryFrame']) {
|
||||
/* Will we show list of servers? */
|
||||
if ($cfg['LeftDisplayServers'] && $cfg['DisplayServersList'] && count($cfg['Servers']) > 1) {
|
||||
$query_frame_height += (count($cfg['Servers']) + 1)*15;
|
||||
}
|
||||
|
||||
if ($cfg['QueryFrameJS']) {
|
||||
echo '<script type="text/javascript">' . "\n";
|
||||
echo '<!--' . "\n";
|
||||
@@ -99,7 +104,7 @@ if ($cfg['QueryFrame']) {
|
||||
echo "\n";
|
||||
echo '<noscript>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
echo '<frameset cols="' . $cfg['LeftWidth'] . ',*" rows="*" border="1" frameborder="1" framespacing="0">' . "\n";
|
||||
echo ' <frameset rows="' . $query_frame_height . ', *" framespacing="0" frameborder="0" border="0">' . "\n";
|
||||
echo ' <frame src="queryframe.php?' . $url_query . '&hash=' . $phpmain_hash . '" name="queryframe" frameborder="0" scrolling="no" />' . "\n";
|
||||
|
77
left.php
77
left.php
@@ -386,81 +386,12 @@ if (!$cfg['QueryFrame']) {
|
||||
</div>
|
||||
<hr />
|
||||
<?php
|
||||
if ($cfg['LeftDisplayServers']) {
|
||||
$show_server_left = TRUE;
|
||||
include('./libraries/select_server.lib.php');
|
||||
}
|
||||
} // end !$cfg['QueryFrame']
|
||||
|
||||
if ($cfg['LeftDisplayServers']) {
|
||||
if ($cfg['LeftDisplayServersList']){
|
||||
?>
|
||||
<br />
|
||||
<?php
|
||||
}else{
|
||||
if (!$cfg['QueryFrame']) {
|
||||
?>
|
||||
<form method="post" action="index.php" target="_parent" style="margin: 0px; padding: 0px;">
|
||||
<?php echo '<div class="heada"><b>' . $strServer . ':</b></div><br />'; ?>
|
||||
<select name="server" onchange="this.form.submit();">
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
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: skip this because it's not a so good idea to display
|
||||
// sockets used to everybody
|
||||
// if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
|
||||
// $label .= ':' . $val['socket'];
|
||||
// }
|
||||
}
|
||||
// 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 ($cfg['LeftDisplayServersList']){
|
||||
if ($selected) {
|
||||
echo '» <b>' . $label . '</b><br />';
|
||||
}else{
|
||||
echo '» <a href="index.php?server=' . $key . '&lang=' . $lang . '&convcharset=' . $convcharset . '" target="_top">' . $label . '</a><br />';
|
||||
}
|
||||
} else {
|
||||
if (!$cfg['QueryFrame']) {
|
||||
echo ' <option value="' . $key . '" ' . ($selected ? ' selected="selected"' : '') . '>' . $label . '</option>' . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
} // end if (!empty($val['host']))
|
||||
} // end while
|
||||
|
||||
if ($cfg['LeftDisplayServersList']){
|
||||
echo '<br />';
|
||||
} else {
|
||||
if (!$cfg['QueryFrame']) {
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
|
||||
<noscript><input type="submit" value="<?php echo $strGo; ?>" /></noscript>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!-- Databases and tables list -->
|
||||
<?php
|
||||
|
@@ -136,7 +136,7 @@ if (isset($cfg['FileRevision'])) {
|
||||
} else {
|
||||
$cfg['FileRevision'] = array(1, 1);
|
||||
}
|
||||
if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 27)) {
|
||||
if ($cfg['FileRevision'][0] < 2 || ($cfg['FileRevision'][0] == 2 && $cfg['FileRevision'][1] < 28)) {
|
||||
require_once('./libraries/config_import.lib.php');
|
||||
}
|
||||
|
||||
|
@@ -340,8 +340,12 @@ if (!isset($cfg['LeftDisplayServers'])) {
|
||||
$cfg['LeftDisplayServers'] = FALSE;
|
||||
}
|
||||
|
||||
if (!isset($cfg['LeftDisplayServersList'])) {
|
||||
$cfg['LeftDisplayServersList'] = FALSE;
|
||||
if (!isset($cfg['DisplayServersList'])) {
|
||||
if (isset($cfg['LeftisplayServersList'])) {
|
||||
$cfg['DisplayServersList'] = $cfg['LeftDisplayServersList'];
|
||||
} else {
|
||||
$cfg['DisplayServersList'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($cfg['ShowStats'])) {
|
||||
|
89
libraries/select_server.lib.php
Normal file
89
libraries/select_server.lib.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
if (count($cfg['Servers']) > 1) {
|
||||
if (!$cfg['DisplayServersList']) {
|
||||
?>
|
||||
<form method="post" action="index.php" target="_parent" style="margin: 0px; padding: 0px;">
|
||||
<?php
|
||||
}
|
||||
if ($show_server_left) {
|
||||
echo '<div class="heada">' . $strServer . ':</div>';
|
||||
} else {
|
||||
?>
|
||||
<!-- MySQL servers choice form -->
|
||||
<table border="0" cellpadding="3" cellspacing="0" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<tr>
|
||||
<th class="tblHeaders"><?php echo $strServerChoice; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
}
|
||||
if (!$cfg['DisplayServersList']) {
|
||||
?>
|
||||
<form method="post" action="index.php" target="_parent" style="margin: 0px; padding: 0px;">
|
||||
<select name="server" onchange="this.form.submit();">
|
||||
<?php
|
||||
}
|
||||
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: skip this because it's not a so good idea to display
|
||||
// sockets used to everybody
|
||||
// if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
|
||||
// $label .= ':' . $val['socket'];
|
||||
// }
|
||||
}
|
||||
// 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 ($cfg['DisplayServersList']){
|
||||
if ($selected) {
|
||||
echo '» <b>' . $label . '</b><br />';
|
||||
}else{
|
||||
echo '» <a class="item" href="index.php?server=' . $key . '&lang=' . $lang . '&convcharset=' . $convcharset . '" target="_top">' . $label . '</a><br />';
|
||||
}
|
||||
} else {
|
||||
echo ' <option value="' . $key . '" ' . ($selected ? ' selected="selected"' : '') . '>' . $label . '</option>' . "\n";
|
||||
}
|
||||
|
||||
} // end if (!empty($val['host']))
|
||||
} // end while
|
||||
|
||||
if (!$cfg['DisplayServersList']){
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
|
||||
<noscript><input type="submit" value="<?php echo $strGo; ?>" /></noscript>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
if (!$show_server_left) {
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<?php
|
||||
} else {
|
||||
echo '<hr />' . "\n";
|
||||
}
|
||||
}
|
||||
?>
|
53
main.php
53
main.php
@@ -140,57 +140,8 @@ if (($server > 0) && isset($mode) && ($mode == 'reload')) {
|
||||
/**
|
||||
* Displays the MySQL servers choice form
|
||||
*/
|
||||
if ($server == 0 || count($cfg['Servers']) > 1) {
|
||||
?>
|
||||
<!-- MySQL servers choice form -->
|
||||
<form method="post" action="index.php" target="_parent" class="nospace">
|
||||
<table border="0" cellpadding="3" cellspacing="0" bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
|
||||
<tr>
|
||||
<th class="tblHeaders"><?php echo $strServerChoice; ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<select name="server">
|
||||
<?php
|
||||
echo "\n";
|
||||
foreach ($cfg['Servers'] AS $key => $val) {
|
||||
if (!empty($val['host'])) {
|
||||
echo ' <option value="' . $key . '"';
|
||||
if (!empty($server) && ($server == $key)) {
|
||||
echo ' selected="selected"';
|
||||
}
|
||||
echo '>';
|
||||
if (!empty($val['verbose'])) {
|
||||
echo $val['verbose'];
|
||||
} else {
|
||||
echo $val['host'];
|
||||
if (!empty($val['port'])) {
|
||||
echo ':' . $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'])) {
|
||||
echo ' - ' . (is_array($val['only_db']) ? implode(', ', $val['only_db']) : $val['only_db']);
|
||||
}
|
||||
if (!empty($val['user']) && ($val['auth_type'] == 'config')) {
|
||||
echo ' (' . $val['user'] . ')';
|
||||
}
|
||||
echo ' </option>' . "\n";
|
||||
} // end if (!empty($val['host']))
|
||||
} // end while
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
|
||||
<input type="submit" value="<?php echo $strGo; ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form><br />
|
||||
<?php
|
||||
} // end of the servers choice form
|
||||
$show_server_left = FALSE;
|
||||
include('./libraries/select_server.lib.php');
|
||||
|
||||
// neted table needed
|
||||
?>
|
||||
|
@@ -170,62 +170,10 @@ if ($cfg['MainPageIconic']) {
|
||||
</div>
|
||||
<hr />
|
||||
|
||||
<!-- Left Display Servers -->
|
||||
<?php
|
||||
$show_line_end = FALSE;
|
||||
if ($cfg['LeftDisplayServers'] && !$cfg['LeftDisplayServersList']){
|
||||
$show_line_end = TRUE;
|
||||
?>
|
||||
<table border="0" cellpadding="1" cellspacing="0">
|
||||
<tr>
|
||||
<td align="left"><span class="heada"><?php echo $strServer . ':<br />' . "\n"; ?></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td nowrap="nowrap">
|
||||
<form method="post" action="index.php" target="_parent" style="margin: 0px; padding: 0px;">
|
||||
<select name="server" onchange="this.form.submit();this.blur();">
|
||||
<?php
|
||||
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: skip this because it's not a so good idea to display
|
||||
// sockets used to everybody
|
||||
// if (!empty($val['socket']) && PMA_PHP_INT_VERSION >= 30010) {
|
||||
// $label .= ':' . $val['socket'];
|
||||
// }
|
||||
}
|
||||
// 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'] . ')';
|
||||
}
|
||||
echo ' <option value="' . $key . '" ' . ($selected ? ' selected="selected"' : '') . '>' . $label . '</option>' . "\n";
|
||||
} // end if (!empty($val['host']))
|
||||
} // end while
|
||||
?>
|
||||
</select>
|
||||
<input type="hidden" name="lang" value="<?php echo $lang; ?>" />
|
||||
<input type="hidden" name="convcharset" value="<?php echo $convcharset; ?>" />
|
||||
<noscript><input type="submit" value="<?php echo $strGo; ?>" /></noscript>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
if ($cfg['LeftDisplayServers']){
|
||||
$show_server_left = TRUE;
|
||||
include('./libraries/select_server.lib.php');
|
||||
} // end if LeftDisplayServers
|
||||
?>
|
||||
<!-- Databases list -->
|
||||
@@ -256,7 +204,6 @@ if ($num_dbs > 1) {
|
||||
// within left.php. With no JS (<noscript>) the whole frameset will
|
||||
// be rebuilt with the new target frame.
|
||||
if ($cfg['LeftFrameLight']) {
|
||||
$show_line_end = TRUE;
|
||||
?>
|
||||
<table border="0" cellpadding="1" cellspacing="0">
|
||||
<tr>
|
||||
@@ -371,12 +318,10 @@ if ($num_dbs > 1) {
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
<?php
|
||||
} // end if LeftFrameLight
|
||||
} // end if num_db > 1
|
||||
if ($show_line_end == TRUE) {
|
||||
echo '<hr />' . "\n";
|
||||
}
|
||||
?>
|
||||
<form name="queryframeform" action="queryframe.php" method="get">
|
||||
<input type="hidden" name="db" value="" />
|
||||
|
Reference in New Issue
Block a user