rfe #2964518 [interface] Allow to choose servers from configuration for synchronisation.

This commit is contained in:
Michal Čihař
2010-04-16 16:26:13 +02:00
parent 87d19393b3
commit 13b9403d74
3 changed files with 65 additions and 15 deletions

View File

@@ -73,6 +73,8 @@ $Id$
thanks to Sutharshan Balachandren. thanks to Sutharshan Balachandren.
- rfe #2981999 [interface] Default sort order is now SMART. - rfe #2981999 [interface] Default sort order is now SMART.
- rfe #2972969 [interface] Fix flipping of headers in non-IE browsers. - rfe #2972969 [interface] Fix flipping of headers in non-IE browsers.
+ rfe #2964518 [interface] Allow to choose servers from configuration for
synchronisation.
3.3.3.0 (not yet released) 3.3.3.0 (not yet released)
- patch #2982480 [navi] Do not group if there would be one table in group, - patch #2982480 [navi] Do not group if there would be one table in group,

View File

@@ -5,6 +5,24 @@
*/ */
$(document).ready(function() { $(document).ready(function() {
$('.server_selector').change(function() { $('.server_selector').change(function() {
$(this).closest('tbody').children('.toggler').toggle(); var server = $('.server_selector').val();
if (server == 'cur') {
$(this).closest('tbody').children('.current-server').css('display', '');
$(this).closest('tbody').children('.remote-server').css('display', 'none');
} else if (server == 'rmt') {
$(this).closest('tbody').children('.current-server').css('display', 'none');
$(this).closest('tbody').children('.remote-server').css('display', '');
} else {
$(this).closest('tbody').children('.current-server').css('display', 'none');
$(this).closest('tbody').children('.remote-server').css('display', '');
var parts = server.split('||||');
$('#src_host').val(parts[0]);
$(this).closest('tbody').find('.server-host').val(parts[0]);
$(this).closest('tbody').find('.server-port').val(parts[1]);
$(this).closest('tbody').find('.server-socket').val(parts[2]);
$(this).closest('tbody').find('.server-user').val(parts[3]);
$(this).closest('tbody').find('.server-pass').val('');
$(this).closest('tbody').find('.server-db').val(parts[4])
}
}); });
}); });

View File

@@ -1126,35 +1126,65 @@ if (isset($_REQUEST['synchronize_db'])) {
<td colspan="2" style="text-align: center"> <td colspan="2" style="text-align: center">
<select name="' . $type . '_type" id="' . $type . '_type" class="server_selector"> <select name="' . $type . '_type" id="' . $type . '_type" class="server_selector">
<option value="rmt">' . $GLOBALS['strRemoteServer'] . '</option> <option value="rmt">' . $GLOBALS['strRemoteServer'] . '</option>
<option value="cur">' . $GLOBALS['strCurrentServer'] . '</option> <option value="cur">' . $GLOBALS['strCurrentServer'] . '</option>';
foreach ($GLOBALS['cfg']['Servers'] as $key => $tmp_server) {
if (empty($tmp_server['host'])) {
continue;
}
if (!empty($tmp_server['verbose'])) {
$label = $tmp_server['verbose'];
} else {
$label = $tmp_server['host'];
if (!empty($tmp_server['port'])) {
$label .= ':' . $tmp_server['port'];
}
}
$value = $tmp_server['host'];
$value .= '||||';
if (empty($tmp_server['port']) && empty($tmp_server['socket'])) {
$value .= '3306';
} else {
$value .= $tmp_server['port'];
}
$value .= '||||';
$value .= $tmp_server['socket'];
$value .= '||||';
$value .= $tmp_server['user'];
$value .= '||||';
$value .= $tmp_server['only_db'];
echo '<option value="' . $value . '">'
. htmlspecialchars(sprintf(__('Configuration: %s'), $label)) . '</option>' . "\n";
} // end foreach
echo '
</select> </select>
</td> </td>
</tr> </tr>
<tr class="even toggler"> <tr class="even toggler remote-server">
<td>' . $GLOBALS['strHost'] . '</td> <td>' . $GLOBALS['strHost'] . '</td>
<td><input type="text" name="' . $type . '_host" /></td> <td><input type="text" name="' . $type . '_host" class="server-host" /></td>
</tr> </tr>
<tr class="odd toggler"> <tr class="odd toggler remote-server">
<td>' . $GLOBALS['strPort'] . '</td> <td>' . $GLOBALS['strPort'] . '</td>
<td><input type="text" name="' . $type . '_port" value="3306" maxlength="5" size="5" /></td> <td><input type="text" name="' . $type . '_port" class="server-port" value="3306" maxlength="5" size="5" /></td>
</tr> </tr>
<tr class="even toggler"> <tr class="even toggler remote-server">
<td>' . $GLOBALS['strSocket'] . '</td> <td>' . $GLOBALS['strSocket'] . '</td>
<td><input type="text" name="' . $type . '_socket" /></td> <td><input type="text" name="' . $type . '_socket" class="server-socket" /></td>
</tr> </tr>
<tr class="odd toggler"> <tr class="odd toggler remote-server">
<td>' . $GLOBALS['strUserName']. '</td> <td>' . $GLOBALS['strUserName']. '</td>
<td><input type="text" name="'. $type . '_username" /></td> <td><input type="text" name="'. $type . '_username" class="server-user" /></td>
</tr> </tr>
<tr class="even toggler"> <tr class="even toggler remote-server">
<td>' . $GLOBALS['strPassword'] . '</td> <td>' . $GLOBALS['strPassword'] . '</td>
<td><input type="password" name="' . $type . '_pass" /> </td> <td><input type="password" name="' . $type . '_pass" class="server-pass" /> </td>
</tr> </tr>
<tr class="odd toggler"> <tr class="odd toggler remote-server">
<td>' . $GLOBALS['strDatabase'] . '</td> <td>' . $GLOBALS['strDatabase'] . '</td>
<td><input type="text" name="' . $type . '_db" /></td> <td><input type="text" name="' . $type . '_db" class="server-db" /></td>
</tr> </tr>
<tr class="even toggler" style="display: none;"> <tr class="even toggler current-server" style="display: none;">
<td>' . $GLOBALS['strDatabase'] . '</td> <td>' . $GLOBALS['strDatabase'] . '</td>
<td>'; <td>';
// these unset() do not complain if the elements do not exist // these unset() do not complain if the elements do not exist